--- jsr166/src/extra166y/CommonOps.java 2010/10/22 05:18:30 1.3 +++ jsr166/src/extra166y/CommonOps.java 2013/02/05 17:46:29 1.7 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; @@ -17,7 +17,7 @@ public class CommonOps { private CommonOps() {} // disable construction /** - * Returns a Comparator for Comparable objects + * Returns a Comparator for Comparable objects. */ public static > Comparator naturalComparator(Class type) { @@ -100,7 +100,7 @@ public class CommonOps { /** * Returns a reducer returning maximum of two values, or - * null if both arguments are null, and that casts + * {@code null} if both arguments are null, and that casts * its arguments as Comparable on each comparison, throwing * ClassCastException on failure. */ @@ -118,7 +118,7 @@ public class CommonOps { /** * Returns a reducer returning minimum of two values, or - * null if both arguments are null, and that casts + * {@code null} if both arguments are null, and that casts * its arguments as Comparable on each comparison, throwing * ClassCastException on failure. */ @@ -136,7 +136,7 @@ public class CommonOps { /** - * Returns a comparator for doubles relying on natural ordering + * Returns a comparator for doubles relying on natural ordering. */ public static DoubleComparator naturalDoubleComparator() { return NaturalDoubleComparator.comparator; @@ -152,7 +152,7 @@ public class CommonOps { /** * Returns a reducer returning the maximum of two double elements, - * using natural comparator + * using natural comparator. */ public static DoubleReducer naturalDoubleMaxReducer() { return NaturalDoubleMaxReducer.max; @@ -167,7 +167,7 @@ public class CommonOps { /** * Returns a reducer returning the minimum of two double elements, - * using natural comparator + * using natural comparator. */ public static DoubleReducer naturalDoubleMinReducer() { return NaturalDoubleMinReducer.min; @@ -181,7 +181,7 @@ public class CommonOps { /** * Returns a reducer returning the maximum of two double elements, - * using the given comparator + * using the given comparator. */ public static DoubleReducer doubleMaxReducer (final DoubleComparator comparator) { @@ -194,7 +194,7 @@ public class CommonOps { /** * Returns a reducer returning the minimum of two double elements, - * using the given comparator + * using the given comparator. */ public static DoubleReducer doubleMinReducer (final DoubleComparator comparator) { @@ -206,7 +206,7 @@ public class CommonOps { } /** - * Returns a comparator for longs relying on natural ordering + * Returns a comparator for longs relying on natural ordering. */ public static LongComparator naturalLongComparator() { return NaturalLongComparator.comparator; @@ -222,7 +222,7 @@ public class CommonOps { /** * Returns a reducer returning the maximum of two long elements, - * using natural comparator + * using natural comparator. */ public static LongReducer naturalLongMaxReducer() { return NaturalLongMaxReducer.max; @@ -237,7 +237,7 @@ public class CommonOps { /** * A reducer returning the minimum of two long elements, - * using natural comparator + * using natural comparator. */ public static LongReducer naturalLongMinReducer() { return NaturalLongMinReducer.min; @@ -251,7 +251,7 @@ public class CommonOps { /** * Returns a reducer returning the maximum of two long elements, - * using the given comparator + * using the given comparator. */ public static LongReducer longMaxReducer (final LongComparator comparator) { @@ -264,7 +264,7 @@ public class CommonOps { /** * Returns a reducer returning the minimum of two long elements, - * using the given comparator + * using the given comparator. */ public static LongReducer longMinReducer (final LongComparator comparator) { @@ -277,7 +277,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static Op compoundOp (final Op first, @@ -289,7 +289,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static Op compoundOp (final ObjectToDouble first, @@ -301,7 +301,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static Op compoundOp (final ObjectToLong first, @@ -313,7 +313,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToObject compoundOp (final DoubleToObject first, @@ -325,7 +325,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToObject compoundOp (final LongToObject first, @@ -337,7 +337,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToDouble compoundOp (final Op first, @@ -349,7 +349,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToLong compoundOp (final Op first, @@ -361,7 +361,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToDouble compoundOp (final ObjectToDouble first, @@ -373,7 +373,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToLong compoundOp (final ObjectToDouble first, @@ -385,7 +385,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToLong compoundOp (final ObjectToLong first, @@ -397,7 +397,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static ObjectToDouble compoundOp (final ObjectToLong first, @@ -409,7 +409,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleOp compoundOp (final DoubleOp first, @@ -421,7 +421,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToLong compoundOp (final DoubleOp first, @@ -433,7 +433,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToLong compoundOp (final DoubleToLong first, @@ -445,7 +445,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToObject compoundOp (final DoubleToLong first, @@ -457,7 +457,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToObject compoundOp (final LongToDouble first, @@ -469,7 +469,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToDouble compoundOp (final LongOp first, @@ -481,7 +481,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToDouble compoundOp (final LongToDouble first, @@ -493,7 +493,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToObject compoundOp (final DoubleOp first, @@ -505,7 +505,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToObject compoundOp (final LongOp first, @@ -517,11 +517,11 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleOp compoundOp (final DoubleToObject first, - final ObjectToDouble second) { + final ObjectToDouble second) { return new DoubleOp() { public final double op(double t) { return second.op(first.op(t)); } }; @@ -529,11 +529,11 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongToDouble compoundOp (final LongToObject first, - final ObjectToDouble second) { + final ObjectToDouble second) { return new LongToDouble() { public final double op(long t) { return second.op(first.op(t)); } }; @@ -541,11 +541,11 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleToLong compoundOp (final DoubleToObject first, - final ObjectToLong second) { + final ObjectToLong second) { return new DoubleToLong() { public final long op(double t) { return second.op(first.op(t)); } }; @@ -553,11 +553,11 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongOp compoundOp (final LongToObject first, - final ObjectToLong second) { + final ObjectToLong second) { return new LongOp() { public final long op(long t) { return second.op(first.op(t)); } }; @@ -565,7 +565,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongOp compoundOp (final LongOp first, @@ -577,7 +577,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static DoubleOp compoundOp (final DoubleToLong first, @@ -589,7 +589,7 @@ public class CommonOps { /** * Returns a composite mapper that applies a second mapper to the results - * of applying the first one + * of applying the first one. */ public static LongOp compoundOp (final LongToDouble first, @@ -600,7 +600,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the negation of its contained predicate + * Returns a predicate evaluating to the negation of its contained predicate. */ public static Predicate notPredicate (final Predicate pred) { @@ -610,7 +610,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the negation of its contained predicate + * Returns a predicate evaluating to the negation of its contained predicate. */ public static DoublePredicate notPredicate (final DoublePredicate pred) { @@ -620,7 +620,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the negation of its contained predicate + * Returns a predicate evaluating to the negation of its contained predicate. */ public static LongPredicate notPredicate (final LongPredicate pred) { @@ -630,7 +630,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the conjunction of its contained predicates + * Returns a predicate evaluating to the conjunction of its contained predicates. */ public static Predicate andPredicate (final Predicate first, @@ -643,7 +643,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the disjunction of its contained predicates + * Returns a predicate evaluating to the disjunction of its contained predicates. */ public static Predicate orPredicate (final Predicate first, @@ -656,7 +656,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the conjunction of its contained predicates + * Returns a predicate evaluating to the conjunction of its contained predicates. */ public static DoublePredicate andPredicate (final DoublePredicate first, @@ -669,7 +669,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the disjunction of its contained predicates + * Returns a predicate evaluating to the disjunction of its contained predicates. */ public static DoublePredicate orPredicate (final DoublePredicate first, @@ -683,7 +683,7 @@ public class CommonOps { /** - * Returns a predicate evaluating to the conjunction of its contained predicates + * Returns a predicate evaluating to the conjunction of its contained predicates. */ public static LongPredicate andPredicate (final LongPredicate first, @@ -696,7 +696,7 @@ public class CommonOps { } /** - * Returns a predicate evaluating to the disjunction of its contained predicates + * Returns a predicate evaluating to the disjunction of its contained predicates. */ public static LongPredicate orPredicate (final LongPredicate first, @@ -709,9 +709,9 @@ public class CommonOps { } /** - * Returns a predicate evaluating to true if its argument is non-null + * Returns a predicate evaluating to true if its argument is non-null. */ - public static Predicate isNonNullPredicate() { + public static Predicate isNonNullPredicate() { return IsNonNullPredicate.predicate; } static final class IsNonNullPredicate implements Predicate { @@ -723,9 +723,9 @@ public class CommonOps { } /** - * Returns a predicate evaluating to true if its argument is null + * Returns a predicate evaluating to true if its argument is null. */ - public static Predicate isNullPredicate() { + public static Predicate isNullPredicate() { return IsNullPredicate.predicate; } static final class IsNullPredicate implements Predicate { @@ -761,7 +761,7 @@ public class CommonOps { } /** - * Returns a reducer that adds two double elements + * Returns a reducer that adds two double elements. */ public static DoubleReducer doubleAdder() { return DoubleAdder.adder; } static final class DoubleAdder implements DoubleReducer { @@ -770,7 +770,7 @@ public class CommonOps { } /** - * Returns a reducer that adds two long elements + * Returns a reducer that adds two long elements. */ public static LongReducer longAdder() { return LongAdder.adder; } static final class LongAdder implements LongReducer { @@ -779,7 +779,7 @@ public class CommonOps { } /** - * Returns a reducer that adds two int elements + * Returns a reducer that adds two int elements. */ public static IntReducer intAdder() { return IntAdder.adder; } static final class IntAdder implements IntReducer { @@ -790,7 +790,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values between * zero and one, with the same properties as {@link - * java.util.Random#nextDouble} + * java.util.Random#nextDouble}. */ public static DoubleGenerator doubleRandom() { return DoubleRandomGenerator.generator; @@ -822,7 +822,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values between the - * given least value (inclusive) and bound (exclusive) + * given least value (inclusive) and bound (exclusive). * @param least the least value returned * @param bound the upper bound (exclusive) of opd values */ @@ -842,7 +842,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values with the - * same properties as {@link java.util.Random#nextLong} + * same properties as {@link java.util.Random#nextLong}. */ public static LongGenerator longRandom() { return LongRandomGenerator.generator; @@ -857,7 +857,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values with the - * same properties as {@link java.util.Random#nextInt(int)} + * same properties as {@link java.util.Random#nextInt(int)}. * @param bound the upper bound (exclusive) of opd values */ public static LongGenerator longRandom(long bound) { @@ -897,7 +897,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values with the - * same properties as {@link java.util.Random#nextInt} + * same properties as {@link java.util.Random#nextInt}. */ public static IntGenerator intRandom() { return IntRandomGenerator.generator; @@ -912,7 +912,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values with the - * same properties as {@link java.util.Random#nextInt(int)} + * same properties as {@link java.util.Random#nextInt(int)}. * @param bound the upper bound (exclusive) of opd values */ public static IntGenerator intRandom(int bound) { @@ -930,7 +930,7 @@ public class CommonOps { /** * Returns a generator producing uniform random values between the - * given least value (inclusive) and bound (exclusive) + * given least value (inclusive) and bound (exclusive). * @param least the least value returned * @param bound the upper bound (exclusive) of opd values */ @@ -952,7 +952,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument equals the second + * first argument {@code equals} the second. */ public static BinaryPredicate equalityPredicate() { return EqualityPredicate.predicate; @@ -967,7 +967,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument == the second + * first argument {@code ==} the second. */ public static BinaryPredicate identityPredicate() { return IdentityPredicate.predicate; @@ -982,7 +982,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument == the second + * first argument {@code ==} the second. */ public static BinaryIntPredicate intEqualityPredicate() { return IntEqualityPredicate.predicate; @@ -997,7 +997,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument == the second + * first argument {@code ==} the second. */ public static BinaryLongPredicate longEqualityPredicate() { return LongEqualityPredicate.predicate; @@ -1012,7 +1012,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument == the second + * first argument {@code ==} the second. */ public static BinaryDoublePredicate doubleEqualityPredicate() { return DoubleEqualityPredicate.predicate; @@ -1028,7 +1028,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument !equals the second + * first argument {@code !equals} the second. */ public static BinaryPredicate inequalityPredicate() { return InequalityPredicate.predicate; @@ -1043,7 +1043,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument != the second + * first argument {@code !=} the second. */ public static BinaryPredicate nonidentityPredicate() { return NonidentityPredicate.predicate; @@ -1058,7 +1058,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument != the second + * first argument {@code !=} the second. */ public static BinaryIntPredicate intInequalityPredicate() { return IntInequalityPredicate.predicate; @@ -1073,7 +1073,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument == the second + * first argument {@code ==} the second. */ public static BinaryLongPredicate longInequalityPredicate() { return LongInequalityPredicate.predicate; @@ -1088,7 +1088,7 @@ public class CommonOps { /** * Returns a predicate evaluating to true if the - * first argument != the second + * first argument {@code !=} the second. */ public static BinaryDoublePredicate doubleInequalityPredicate() { return DoubleInequalityPredicate.predicate;