org.codehaus.gpars

groovyx.gpars.extra166y
[Java] Class CommonOps

java.lang.Object
  groovyx.gpars.extra166y.CommonOps

public class CommonOps

A collection of static factory methods providing commonly useful implementations of operations.


Nested Class Summary
static class CommonOps.DoubleAdder

static class CommonOps.DoubleBoundedRandomGenerator

static class CommonOps.DoubleEqualityPredicate

static class CommonOps.DoubleInequalityPredicate

static class CommonOps.DoubleIntervalRandomGenerator

static class CommonOps.DoubleRandomGenerator

static class CommonOps.EqualityPredicate

static class CommonOps.IdentityPredicate

static class CommonOps.InequalityPredicate

static class CommonOps.IntAdder

static class CommonOps.IntBoundedRandomGenerator

static class CommonOps.IntEqualityPredicate

static class CommonOps.IntInequalityPredicate

static class CommonOps.IntIntervalRandomGenerator

static class CommonOps.IntRandomGenerator

static class CommonOps.IsNonNullPredicate

static class CommonOps.IsNullPredicate

static class CommonOps.LongAdder

static class CommonOps.LongBoundedRandomGenerator

static class CommonOps.LongEqualityPredicate

static class CommonOps.LongInequalityPredicate

static class CommonOps.LongIntervalRandomGenerator

static class CommonOps.LongRandomGenerator

static class CommonOps.NaturalDoubleComparator

static class CommonOps.NaturalDoubleMaxReducer

static class CommonOps.NaturalDoubleMinReducer

static class CommonOps.NaturalLongComparator

static class CommonOps.NaturalLongMaxReducer

static class CommonOps.NaturalLongMinReducer

static class CommonOps.NonidentityPredicate

static class CommonOps.RawComparator

static class CommonOps.RawMaxReducer

static class CommonOps.RawMinReducer

 
Constructor Summary
private CommonOps()

 
Method Summary
static Predicate andPredicate(Predicate first, Predicate second)

Returns a predicate evaluating to the conjunction of its contained predicates.

static DoublePredicate andPredicate(DoublePredicate first, DoublePredicate second)

Returns a predicate evaluating to the conjunction of its contained predicates.

static LongPredicate andPredicate(LongPredicate first, LongPredicate second)

Returns a predicate evaluating to the conjunction of its contained predicates.

static java.util.Comparator castedComparator()

Returns a Comparator that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure.

static Reducer 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.

static Reducer 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.

static Op compoundOp(Op first, Op second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static Op compoundOp(ObjectToDouble first, DoubleToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static Op compoundOp(ObjectToLong first, LongToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToObject compoundOp(DoubleToObject first, Op second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToObject compoundOp(LongToObject first, Op second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToDouble compoundOp(Op first, ObjectToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToLong compoundOp(Op first, ObjectToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToDouble compoundOp(ObjectToDouble first, DoubleOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToLong compoundOp(ObjectToDouble first, DoubleToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToLong compoundOp(ObjectToLong first, LongOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static ObjectToDouble compoundOp(ObjectToLong first, LongToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleOp compoundOp(DoubleOp first, DoubleOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToLong compoundOp(DoubleOp first, DoubleToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToLong compoundOp(DoubleToLong first, LongOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToObject compoundOp(DoubleToLong first, LongToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToObject compoundOp(LongToDouble first, DoubleToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToDouble compoundOp(LongOp first, LongToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToDouble compoundOp(LongToDouble first, DoubleOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToObject compoundOp(DoubleOp first, DoubleToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToObject compoundOp(LongOp first, LongToObject second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleOp compoundOp(DoubleToObject first, ObjectToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongToDouble compoundOp(LongToObject first, ObjectToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleToLong compoundOp(DoubleToObject first, ObjectToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongOp compoundOp(LongToObject first, ObjectToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongOp compoundOp(LongOp first, LongOp second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleOp compoundOp(DoubleToLong first, LongToDouble second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static LongOp compoundOp(LongToDouble first, DoubleToLong second)

Returns a composite mapper that applies a second mapper to the results of applying the first one.

static DoubleReducer doubleAdder()

Returns a reducer that adds two double elements.

static BinaryDoublePredicate doubleEqualityPredicate()

Returns a predicate evaluating to true if the first argument == the second.

static BinaryDoublePredicate doubleInequalityPredicate()

Returns a predicate evaluating to true if the first argument {@code !

static DoubleReducer doubleMaxReducer(DoubleComparator comparator)

Returns a reducer returning the maximum of two double elements, using the given comparator.

static DoubleReducer doubleMinReducer(DoubleComparator comparator)

Returns a reducer returning the minimum of two double elements, using the given comparator.

static DoubleGenerator doubleRandom()

Returns a generator producing uniform random values between zero and one, with the same properties as java.util.Random#nextDouble.

static DoubleGenerator doubleRandom(double bound)

Returns a generator producing uniform random values between zero and the given bound, with the same properties as java.util.Random#nextDouble.

static DoubleGenerator doubleRandom(double least, double bound)

Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).

static BinaryPredicate equalityPredicate()

Returns a predicate evaluating to true if the first argument equals the second.

static BinaryPredicate identityPredicate()

Returns a predicate evaluating to true if the first argument == the second.

static BinaryPredicate inequalityPredicate()

Returns a predicate evaluating to true if the first argument {@code !

static Predicate instanceofPredicate(java.lang.Class type)

Returns a predicate evaluating to true if its argument is an instance of (see java.lang.Class#isInstance the given type (class).

static IntReducer intAdder()

Returns a reducer that adds two int elements.

static BinaryIntPredicate intEqualityPredicate()

Returns a predicate evaluating to true if the first argument == the second.

static BinaryIntPredicate intInequalityPredicate()

Returns a predicate evaluating to true if the first argument {@code !

static IntGenerator intRandom()

Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt.

static IntGenerator intRandom(int bound)

Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt(int).

static IntGenerator intRandom(int least, int bound)

Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).

static Predicate isAssignablePredicate(java.lang.Class type)

Returns a predicate evaluating to true if its argument is assignable from (see java.lang.Class#isAssignableFrom the given type (class).

static Predicate isNonNullPredicate()

Returns a predicate evaluating to true if its argument is non-null.

static Predicate isNullPredicate()

Returns a predicate evaluating to true if its argument is null.

static LongReducer longAdder()

Returns a reducer that adds two long elements.

static BinaryLongPredicate longEqualityPredicate()

Returns a predicate evaluating to true if the first argument == the second.

static BinaryLongPredicate longInequalityPredicate()

Returns a predicate evaluating to true if the first argument == the second.

static LongReducer longMaxReducer(LongComparator comparator)

Returns a reducer returning the maximum of two long elements, using the given comparator.

static LongReducer longMinReducer(LongComparator comparator)

Returns a reducer returning the minimum of two long elements, using the given comparator.

static LongGenerator longRandom()

Returns a generator producing uniform random values with the same properties as java.util.Random#nextLong.

static LongGenerator longRandom(long bound)

Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt(int).

static LongGenerator longRandom(long least, long bound)

Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).

static Reducer maxReducer(java.util.Comparator 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 Reducer minReducer(java.util.Comparator 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 java.util.Comparator naturalComparator(java.lang.Class type)

Returns a Comparator for Comparable objects.

static DoubleComparator naturalDoubleComparator()

Returns a comparator for doubles relying on natural ordering.

static DoubleReducer naturalDoubleMaxReducer()

Returns a reducer returning the maximum of two double elements, using natural comparator.

static DoubleReducer naturalDoubleMinReducer()

Returns a reducer returning the minimum of two double elements, using natural comparator.

static LongComparator naturalLongComparator()

Returns a comparator for longs relying on natural ordering.

static LongReducer naturalLongMaxReducer()

Returns a reducer returning the maximum of two long elements, using natural comparator.

static LongReducer naturalLongMinReducer()

A reducer returning the minimum of two long elements, using natural comparator.

static Reducer naturalMaxReducer(java.lang.Class type)

Returns a reducer returning the maximum of two Comparable elements, treating null as less than any non-null element.

static Reducer naturalMinReducer(java.lang.Class type)

Returns a reducer returning the minimum of two Comparable elements, treating null as greater than any non-null element.

static BinaryPredicate nonidentityPredicate()

Returns a predicate evaluating to true if the first argument {@code !

static Predicate notPredicate(Predicate pred)

Returns a predicate evaluating to the negation of its contained predicate.

static DoublePredicate notPredicate(DoublePredicate pred)

Returns a predicate evaluating to the negation of its contained predicate.

static LongPredicate notPredicate(LongPredicate pred)

Returns a predicate evaluating to the negation of its contained predicate.

static Predicate orPredicate(Predicate first, Predicate second)

Returns a predicate evaluating to the disjunction of its contained predicates.

static DoublePredicate orPredicate(DoublePredicate first, DoublePredicate second)

Returns a predicate evaluating to the disjunction of its contained predicates.

static LongPredicate orPredicate(LongPredicate first, LongPredicate second)

Returns a predicate evaluating to the disjunction of its contained predicates.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

CommonOps

private CommonOps()


 
Method Detail

andPredicate

public static Predicate andPredicate(Predicate first, Predicate second)
Returns a predicate evaluating to the conjunction of its contained predicates.


andPredicate

public static DoublePredicate andPredicate(DoublePredicate first, DoublePredicate second)
Returns a predicate evaluating to the conjunction of its contained predicates.


andPredicate

public static LongPredicate andPredicate(LongPredicate first, LongPredicate second)
Returns a predicate evaluating to the conjunction of its contained predicates.


castedComparator

public static java.util.Comparator castedComparator()
Returns a Comparator that casts its arguments as Comparable on each comparison, throwing ClassCastException on failure.


castedMaxReducer

public static Reducer 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

public static Reducer 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.


compoundOp

public static Op compoundOp(Op first, Op second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static Op compoundOp(ObjectToDouble first, DoubleToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static Op compoundOp(ObjectToLong first, LongToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToObject compoundOp(DoubleToObject first, Op second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToObject compoundOp(LongToObject first, Op second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToDouble compoundOp(Op first, ObjectToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToLong compoundOp(Op first, ObjectToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToDouble compoundOp(ObjectToDouble first, DoubleOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToLong compoundOp(ObjectToDouble first, DoubleToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToLong compoundOp(ObjectToLong first, LongOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static ObjectToDouble compoundOp(ObjectToLong first, LongToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleOp compoundOp(DoubleOp first, DoubleOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToLong compoundOp(DoubleOp first, DoubleToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToLong compoundOp(DoubleToLong first, LongOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToObject compoundOp(DoubleToLong first, LongToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToObject compoundOp(LongToDouble first, DoubleToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToDouble compoundOp(LongOp first, LongToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToDouble compoundOp(LongToDouble first, DoubleOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToObject compoundOp(DoubleOp first, DoubleToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToObject compoundOp(LongOp first, LongToObject second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleOp compoundOp(DoubleToObject first, ObjectToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongToDouble compoundOp(LongToObject first, ObjectToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleToLong compoundOp(DoubleToObject first, ObjectToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongOp compoundOp(LongToObject first, ObjectToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongOp compoundOp(LongOp first, LongOp second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static DoubleOp compoundOp(DoubleToLong first, LongToDouble second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


compoundOp

public static LongOp compoundOp(LongToDouble first, DoubleToLong second)
Returns a composite mapper that applies a second mapper to the results of applying the first one.


doubleAdder

public static DoubleReducer doubleAdder()
Returns a reducer that adds two double elements.


doubleEqualityPredicate

public static BinaryDoublePredicate doubleEqualityPredicate()
Returns a predicate evaluating to true if the first argument == the second.


doubleInequalityPredicate

public static BinaryDoublePredicate doubleInequalityPredicate()
Returns a predicate evaluating to true if the first argument != the second.


doubleMaxReducer

public static DoubleReducer doubleMaxReducer(DoubleComparator comparator)
Returns a reducer returning the maximum of two double elements, using the given comparator.


doubleMinReducer

public static DoubleReducer doubleMinReducer(DoubleComparator comparator)
Returns a reducer returning the minimum of two double elements, using the given comparator.


doubleRandom

public static DoubleGenerator doubleRandom()
Returns a generator producing uniform random values between zero and one, with the same properties as java.util.Random#nextDouble.


doubleRandom

public static DoubleGenerator doubleRandom(double bound)
Returns a generator producing uniform random values between zero and the given bound, with the same properties as java.util.Random#nextDouble.
Parameters:
bound - the upper bound (exclusive) of opd values


doubleRandom

public static DoubleGenerator doubleRandom(double least, double bound)
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).
Parameters:
least - the least value returned
bound - the upper bound (exclusive) of opd values


equalityPredicate

public static BinaryPredicate equalityPredicate()
Returns a predicate evaluating to true if the first argument equals the second.


identityPredicate

public static BinaryPredicate identityPredicate()
Returns a predicate evaluating to true if the first argument == the second.


inequalityPredicate

public static BinaryPredicate inequalityPredicate()
Returns a predicate evaluating to true if the first argument !equals the second.


instanceofPredicate

public static Predicate instanceofPredicate(java.lang.Class type)
Returns a predicate evaluating to true if its argument is an instance of (see java.lang.Class#isInstance the given type (class).


intAdder

public static IntReducer intAdder()
Returns a reducer that adds two int elements.


intEqualityPredicate

public static BinaryIntPredicate intEqualityPredicate()
Returns a predicate evaluating to true if the first argument == the second.


intInequalityPredicate

public static BinaryIntPredicate intInequalityPredicate()
Returns a predicate evaluating to true if the first argument != the second.


intRandom

public static IntGenerator intRandom()
Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt.


intRandom

public static IntGenerator intRandom(int bound)
Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt(int).
Parameters:
bound - the upper bound (exclusive) of opd values


intRandom

public static IntGenerator intRandom(int least, int bound)
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).
Parameters:
least - the least value returned
bound - the upper bound (exclusive) of opd values


isAssignablePredicate

public static Predicate isAssignablePredicate(java.lang.Class type)
Returns a predicate evaluating to true if its argument is assignable from (see java.lang.Class#isAssignableFrom the given type (class).


isNonNullPredicate

public static Predicate isNonNullPredicate()
Returns a predicate evaluating to true if its argument is non-null.


isNullPredicate

public static Predicate isNullPredicate()
Returns a predicate evaluating to true if its argument is null.


longAdder

public static LongReducer longAdder()
Returns a reducer that adds two long elements.


longEqualityPredicate

public static BinaryLongPredicate longEqualityPredicate()
Returns a predicate evaluating to true if the first argument == the second.


longInequalityPredicate

public static BinaryLongPredicate longInequalityPredicate()
Returns a predicate evaluating to true if the first argument == the second.


longMaxReducer

public static LongReducer longMaxReducer(LongComparator comparator)
Returns a reducer returning the maximum of two long elements, using the given comparator.


longMinReducer

public static LongReducer longMinReducer(LongComparator comparator)
Returns a reducer returning the minimum of two long elements, using the given comparator.


longRandom

public static LongGenerator longRandom()
Returns a generator producing uniform random values with the same properties as java.util.Random#nextLong.


longRandom

public static LongGenerator longRandom(long bound)
Returns a generator producing uniform random values with the same properties as java.util.Random#nextInt(int).
Parameters:
bound - the upper bound (exclusive) of opd values


longRandom

public static LongGenerator longRandom(long least, long bound)
Returns a generator producing uniform random values between the given least value (inclusive) and bound (exclusive).
Parameters:
least - the least value returned
bound - the upper bound (exclusive) of opd values


maxReducer

public static Reducer maxReducer(java.util.Comparator comparator)
Returns a reducer returning the maximum of two elements, using the given comparator, and treating null as less than any non-null element.


minReducer

public static Reducer minReducer(java.util.Comparator comparator)
Returns a reducer returning the minimum of two elements, using the given comparator, and treating null as greater than any non-null element.


naturalComparator

public static java.util.Comparator naturalComparator(java.lang.Class type)
Returns a Comparator for Comparable objects.


naturalDoubleComparator

public static DoubleComparator naturalDoubleComparator()
Returns a comparator for doubles relying on natural ordering.


naturalDoubleMaxReducer

public static DoubleReducer naturalDoubleMaxReducer()
Returns a reducer returning the maximum of two double elements, using natural comparator.


naturalDoubleMinReducer

public static DoubleReducer naturalDoubleMinReducer()
Returns a reducer returning the minimum of two double elements, using natural comparator.


naturalLongComparator

public static LongComparator naturalLongComparator()
Returns a comparator for longs relying on natural ordering.


naturalLongMaxReducer

public static LongReducer naturalLongMaxReducer()
Returns a reducer returning the maximum of two long elements, using natural comparator.


naturalLongMinReducer

public static LongReducer naturalLongMinReducer()
A reducer returning the minimum of two long elements, using natural comparator.


naturalMaxReducer

public static Reducer naturalMaxReducer(java.lang.Class type)
Returns a reducer returning the maximum of two Comparable elements, treating null as less than any non-null element.


naturalMinReducer

public static Reducer naturalMinReducer(java.lang.Class type)
Returns a reducer returning the minimum of two Comparable elements, treating null as greater than any non-null element.


nonidentityPredicate

public static BinaryPredicate nonidentityPredicate()
Returns a predicate evaluating to true if the first argument != the second.


notPredicate

public static Predicate notPredicate(Predicate pred)
Returns a predicate evaluating to the negation of its contained predicate.


notPredicate

public static DoublePredicate notPredicate(DoublePredicate pred)
Returns a predicate evaluating to the negation of its contained predicate.


notPredicate

public static LongPredicate notPredicate(LongPredicate pred)
Returns a predicate evaluating to the negation of its contained predicate.


orPredicate

public static Predicate orPredicate(Predicate first, Predicate second)
Returns a predicate evaluating to the disjunction of its contained predicates.


orPredicate

public static DoublePredicate orPredicate(DoublePredicate first, DoublePredicate second)
Returns a predicate evaluating to the disjunction of its contained predicates.


orPredicate

public static LongPredicate orPredicate(LongPredicate first, LongPredicate second)
Returns a predicate evaluating to the disjunction of its contained predicates.


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.