--- jsr166/src/extra166y/CommonOps.java 2009/01/12 17:16:36 1.2 +++ jsr166/src/extra166y/CommonOps.java 2013/01/16 00:51:11 1.6 @@ -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; @@ -35,7 +35,7 @@ public class CommonOps { return new Reducer() { public T op(T a, T b) { return (a != null && - (b == null || a.compareTo(b) >= 0))? a : b; + (b == null || a.compareTo(b) >= 0)) ? a : b; } }; } @@ -49,7 +49,7 @@ public class CommonOps { return new Reducer() { public T op(T a, T b) { return (a != null && - (b == null || a.compareTo(b) <= 0))? a : b; + (b == null || a.compareTo(b) <= 0)) ? a : b; } }; } @@ -64,7 +64,7 @@ public class CommonOps { return new Reducer() { public T op(T a, T b) { return (a != null && - (b == null || comparator.compare(a, b) >= 0))? a : b; + (b == null || comparator.compare(a, b) >= 0)) ? a : b; } }; } @@ -79,7 +79,7 @@ public class CommonOps { return new Reducer() { public T op(T a, T b) { return (a != null && - (b == null || comparator.compare(a, b) <= 0))? a : b; + (b == null || comparator.compare(a, b) <= 0)) ? a : b; } }; } @@ -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. */ @@ -112,13 +112,13 @@ public class CommonOps { public Object op(Object a, Object b) { return (a != null && (b == null || - ((Comparable)a).compareTo((Comparable)b) >= 0))? a : b; + ((Comparable)a).compareTo((Comparable)b) >= 0)) ? a : b; } } /** * 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. */ @@ -130,7 +130,7 @@ public class CommonOps { public Object op(Object a, Object b) { return (a != null && (b == null || - ((Comparable)a).compareTo((Comparable)b) <= 0))? a : b; + ((Comparable)a).compareTo((Comparable)b) <= 0)) ? a : b; } } @@ -187,7 +187,7 @@ public class CommonOps { (final DoubleComparator comparator) { return new DoubleReducer() { public double op(double a, double b) { - return (comparator.compare(a, b) >= 0)? a : b; + return (comparator.compare(a, b) >= 0) ? a : b; } }; } @@ -200,7 +200,7 @@ public class CommonOps { (final DoubleComparator comparator) { return new DoubleReducer() { public double op(double a, double b) { - return (comparator.compare(a, b) <= 0)? a : b; + return (comparator.compare(a, b) <= 0) ? a : b; } }; } @@ -216,7 +216,7 @@ public class CommonOps { static final NaturalLongComparator comparator = new NaturalLongComparator(); public int compare(long a, long b) { - return a < b? -1 : ((a > b)? 1 : 0); + return (a < b) ? -1 : ((a > b) ? 1 : 0); } } @@ -232,7 +232,7 @@ public class CommonOps { implements LongReducer { public static final NaturalLongMaxReducer max = new NaturalLongMaxReducer(); - public long op(long a, long b) { return a >= b? a : b; } + public long op(long a, long b) { return (a >= b) ? a : b; } } /** @@ -246,7 +246,7 @@ public class CommonOps { implements LongReducer { public static final NaturalLongMinReducer min = new NaturalLongMinReducer(); - public long op(long a, long b) { return a <= b? a : b; } + public long op(long a, long b) { return (a <= b) ? a : b; } } /** @@ -257,7 +257,7 @@ public class CommonOps { (final LongComparator comparator) { return new LongReducer() { public long op(long a, long b) { - return (comparator.compare(a, b) >= 0)? a : b; + return (comparator.compare(a, b) >= 0) ? a : b; } }; } @@ -270,7 +270,7 @@ public class CommonOps { (final LongComparator comparator) { return new LongReducer() { public long op(long a, long b) { - return (comparator.compare(a, b) <= 0)? a : b; + return (comparator.compare(a, b) <= 0) ? a : b; } }; } @@ -521,7 +521,7 @@ public class CommonOps { */ 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)); } }; @@ -533,7 +533,7 @@ public class CommonOps { */ 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)); } }; @@ -545,7 +545,7 @@ public class CommonOps { */ 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)); } }; @@ -557,7 +557,7 @@ public class CommonOps { */ 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)); } }; @@ -711,7 +711,7 @@ public class CommonOps { /** * 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 { @@ -725,7 +725,7 @@ public class CommonOps { /** * 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 { @@ -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;