Package extra166y
Class CommonOps
java.lang.Object
extra166y.CommonOps
A collection of static factory methods providing commonly useful
implementations of operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Ops.DoublePredicate
andPredicate
(Ops.DoublePredicate first, Ops.DoublePredicate second) Returns a predicate evaluating to the conjunction of its contained predicatesstatic Ops.LongPredicate
andPredicate
(Ops.LongPredicate first, Ops.LongPredicate second) Returns a predicate evaluating to the conjunction of its contained predicatesstatic <S,
T extends S>
Ops.Predicate<T> andPredicate
(Ops.Predicate<S> first, Ops.Predicate<? super T> second) Returns a predicate evaluating to the conjunction of its contained predicatesstatic Comparator
<Object> Returns a Comparator that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure.static Ops.Reducer
<Object> Returns a reducer returning maximum of two values, or null if both arguments are null, and that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure.static Ops.Reducer
<Object> Returns a reducer returning minimum of two values, or null if both arguments are null, and that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure.static Ops.DoubleOp
compoundOp
(Ops.DoubleOp first, Ops.DoubleOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.DoubleToLong
compoundOp
(Ops.DoubleOp first, Ops.DoubleToLong second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.DoubleToObject
<T> compoundOp
(Ops.DoubleOp first, Ops.DoubleToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.DoubleToLong
compoundOp
(Ops.DoubleToLong first, Ops.LongOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.DoubleOp
compoundOp
(Ops.DoubleToLong first, Ops.LongToDouble second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.DoubleToObject
<T> compoundOp
(Ops.DoubleToLong first, Ops.LongToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.DoubleOp
compoundOp
(Ops.DoubleToObject<? extends T> first, Ops.ObjectToDouble<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.DoubleToLong
compoundOp
(Ops.DoubleToObject<? extends T> first, Ops.ObjectToLong<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
V> Ops.DoubleToObject <V> compoundOp
(Ops.DoubleToObject<? extends T> first, Ops.Op<? super T, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.LongOp
compoundOp
(Ops.LongOp first, Ops.LongOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.LongToDouble
compoundOp
(Ops.LongOp first, Ops.LongToDouble second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.LongToObject
<T> compoundOp
(Ops.LongOp first, Ops.LongToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.LongToDouble
compoundOp
(Ops.LongToDouble first, Ops.DoubleOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.LongOp
compoundOp
(Ops.LongToDouble first, Ops.DoubleToLong second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.LongToObject
<T> compoundOp
(Ops.LongToDouble first, Ops.DoubleToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.LongToDouble
compoundOp
(Ops.LongToObject<? extends T> first, Ops.ObjectToDouble<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.LongOp
compoundOp
(Ops.LongToObject<? extends T> first, Ops.ObjectToLong<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
V> Ops.LongToObject <V> compoundOp
(Ops.LongToObject<? extends T> first, Ops.Op<? super T, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.ObjectToDouble
<T> compoundOp
(Ops.ObjectToDouble<? super T> first, Ops.DoubleOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.ObjectToLong
<T> compoundOp
(Ops.ObjectToDouble<? super T> first, Ops.DoubleToLong second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
V> Ops.Op <T, V> compoundOp
(Ops.ObjectToDouble<? super T> first, Ops.DoubleToObject<? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.ObjectToLong
<T> compoundOp
(Ops.ObjectToLong<? super T> first, Ops.LongOp second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T> Ops.ObjectToDouble
<T> compoundOp
(Ops.ObjectToLong<? super T> first, Ops.LongToDouble second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
V> Ops.Op <T, V> compoundOp
(Ops.ObjectToLong<? super T> first, Ops.LongToObject<? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
U> Ops.ObjectToDouble <T> compoundOp
(Ops.Op<? super T, ? extends U> first, Ops.ObjectToDouble<? super U> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
U> Ops.ObjectToLong <T> compoundOp
(Ops.Op<? super T, ? extends U> first, Ops.ObjectToLong<? super U> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic <T,
U, V> Ops.Op <T, V> compoundOp
(Ops.Op<? super T, ? extends U> first, Ops.Op<? super U, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first onestatic Ops.DoubleReducer
Returns a reducer that adds two double elementsstatic Ops.BinaryDoublePredicate
Returns a predicate evaluating to true if the first argument == the secondstatic Ops.BinaryDoublePredicate
Returns a predicate evaluating to true if the first argument != the secondstatic Ops.DoubleReducer
doubleMaxReducer
(Ops.DoubleComparator comparator) Returns a reducer returning the maximum of two double elements, using the given comparatorstatic Ops.DoubleReducer
doubleMinReducer
(Ops.DoubleComparator comparator) Returns a reducer returning the minimum of two double elements, using the given comparatorstatic Ops.DoubleGenerator
Returns a generator producing uniform random values between zero and one, with the same properties asRandom.nextDouble()
static Ops.DoubleGenerator
doubleRandom
(double bound) Returns a generator producing uniform random values between zero and the given bound, with the same properties asRandom.nextDouble()
.static Ops.DoubleGenerator
doubleRandom
(double least, double bound) Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive)static Ops.BinaryPredicate
<Object, Object> Returns a predicate evaluating to true if the first argument equals the secondstatic Ops.BinaryPredicate
<Object, Object> Returns a predicate evaluating to true if the first argument == the secondstatic Ops.BinaryPredicate
<Object, Object> Returns a predicate evaluating to true if the first argument !equals the secondstatic Ops.Predicate
<Object> instanceofPredicate
(Class type) Returns a predicate evaluating to true if its argument is an instance of (seeClass.isInstance(java.lang.Object)
the given type (class).static Ops.IntReducer
intAdder()
Returns a reducer that adds two int elementsstatic Ops.BinaryIntPredicate
Returns a predicate evaluating to true if the first argument == the secondstatic Ops.BinaryIntPredicate
Returns a predicate evaluating to true if the first argument != the secondstatic Ops.IntGenerator
Returns a generator producing uniform random values with the same properties asRandom.nextInt()
static Ops.IntGenerator
intRandom
(int bound) Returns a generator producing uniform random values with the same properties asRandom.nextInt(int)
static Ops.IntGenerator
intRandom
(int least, int bound) Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive)static Ops.Predicate
<Object> isAssignablePredicate
(Class type) Returns a predicate evaluating to true if its argument is assignable from (seeClass.isAssignableFrom(java.lang.Class<?>)
the given type (class).static Ops.Predicate
<Object> Returns a predicate evaluating to true if its argument is non-nullstatic Ops.Predicate
<Object> Returns a predicate evaluating to true if its argument is nullstatic Ops.LongReducer
Returns a reducer that adds two long elementsstatic Ops.BinaryLongPredicate
Returns a predicate evaluating to true if the first argument == the secondstatic Ops.BinaryLongPredicate
Returns a predicate evaluating to true if the first argument == the secondstatic Ops.LongReducer
longMaxReducer
(Ops.LongComparator comparator) Returns a reducer returning the maximum of two long elements, using the given comparatorstatic Ops.LongReducer
longMinReducer
(Ops.LongComparator comparator) Returns a reducer returning the minimum of two long elements, using the given comparatorstatic Ops.LongGenerator
Returns a generator producing uniform random values with the same properties asRandom.nextLong()
static Ops.LongGenerator
longRandom
(long bound) Returns a generator producing uniform random values with the same properties asRandom.nextInt(int)
static Ops.LongGenerator
longRandom
(long least, long bound) Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).static <T> Ops.Reducer
<T> maxReducer
(Comparator<? super T> comparator) Returns a reducer returning the maximum of two elements, using the given comparator, and treating null as less than any non-null element.static <T> Ops.Reducer
<T> minReducer
(Comparator<? super T> comparator) Returns a reducer returning the minimum of two elements, using the given comparator, and treating null as greater than any non-null element.static <T extends Comparable<? super T>>
Comparator<T> naturalComparator
(Class<T> type) Returns a Comparator for Comparable objectsstatic Ops.DoubleComparator
Returns a comparator for doubles relying on natural orderingstatic Ops.DoubleReducer
Returns a reducer returning the maximum of two double elements, using natural comparatorstatic Ops.DoubleReducer
Returns a reducer returning the minimum of two double elements, using natural comparatorstatic Ops.LongComparator
Returns a comparator for longs relying on natural orderingstatic Ops.LongReducer
Returns a reducer returning the maximum of two long elements, using natural comparatorstatic Ops.LongReducer
A reducer returning the minimum of two long elements, using natural comparatorstatic <T extends Comparable<? super T>>
Ops.Reducer<T> naturalMaxReducer
(Class<T> type) Returns a reducer returning the maximum of two Comparable elements, treating null as less than any non-null element.static <T extends Comparable<? super T>>
Ops.Reducer<T> naturalMinReducer
(Class<T> type) Returns a reducer returning the minimum of two Comparable elements, treating null as greater than any non-null element.static Ops.BinaryPredicate
<Object, Object> Returns a predicate evaluating to true if the first argument != the secondstatic Ops.DoublePredicate
Returns a predicate evaluating to the negation of its contained predicatestatic Ops.LongPredicate
Returns a predicate evaluating to the negation of its contained predicatestatic <T> Ops.Predicate
<T> notPredicate
(Ops.Predicate<T> pred) Returns a predicate evaluating to the negation of its contained predicatestatic Ops.DoublePredicate
orPredicate
(Ops.DoublePredicate first, Ops.DoublePredicate second) Returns a predicate evaluating to the disjunction of its contained predicatesstatic Ops.LongPredicate
orPredicate
(Ops.LongPredicate first, Ops.LongPredicate second) Returns a predicate evaluating to the disjunction of its contained predicatesstatic <S,
T extends S>
Ops.Predicate<T> orPredicate
(Ops.Predicate<S> first, Ops.Predicate<? super T> second) Returns a predicate evaluating to the disjunction of its contained predicates
-
Method Details
-
naturalComparator
Returns a Comparator for Comparable objects -
naturalMaxReducer
Returns a reducer returning the maximum of two Comparable elements, treating null as less than any non-null element. -
naturalMinReducer
Returns a reducer returning the minimum of two Comparable elements, treating null as greater than any non-null element. -
maxReducer
Returns a reducer returning the maximum of two elements, using the given comparator, and treating null as less than any non-null element. -
minReducer
Returns a reducer returning the minimum of two elements, using the given comparator, and treating null as greater than any non-null element. -
castedComparator
Returns a Comparator that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure. -
castedMaxReducer
Returns a reducer returning maximum of two values, or null if both arguments are null, and that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure. -
castedMinReducer
Returns a reducer returning minimum of two values, or null if both arguments are null, and that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure. -
naturalDoubleComparator
Returns a comparator for doubles relying on natural ordering -
naturalDoubleMaxReducer
Returns a reducer returning the maximum of two double elements, using natural comparator -
naturalDoubleMinReducer
Returns a reducer returning the minimum of two double elements, using natural comparator -
doubleMaxReducer
Returns a reducer returning the maximum of two double elements, using the given comparator -
doubleMinReducer
Returns a reducer returning the minimum of two double elements, using the given comparator -
naturalLongComparator
Returns a comparator for longs relying on natural ordering -
naturalLongMaxReducer
Returns a reducer returning the maximum of two long elements, using natural comparator -
naturalLongMinReducer
A reducer returning the minimum of two long elements, using natural comparator -
longMaxReducer
Returns a reducer returning the maximum of two long elements, using the given comparator -
longMinReducer
Returns a reducer returning the minimum of two long elements, using the given comparator -
compoundOp
public static <T,U, Ops.Op<T,V> V> compoundOp(Ops.Op<? super T, ? extends U> first, Ops.Op<? super U, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,V> Ops.Op<T,V> compoundOp(Ops.ObjectToDouble<? super T> first, Ops.DoubleToObject<? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,V> Ops.Op<T,V> compoundOp(Ops.ObjectToLong<? super T> first, Ops.LongToObject<? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,V> Ops.DoubleToObject<V> compoundOp(Ops.DoubleToObject<? extends T> first, Ops.Op<? super T, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,V> Ops.LongToObject<V> compoundOp(Ops.LongToObject<? extends T> first, Ops.Op<? super T, ? extends V> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,U> Ops.ObjectToDouble<T> compoundOp(Ops.Op<? super T, ? extends U> first, Ops.ObjectToDouble<? super U> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T,U> Ops.ObjectToLong<T> compoundOp(Ops.Op<? super T, ? extends U> first, Ops.ObjectToLong<? super U> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.ObjectToDouble<T> compoundOp(Ops.ObjectToDouble<? super T> first, Ops.DoubleOp second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.ObjectToLong<T> compoundOp(Ops.ObjectToDouble<? super T> first, Ops.DoubleToLong second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.ObjectToLong<T> compoundOp(Ops.ObjectToLong<? super T> first, Ops.LongOp second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.ObjectToDouble<T> compoundOp(Ops.ObjectToLong<? super T> first, Ops.LongToDouble second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.DoubleToObject<T> compoundOp(Ops.DoubleToLong first, Ops.LongToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.LongToObject<T> compoundOp(Ops.LongToDouble first, Ops.DoubleToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.DoubleToObject<T> compoundOp(Ops.DoubleOp first, Ops.DoubleToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.LongToObject<T> compoundOp(Ops.LongOp first, Ops.LongToObject<? extends T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.DoubleOp compoundOp(Ops.DoubleToObject<? extends T> first, Ops.ObjectToDouble<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.LongToDouble compoundOp(Ops.LongToObject<? extends T> first, Ops.ObjectToDouble<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.DoubleToLong compoundOp(Ops.DoubleToObject<? extends T> first, Ops.ObjectToLong<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
public static <T> Ops.LongOp compoundOp(Ops.LongToObject<? extends T> first, Ops.ObjectToLong<? super T> second) Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
compoundOp
Returns a composite mapper that applies a second mapper to the results of applying the first one -
notPredicate
Returns a predicate evaluating to the negation of its contained predicate -
notPredicate
Returns a predicate evaluating to the negation of its contained predicate -
notPredicate
Returns a predicate evaluating to the negation of its contained predicate -
andPredicate
public static <S,T extends S> Ops.Predicate<T> andPredicate(Ops.Predicate<S> first, Ops.Predicate<? super T> second) Returns a predicate evaluating to the conjunction of its contained predicates -
orPredicate
public static <S,T extends S> Ops.Predicate<T> orPredicate(Ops.Predicate<S> first, Ops.Predicate<? super T> second) Returns a predicate evaluating to the disjunction of its contained predicates -
andPredicate
public static Ops.DoublePredicate andPredicate(Ops.DoublePredicate first, Ops.DoublePredicate second) Returns a predicate evaluating to the conjunction of its contained predicates -
orPredicate
public static Ops.DoublePredicate orPredicate(Ops.DoublePredicate first, Ops.DoublePredicate second) Returns a predicate evaluating to the disjunction of its contained predicates -
andPredicate
Returns a predicate evaluating to the conjunction of its contained predicates -
orPredicate
Returns a predicate evaluating to the disjunction of its contained predicates -
isNonNullPredicate
Returns a predicate evaluating to true if its argument is non-null -
isNullPredicate
Returns a predicate evaluating to true if its argument is null -
instanceofPredicate
Returns a predicate evaluating to true if its argument is an instance of (seeClass.isInstance(java.lang.Object)
the given type (class). -
isAssignablePredicate
Returns a predicate evaluating to true if its argument is assignable from (seeClass.isAssignableFrom(java.lang.Class<?>)
the given type (class). -
doubleAdder
Returns a reducer that adds two double elements -
longAdder
Returns a reducer that adds two long elements -
intAdder
Returns a reducer that adds two int elements -
doubleRandom
Returns a generator producing uniform random values between zero and one, with the same properties asRandom.nextDouble()
-
doubleRandom
Returns a generator producing uniform random values between zero and the given bound, with the same properties asRandom.nextDouble()
.- Parameters:
bound
- the upper bound (exclusive) of opd values
-
doubleRandom
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive)- Parameters:
least
- the least value returnedbound
- the upper bound (exclusive) of opd values
-
longRandom
Returns a generator producing uniform random values with the same properties asRandom.nextLong()
-
longRandom
Returns a generator producing uniform random values with the same properties asRandom.nextInt(int)
- Parameters:
bound
- the upper bound (exclusive) of opd values
-
longRandom
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).- Parameters:
least
- the least value returnedbound
- the upper bound (exclusive) of opd values
-
intRandom
Returns a generator producing uniform random values with the same properties asRandom.nextInt()
-
intRandom
Returns a generator producing uniform random values with the same properties asRandom.nextInt(int)
- Parameters:
bound
- the upper bound (exclusive) of opd values
-
intRandom
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive)- Parameters:
least
- the least value returnedbound
- the upper bound (exclusive) of opd values
-
equalityPredicate
Returns a predicate evaluating to true if the first argument equals the second -
identityPredicate
Returns a predicate evaluating to true if the first argument == the second -
intEqualityPredicate
Returns a predicate evaluating to true if the first argument == the second -
longEqualityPredicate
Returns a predicate evaluating to true if the first argument == the second -
doubleEqualityPredicate
Returns a predicate evaluating to true if the first argument == the second -
inequalityPredicate
Returns a predicate evaluating to true if the first argument !equals the second -
nonidentityPredicate
Returns a predicate evaluating to true if the first argument != the second -
intInequalityPredicate
Returns a predicate evaluating to true if the first argument != the second -
longInequalityPredicate
Returns a predicate evaluating to true if the first argument == the second -
doubleInequalityPredicate
Returns a predicate evaluating to true if the first argument != the second
-