Skip to content

Commit

Permalink
Sort members
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 11, 2024
1 parent 30e6276 commit f46a46b
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ public AndPredicate(final Predicate<? super T> predicate1, final Predicate<? sup
iPredicate2 = predicate2;
}

/**
* Evaluates the predicate returning true if both predicates return true.
*
* @param object the input object
* @return true if both decorated predicates return true
*/
@Override
public boolean test(final T object) {
return iPredicate1.test(object) && iPredicate2.test(object);
}

/**
* Gets the two predicates being decorated as an array.
*
Expand All @@ -87,4 +76,15 @@ public Predicate<? super T>[] getPredicates() {
return new Predicate[] {iPredicate1, iPredicate2};
}

/**
* Evaluates the predicate returning true if both predicates return true.
*
* @param object the input object
* @return true if both decorated predicates return true
*/
@Override
public boolean test(final T object) {
return iPredicate1.test(object) && iPredicate2.test(object);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ public EqualPredicate(final T object, final Equator<T> equator) {
this.equator = equator;
}

/**
* Gets the value.
*
* @return the value
* @since 3.1
*/
public Object getValue() {
return iValue;
}

/**
* Evaluates the predicate returning true if the input equals the stored value.
*
Expand All @@ -108,14 +118,4 @@ public boolean test(final T object) {
return iValue.equals(object);
}

/**
* Gets the value.
*
* @return the value
* @since 3.1
*/
public Object getValue() {
return iValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public static <T> Predicate<T> exceptionPredicate() {
private ExceptionPredicate() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

/**
* Evaluates the predicate always throwing an exception.
*
Expand All @@ -65,13 +74,4 @@ public boolean test(final T object) {
throw new FunctorException("ExceptionPredicate invoked");
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public static <T> Predicate<T> falsePredicate() {
private FalsePredicate() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

/**
* Evaluates the predicate returning false always.
*
Expand All @@ -63,13 +72,4 @@ public boolean test(final T object) {
return false;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,6 @@ static <T extends java.util.function.Predicate<?>> T[] copy(final T... predicate
return transformers.clone();
}

/**
* Validates the consumers to ensure that all is well.
*
* @param consumers the consumers to validate.
*/
static void validate(final Consumer<?>... consumers) {
Objects.requireNonNull(consumers, "closures");
for (int i = 0; i < consumers.length; i++) {
if (consumers[i] == null) {
throw new NullPointerException("closures[" + i + "]");
}
}
}

/**
* Validate the predicates to ensure that all is well.
*
Expand All @@ -144,15 +130,15 @@ static <T> Predicate<? super T>[] validate(final Collection<? extends java.util.
}

/**
* Validate the predicates to ensure that all is well.
* Validates the consumers to ensure that all is well.
*
* @param predicates the predicates to validate
* @param consumers the consumers to validate.
*/
static void validate(final java.util.function.Predicate<?>... predicates) {
Objects.requireNonNull(predicates, "predicates");
for (int i = 0; i < predicates.length; i++) {
if (predicates[i] == null) {
throw new NullPointerException("predicates[" + i + "]");
static void validate(final Consumer<?>... consumers) {
Objects.requireNonNull(consumers, "closures");
for (int i = 0; i < consumers.length; i++) {
if (consumers[i] == null) {
throw new NullPointerException("closures[" + i + "]");
}
}
}
Expand All @@ -171,6 +157,20 @@ static void validate(final Function<?, ?>... functions) {
}
}

/**
* Validate the predicates to ensure that all is well.
*
* @param predicates the predicates to validate
*/
static void validate(final java.util.function.Predicate<?>... predicates) {
Objects.requireNonNull(predicates, "predicates");
for (int i = 0; i < predicates.length; i++) {
if (predicates[i] == null) {
throw new NullPointerException("predicates[" + i + "]");
}
}
}

/**
* Restricted constructor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ public IdentityPredicate(final T object) {
iValue = object;
}

/**
* Gets the value.
*
* @return the value
* @since 3.1
*/
public T getValue() {
return iValue;
}

/**
* Evaluates the predicate returning true if the input object is identical to
* the stored object.
Expand All @@ -71,14 +81,4 @@ public boolean test(final T object) {
return iValue == object;
}

/**
* Gets the value.
*
* @return the value
* @since 3.1
*/
public T getValue() {
return iValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ public InstanceofPredicate(final Class<?> type) {
iType = type;
}

/**
* Gets the type to compare to.
*
* @return the type
* @since 3.1
*/
public Class<?> getType() {
return iType;
}

/**
* Evaluates the predicate returning true if the input object is of the correct type.
*
Expand All @@ -67,14 +77,4 @@ public boolean test(final Object object) {
return iType.isInstance(object);
}

/**
* Gets the type to compare to.
*
* @return the type
* @since 3.1
*/
public Class<?> getType() {
return iType;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public static <T> Predicate<T> notNullPredicate() {
private NotNullPredicate() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

/**
* Evaluates the predicate returning true if the object does not equal null.
*
Expand All @@ -63,13 +72,4 @@ public boolean test(final T object) {
return object != null;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ public NotPredicate(final Predicate<? super T> predicate) {
iPredicate = predicate;
}

/**
* Evaluates the predicate returning the opposite to the stored predicate.
*
* @param object the input object
* @return true if predicate returns false
*/
@Override
public boolean test(final T object) {
return !iPredicate.test(object);
}

/**
* Gets the predicate being decorated.
*
Expand All @@ -80,4 +69,15 @@ public Predicate<? super T>[] getPredicates() {
return new Predicate[] {iPredicate};
}

/**
* Evaluates the predicate returning the opposite to the stored predicate.
*
* @param object the input object
* @return true if predicate returns false
*/
@Override
public boolean test(final T object) {
return !iPredicate.test(object);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ public NullIsExceptionPredicate(final Predicate<? super T> predicate) {
iPredicate = predicate;
}

/**
* Gets the predicate being decorated.
*
* @return the predicate as the only element in an array
* @since 3.1
*/
@Override
@SuppressWarnings("unchecked")
public Predicate<? super T>[] getPredicates() {
return new Predicate[] { iPredicate };
}

/**
* Evaluates the predicate returning the result of the decorated predicate
* once a null check is performed.
Expand All @@ -74,16 +86,4 @@ public boolean test(final T object) {
return iPredicate.test(object);
}

/**
* Gets the predicate being decorated.
*
* @return the predicate as the only element in an array
* @since 3.1
*/
@Override
@SuppressWarnings("unchecked")
public Predicate<? super T>[] getPredicates() {
return new Predicate[] { iPredicate };
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ public NullIsFalsePredicate(final Predicate<? super T> predicate) {
iPredicate = predicate;
}

/**
* Gets the predicate being decorated.
*
* @return the predicate as the only element in an array
* @since 3.1
*/
@Override
@SuppressWarnings("unchecked")
public Predicate<? super T>[] getPredicates() {
return new Predicate[] { iPredicate };
}

/**
* Evaluates the predicate returning the result of the decorated predicate
* once a null check is performed.
Expand All @@ -72,16 +84,4 @@ public boolean test(final T object) {
return iPredicate.test(object);
}

/**
* Gets the predicate being decorated.
*
* @return the predicate as the only element in an array
* @since 3.1
*/
@Override
@SuppressWarnings("unchecked")
public Predicate<? super T>[] getPredicates() {
return new Predicate[] { iPredicate };
}

}
Loading

0 comments on commit f46a46b

Please sign in to comment.