Author: mbenson Date: Thu Apr 3 16:36:48 2008 New Revision: 644563 URL: http://svn.apache.org/viewvc?rev=644563&view=rev Log: checkstyle
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java Thu Apr 3 16:36:48 2008 @@ -38,6 +38,27 @@ * @author Rodney Waldhoff */ public final class BinaryFunctionBinaryProcedure implements BinaryProcedure, Serializable { + + /** + * Adapt the given, possibly-<code>null</code>, + * [EMAIL PROTECTED] BinaryFunction BinaryFunction} to the + * [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} interface. + * When the given <code>BinaryFunction</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param function the possibly-<code>null</code> + * [EMAIL PROTECTED] BinaryFunction BinaryFunction} to adapt + * @return a <code>BinaryFunctionBinaryProcedure</code> wrapping the given + * [EMAIL PROTECTED] BinaryFunction BinaryFunction}, or <code>null</code> + * if the given <code>BinaryFunction</code> is <code>null</code> + */ + public static BinaryFunctionBinaryProcedure adapt(BinaryFunction function) { + return null == function ? null : new BinaryFunctionBinaryProcedure(function); + } + + /** The [EMAIL PROTECTED] BinaryFunction BinaryFunction} I'm wrapping. */ + private BinaryFunction function = null; + /** * Create an [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} wrapping * the given [EMAIL PROTECTED] BinaryFunction BinaryFunction}. @@ -52,9 +73,12 @@ * ignore its returned value. */ public void run(Object left, Object right) { - function.evaluate(left,right); + function.evaluate(left, right); } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof BinaryFunctionBinaryProcedure) { return equals((BinaryFunctionBinaryProcedure) that); @@ -63,10 +87,19 @@ } } + /** + * Learn whether a given BinaryFunctionBinaryPredicate is equal to this. + * @param that BinaryFunctionBinaryPredicate to compare + * @return boolean + */ public boolean equals(BinaryFunctionBinaryProcedure that) { - return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function))); + return that == this + || (null != that && (null == function ? null == that.function : function.equals(that.function))); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { int hash = "BinaryFunctionBinaryProcedure".hashCode(); if (null != function) { @@ -75,27 +108,11 @@ return hash; } - public String toString() { - return "BinaryFunctionBinaryProcedure<" + function + ">"; - } - /** - * Adapt the given, possibly-<code>null</code>, - * [EMAIL PROTECTED] BinaryFunction BinaryFunction} to the - * [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} interface. - * When the given <code>BinaryFunction</code> is <code>null</code>, - * returns <code>null</code>. - * - * @param function the possibly-<code>null</code> - * [EMAIL PROTECTED] BinaryFunction BinaryFunction} to adapt - * @return a <code>BinaryFunctionBinaryProcedure</code> wrapping the given - * [EMAIL PROTECTED] BinaryFunction BinaryFunction}, or <code>null</code> - * if the given <code>BinaryFunction</code> is <code>null</code> + * [EMAIL PROTECTED] */ - public static BinaryFunctionBinaryProcedure adapt(BinaryFunction function) { - return null == function ? null : new BinaryFunctionBinaryProcedure(function); + public String toString() { + return "BinaryFunctionBinaryProcedure<" + function + ">"; } - /** The [EMAIL PROTECTED] BinaryFunction BinaryFunction} I'm wrapping. */ - private BinaryFunction function = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java Thu Apr 3 16:36:48 2008 @@ -39,12 +39,16 @@ * @author Rodney Waldhoff */ public final class BinaryProcedureBinaryFunction implements BinaryFunction, Serializable { + + /** The [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} I'm wrapping. */ + private BinaryProcedure procedure = null; + public BinaryProcedureBinaryFunction(BinaryProcedure procedure) { this.procedure = procedure; } public Object evaluate(Object left, Object right) { - procedure.run(left,right); + procedure.run(left, right); return null; } @@ -57,7 +61,8 @@ } public boolean equals(BinaryProcedureBinaryFunction that) { - return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure))); + return that == this + || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure))); } public int hashCode() { @@ -88,7 +93,4 @@ public static BinaryProcedureBinaryFunction adapt(BinaryProcedure procedure) { return null == procedure ? null : new BinaryProcedureBinaryFunction(procedure); } - - /** The [EMAIL PROTECTED] BinaryProcedure BinaryProcedure} I'm wrapping. */ - private BinaryProcedure procedure = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/BoundProcedure.java Thu Apr 3 16:36:48 2008 @@ -40,6 +40,32 @@ */ public final class BoundProcedure implements Procedure, Serializable { /** + * Adapt the given, possibly-<code>null</code>, + * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} to the + * [EMAIL PROTECTED] Procedure Procedure} interface by binding + * the specified <code>Object</code> as a constant + * argument. + * When the given <code>UnaryProcedure</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param procedure the possibly-<code>null</code> + * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} to adapt + * @param arg the object to bind as a constant argument + * @return a <code>BoundProcedure</code> wrapping the given + * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure}, or <code>null</code> + * if the given <code>UnaryProcedure</code> is <code>null</code> + */ + public static BoundProcedure bind(UnaryProcedure procedure, Object arg) { + return null == procedure ? null : new BoundProcedure(procedure,arg); + } + + /** The [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} I'm wrapping. */ + private UnaryProcedure procedure = null; + /** The parameter to pass to that procedure. */ + private Object param = null; + + /** + * Create a new BoundProcedure. * @param procedure the procedure to adapt * @param arg the constant argument to use */ @@ -48,10 +74,16 @@ this.param = arg; } + /** + * [EMAIL PROTECTED] + */ public void run() { procedure.run(param); } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof BoundProcedure) { return equals((BoundProcedure) that); @@ -60,14 +92,20 @@ } } + /** + * Learn whether a given BoundProcedure is equal to this. + * @param that the BoundProcedure to test + * @return boolean + */ public boolean equals(BoundProcedure that) { - return that == this || ( - (null != that) && - (null == procedure ? null == that.procedure : procedure.equals(that.procedure)) && - (null == param ? null == that.param : param.equals(that.param)) ); - + return that == this || ((null != that) + && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)) + && (null == param ? null == that.param : param.equals(that.param))); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { int hash = "BoundProcedure".hashCode(); if (null != procedure) { @@ -81,32 +119,11 @@ return hash; } - public String toString() { - return "BoundProcedure<" + procedure + "(" + param + ")>"; - } - /** - * Adapt the given, possibly-<code>null</code>, - * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} to the - * [EMAIL PROTECTED] Procedure Procedure} interface by binding - * the specified <code>Object</code> as a constant - * argument. - * When the given <code>UnaryProcedure</code> is <code>null</code>, - * returns <code>null</code>. - * - * @param procedure the possibly-<code>null</code> - * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} to adapt - * @param arg the object to bind as a constant argument - * @return a <code>BoundProcedure</code> wrapping the given - * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure}, or <code>null</code> - * if the given <code>UnaryProcedure</code> is <code>null</code> + * [EMAIL PROTECTED] */ - public static BoundProcedure bind(UnaryProcedure procedure, Object arg) { - return null == procedure ? null : new BoundProcedure(procedure,arg); + public String toString() { + return "BoundProcedure<" + procedure + "(" + param + ")>"; } - /** The [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} I'm wrapping. */ - private UnaryProcedure procedure = null; - /** The parameter to pass to that procedure. */ - private Object param = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftPredicate.java Thu Apr 3 16:36:48 2008 @@ -39,6 +39,13 @@ * @author Rodney Waldhoff */ public final class IgnoreLeftPredicate implements BinaryPredicate, Serializable { + public static IgnoreLeftPredicate adapt(UnaryPredicate predicate) { + return null == predicate ? null : new IgnoreLeftPredicate(predicate); + } + + /** The [EMAIL PROTECTED] UnaryPredicate UnaryPredicate} I'm wrapping. */ + private UnaryPredicate predicate = null; + public IgnoreLeftPredicate(UnaryPredicate predicate) { this.predicate = predicate; } @@ -56,7 +63,8 @@ } public boolean equals(IgnoreLeftPredicate that) { - return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate))); + return that == this + || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate))); } public int hashCode() { @@ -71,10 +79,4 @@ return "IgnoreLeftPredicate<" + predicate + ">"; } - public static IgnoreLeftPredicate adapt(UnaryPredicate predicate) { - return null == predicate ? null : new IgnoreLeftPredicate(predicate); - } - - /** The [EMAIL PROTECTED] UnaryPredicate UnaryPredicate} I'm wrapping. */ - private UnaryPredicate predicate = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightPredicate.java Thu Apr 3 16:36:48 2008 @@ -39,14 +39,35 @@ * @author Rodney Waldhoff */ public final class IgnoreRightPredicate implements BinaryPredicate, Serializable { + /** + * @param predicate + * @return + */ + public static IgnoreRightPredicate adapt(UnaryPredicate predicate) { + return null == predicate ? null : new IgnoreRightPredicate(predicate); + } + + /** The [EMAIL PROTECTED] UnaryPredicate UnaryPredicate} I'm wrapping. */ + private UnaryPredicate predicate = null; + + /** + * Create a new IgnoreRightPredicate. + * @param predicate + */ public IgnoreRightPredicate(UnaryPredicate predicate) { this.predicate = predicate; } + /** + * [EMAIL PROTECTED] + */ public boolean test(Object left, Object right) { return predicate.test(left); } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof IgnoreRightPredicate) { return equals((IgnoreRightPredicate) that); @@ -55,10 +76,19 @@ } } + /** + * Learn whether a given IgnoreRightPredicate is equal to this. + * @param that IgnoreRightPredicate to test + * @return boolean + */ public boolean equals(IgnoreRightPredicate that) { - return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate))); + return that == this + || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate))); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { int hash = "IgnoreRightPredicate".hashCode(); if (null != predicate) { @@ -67,14 +97,11 @@ return hash; } + /** + * [EMAIL PROTECTED] + */ public String toString() { return "IgnoreRightPredicate<" + predicate + ">"; } - public static IgnoreRightPredicate adapt(UnaryPredicate predicate) { - return null == predicate ? null : new IgnoreRightPredicate(predicate); - } - - /** The [EMAIL PROTECTED] UnaryPredicate UnaryPredicate} I'm wrapping. */ - private UnaryPredicate predicate = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryProcedure.java Thu Apr 3 16:36:48 2008 @@ -38,6 +38,27 @@ * @author Rodney Waldhoff */ public final class UnaryFunctionUnaryProcedure implements UnaryProcedure, Serializable { + + /** + * Adapt the given, possibly-<code>null</code>, + * [EMAIL PROTECTED] UnaryFunction UnaryFunction} to the + * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} interface. + * When the given <code>UnaryFunction</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param function the possibly-<code>null</code> + * [EMAIL PROTECTED] UnaryFunction UnaryFunction} to adapt + * @return a [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} wrapping the given + * [EMAIL PROTECTED] UnaryFunction UnaryFunction}, or <code>null</code> + * if the given <code>UnaryFunction</code> is <code>null</code> + */ + public static UnaryFunctionUnaryProcedure adapt(UnaryFunction function) { + return null == function ? null : new UnaryFunctionUnaryProcedure(function); + } + + /** The [EMAIL PROTECTED] UnaryFunction UnaryFunction} I'm wrapping. */ + private UnaryFunction function = null; + /** * Create an [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} wrapping * the given [EMAIL PROTECTED] UnaryFunction UnaryFunction}. @@ -55,6 +76,9 @@ function.evaluate(obj); } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof UnaryFunctionUnaryProcedure) { return equals((UnaryFunctionUnaryProcedure) that); @@ -63,10 +87,19 @@ } } + /** + * Learn whether a specified UnaryFunctionUnaryPredicate is equal to this. + * @param that the UnaryFunctionUnaryPredicate to test + * @return boolean + */ public boolean equals(UnaryFunctionUnaryProcedure that) { - return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function))); + return that == this + || (null != that && (null == function ? null == that.function : function.equals(that.function))); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { int hash = "UnaryFunctionUnaryProcedure".hashCode(); if (null != function) { @@ -75,27 +108,11 @@ return hash; } - public String toString() { - return "UnaryFunctionUnaryProcedure<" + function + ">"; - } - /** - * Adapt the given, possibly-<code>null</code>, - * [EMAIL PROTECTED] UnaryFunction UnaryFunction} to the - * [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} interface. - * When the given <code>UnaryFunction</code> is <code>null</code>, - * returns <code>null</code>. - * - * @param function the possibly-<code>null</code> - * [EMAIL PROTECTED] UnaryFunction UnaryFunction} to adapt - * @return a [EMAIL PROTECTED] UnaryProcedure UnaryProcedure} wrapping the given - * [EMAIL PROTECTED] UnaryFunction UnaryFunction}, or <code>null</code> - * if the given <code>UnaryFunction</code> is <code>null</code> + * [EMAIL PROTECTED] */ - public static UnaryFunctionUnaryProcedure adapt(UnaryFunction function) { - return null == function ? null : new UnaryFunctionUnaryProcedure(function); + public String toString() { + return "UnaryFunctionUnaryProcedure<" + function + ">"; } - /** The [EMAIL PROTECTED] UnaryFunction UnaryFunction} I'm wrapping. */ - private UnaryFunction function = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Identity.java Thu Apr 3 16:36:48 2008 @@ -35,44 +35,75 @@ */ public final class Identity implements UnaryFunction, UnaryPredicate, Serializable { + // static methods + // ------------------------------------------------------------------------ + + /** + * Get an Identity instance. + * @return Identity + */ + public static Identity instance() { + return INSTANCE; + } + + // static attributes + // ------------------------------------------------------------------------ + private static final Identity INSTANCE = new Identity(); + // constructor // ------------------------------------------------------------------------ + + /** + * Create a new Identity. + */ public Identity() { } // function interface // ------------------------------------------------------------------------ + + /** + * [EMAIL PROTECTED] + */ public Object evaluate(Object obj) { return obj; } + /** + * [EMAIL PROTECTED] + */ public boolean test(Object obj) { return test((Boolean) obj); } + /** + * + * @param bool + * @return + */ public boolean test(Boolean bool) { return bool.booleanValue(); } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { return (that instanceof Identity); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { return "Identity".hashCode(); } + /** + * [EMAIL PROTECTED] + */ public String toString() { return "Identity"; } - // static methods - // ------------------------------------------------------------------------ - public static Identity instance() { - return INSTANCE; - } - - // static attributes - // ------------------------------------------------------------------------ - private static final Identity INSTANCE = new Identity(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/RightIdentity.java Thu Apr 3 16:36:48 2008 @@ -35,6 +35,16 @@ */ public final class RightIdentity implements BinaryPredicate, BinaryFunction, Serializable { + // static methods + // ------------------------------------------------------------------------ + public static RightIdentity instance() { + return INSTANCE; + } + + // static attributes + // ------------------------------------------------------------------------ + private static final RightIdentity INSTANCE = new RightIdentity(); + // constructor // ------------------------------------------------------------------------ public RightIdentity() { @@ -67,13 +77,4 @@ return "RightIdentity"; } - // static methods - // ------------------------------------------------------------------------ - public static RightIdentity instance() { - return INSTANCE; - } - - // static attributes - // ------------------------------------------------------------------------ - private static final RightIdentity INSTANCE = new RightIdentity(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsEmpty.java Thu Apr 3 16:36:48 2008 @@ -29,6 +29,18 @@ */ public final class IsEmpty implements UnaryPredicate, Serializable { + // class variables + // ------------------------------------------------------------------------ + + private static final IsEmpty INSTANCE = new IsEmpty(); + + // class methods + // ------------------------------------------------------------------------ + + public static final IsEmpty instance() { + return INSTANCE; + } + // constructor // ------------------------------------------------------------------------ @@ -46,7 +58,7 @@ return testString((String) obj); } else if (null != obj && obj.getClass().isArray()) { return testArray(obj); - } else if (null == obj){ + } else if (null == obj) { throw new NullPointerException("Argument must not be null"); } else { throw new IllegalArgumentException("Expected Collection, Map, String or Array, found " + obj.getClass()); @@ -89,17 +101,5 @@ private boolean testArray(Object array) { return 0 == Array.getLength(array); } - - // class methods - // ------------------------------------------------------------------------ - - public static final IsEmpty instance() { - return INSTANCE; - } - - // class variables - // ------------------------------------------------------------------------ - - private static final IsEmpty INSTANCE = new IsEmpty(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java Thu Apr 3 16:36:48 2008 @@ -29,23 +29,32 @@ * @author Rodney Waldhoff */ public final class ComparatorFunction implements BinaryFunction, Serializable { + private Comparator comparator = null; + + /** + * Create a new ComparatorFunction. + */ public ComparatorFunction() { this(null); } + /** + * Create a new ComparatorFunction. + * @param comparator + */ public ComparatorFunction(Comparator comparator) { this.comparator = null == comparator ? ComparableComparator.instance() : comparator; } /** - * @see org.apache.commons.functor.BinaryFunction#evaluate(Object, Object) + * [EMAIL PROTECTED] */ public Object evaluate(Object left, Object right) { - return new Integer(comparator.compare(left,right)); + return new Integer(comparator.compare(left, right)); } /** - * @see java.lang.Object#equals(Object) + * [EMAIL PROTECTED] */ public boolean equals(Object that) { if (that instanceof ComparatorFunction) { @@ -56,25 +65,26 @@ } /** - * @see #equals(Object) + * Learn whether a specified ComparatorFunction is equal to this. + * @param that the ComparatorFunction to test + * @return boolean */ public boolean equals(ComparatorFunction that) { return null != that && comparator.equals(that.comparator); } /** - * @see java.lang.Object#hashCode() + * [EMAIL PROTECTED] */ public int hashCode() { return "ComparatorFunction".hashCode() ^ comparator.hashCode(); } /** - * @see java.lang.Object#toString() + * [EMAIL PROTECTED] */ public String toString() { return "ComparatorFunction<" + comparator + ">"; } - private Comparator comparator = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java Thu Apr 3 16:36:48 2008 @@ -34,6 +34,27 @@ * @author Rodney Waldhoff */ public final class IsGreaterThan implements BinaryPredicate, Serializable { + private static final IsGreaterThan COMPARABLE_INSTANCE = new IsGreaterThan(); + + /** + * Get a basic IsGreaterThan instance. + * @return IsGreaterThan + */ + public static final IsGreaterThan instance() { + return COMPARABLE_INSTANCE; + } + + /** + * Get an IsGreaterThan UnaryPredicate + * @param right the right side object of the IsGreaterThan comparison + * @return UnaryPredicate + */ + public static final UnaryPredicate instance(Comparable right) { + return RightBoundPredicate.bind(instance(),right); + } + + private Comparator comparator = null; + /** * Construct a <code>IsGreaterThan</code> [EMAIL PROTECTED] BinaryPredicate predicate} * for [EMAIL PROTECTED] Comparable Comparable}s. @@ -60,11 +81,11 @@ * [EMAIL PROTECTED] Comparator Comparator}. */ public boolean test(Object left, Object right) { - return comparator.compare(left,right) > 0; + return comparator.compare(left, right) > 0; } /** - * @see java.lang.Object#equals(Object) + * [EMAIL PROTECTED] */ public boolean equals(Object that) { if (that instanceof IsGreaterThan) { @@ -75,15 +96,16 @@ } /** - * @see #equals(Object) + * Learn whether a given IsGreaterThan is equal to this. + * @param that the IsGreaterThan to test + * @return boolean */ public boolean equals(IsGreaterThan that) { - return null != that && - null == comparator ? null == that.comparator : comparator.equals(that.comparator); + return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator); } /** - * @see java.lang.Object#hashCode() + * [EMAIL PROTECTED] */ public int hashCode() { int hash = "IsGreaterThan".hashCode(); @@ -93,20 +115,10 @@ } /** - * @see java.lang.Object#toString() + * [EMAIL PROTECTED] */ public String toString() { return "IsGreaterThan<" + comparator + ">"; } - public static final IsGreaterThan instance() { - return COMPARABLE_INSTANCE; - } - - public static final UnaryPredicate instance(Comparable right) { - return RightBoundPredicate.bind(instance(),right); - } - - private Comparator comparator = null; - private static final IsGreaterThan COMPARABLE_INSTANCE = new IsGreaterThan(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java Thu Apr 3 16:36:48 2008 @@ -34,6 +34,27 @@ * @author Rodney Waldhoff */ public final class IsLessThan implements BinaryPredicate, Serializable { + private static final IsLessThan COMPARABLE_INSTANCE = new IsLessThan(); + + /** + * Get a basic IsLessThan instance. + * @return IsLessThan + */ + public static final IsLessThan instance() { + return COMPARABLE_INSTANCE; + } + + /** + * Get an IsLessThan UnaryPredicate. + * @param right the right side object of the comparison. + * @return UnaryPredicate + */ + public static final UnaryPredicate instance(Comparable right) { + return RightBoundPredicate.bind(instance(),right); + } + + private Comparator comparator = null; + /** * Construct a <code>IsLessThan</code> [EMAIL PROTECTED] BinaryPredicate predicate} * for [EMAIL PROTECTED] Comparable Comparable}s. @@ -60,11 +81,11 @@ * [EMAIL PROTECTED] Comparator Comparator}. */ public boolean test(Object left, Object right) { - return comparator.compare(left,right) < 0; + return comparator.compare(left, right) < 0; } /** - * @see java.lang.Object#equals(Object) + * [EMAIL PROTECTED] */ public boolean equals(Object that) { if (that instanceof IsLessThan) { @@ -75,7 +96,9 @@ } /** - * @see #equals(Object) + * Learn whether a given IsLessThan is equal to this. + * @param that IsLessThan to test + * @return boolean */ public boolean equals(IsLessThan that) { return null != that && @@ -83,7 +106,7 @@ } /** - * @see java.lang.Object#hashCode() + * [EMAIL PROTECTED] */ public int hashCode() { int hash = "IsLessThan".hashCode(); @@ -93,20 +116,10 @@ } /** - * @see java.lang.Object#toString() + * [EMAIL PROTECTED] */ public String toString() { return "IsLessThan<" + comparator + ">"; } - public static final IsLessThan instance() { - return COMPARABLE_INSTANCE; - } - - public static final UnaryPredicate instance(Comparable right) { - return RightBoundPredicate.bind(instance(),right); - } - - private Comparator comparator = null; - private static final IsLessThan COMPARABLE_INSTANCE = new IsLessThan(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java Thu Apr 3 16:36:48 2008 @@ -34,6 +34,10 @@ * @author Rodney Waldhoff */ public final class IsLessThanOrEqual implements BinaryPredicate, Serializable { + private static final IsLessThanOrEqual COMPARABLE_INSTANCE = new IsLessThanOrEqual(); + + private Comparator comparator = null; + /** * Construct a <code>IsLessThanOrEqual</code> [EMAIL PROTECTED] BinaryPredicate predicate} * for [EMAIL PROTECTED] Comparable Comparable}s. @@ -60,7 +64,7 @@ * [EMAIL PROTECTED] Comparator Comparator}. */ public boolean test(Object left, Object right) { - return comparator.compare(left,right) <= 0; + return comparator.compare(left, right) <= 0; } /** @@ -78,8 +82,7 @@ * @see #equals(Object) */ public boolean equals(IsLessThanOrEqual that) { - return null != that && - null == comparator ? null == that.comparator : comparator.equals(that.comparator); + return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator); } /** @@ -104,9 +107,6 @@ } public static final UnaryPredicate instance(Comparable right) { - return RightBoundPredicate.bind(instance(),right); + return RightBoundPredicate.bind(instance(), right); } - - private Comparator comparator = null; - private static final IsLessThanOrEqual COMPARABLE_INSTANCE = new IsLessThanOrEqual(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java Thu Apr 3 16:36:48 2008 @@ -40,24 +40,47 @@ // constructor // ------------------------------------------------------------------------ + /** + * Create a new And. + */ public And() { super(); } + /** + * Create a new And. + * @param p + */ public And(Predicate p) { super(p); } + /** + * Create a new And. + * @param p + * @param q + */ public And(Predicate p, Predicate q) { - super(p,q); + super(p, q); } + /** + * Create a new And. + * @param p + * @param q + * @param r + */ public And(Predicate p, Predicate q, Predicate r) { - super(p,q,r); + super(p, q, r); } // modifiers // ------------------------------------------------------------------------ + /** + * + * @param p + * @return + */ public And and(Predicate p) { super.addPredicate(p); return this; @@ -65,6 +88,9 @@ // predicate interface // ------------------------------------------------------------------------ + /** + * [EMAIL PROTECTED] + */ public boolean test() { for (Iterator iter = getPredicateIterator(); iter.hasNext();) { if (!((Predicate) iter.next()).test()) { @@ -74,6 +100,9 @@ return true; } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof And) { return equals((And) that); @@ -82,14 +111,25 @@ } } + /** + * Learn whether a given And is equal to this. + * @param that the And to test + * @return boolean + */ public boolean equals(And that) { return getPredicateListEquals(that); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { return "And".hashCode() ^ getPredicateListHashCode(); } + /** + * [EMAIL PROTECTED] + */ public String toString() { return "And<" + getPredicateListToString() + ">"; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java Thu Apr 3 16:36:48 2008 @@ -38,21 +38,43 @@ * @author Rodney Waldhoff */ abstract class BaseUnaryPredicateList implements UnaryPredicate, Serializable { + + // attributes + // ------------------------------------------------------------------------ + private List list = new ArrayList(); // constructor // ------------------------------------------------------------------------ + /** + * Create a new BaseUnaryPredicateList. + */ protected BaseUnaryPredicateList() { } + /** + * Create a new BaseUnaryPredicateList. + * @param p + */ protected BaseUnaryPredicateList(UnaryPredicate p) { addUnaryPredicate(p); } + /** + * Create a new BaseUnaryPredicateList. + * @param p + * @param q + */ protected BaseUnaryPredicateList(UnaryPredicate p, UnaryPredicate q) { addUnaryPredicate(p); addUnaryPredicate(q); } + /** + * Create a new BaseUnaryPredicateList. + * @param p + * @param q + * @param r + */ protected BaseUnaryPredicateList(UnaryPredicate p, UnaryPredicate q, UnaryPredicate r) { addUnaryPredicate(p); addUnaryPredicate(q); @@ -61,38 +83,69 @@ // abstract // ------------------------------------------------------------------------ + /** + * [EMAIL PROTECTED] + */ public abstract boolean equals(Object that); + + /** + * [EMAIL PROTECTED] + */ public abstract int hashCode(); + + /** + * [EMAIL PROTECTED] + */ public abstract String toString(); + + /** + * [EMAIL PROTECTED] + */ public abstract boolean test(Object obj); // modifiers // ------------------------------------------------------------------------ + /** + * Add a UnaryPredicate to the list + * @param p UnaryPredicate to add + */ protected void addUnaryPredicate(UnaryPredicate p) { list.add(p); } // protected // ------------------------------------------------------------------------ - + /** + * Get an Iterator over the contained UnaryPredicates. + * @return Iterator + */ protected Iterator getUnaryPredicateIterator() { return list.iterator(); } + /** + * Learn whether another BaseUnaryPredicateList has content equal to this + * @param that the BaseUnaryPredicateList to test + * @return boolean + */ protected boolean getUnaryPredicateListEquals(BaseUnaryPredicateList that) { return (null != that && this.list.equals(that.list)); } + /** + * Get a hashCode for the list. + * @return int + */ protected int getUnaryPredicateListHashCode() { return list.hashCode(); } + /** + * Get a toString for the list. + * @return String + */ protected String getUnaryPredicateListToString() { return String.valueOf(list); } - - // attributes - // ------------------------------------------------------------------------ - private List list = new ArrayList(); } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java Thu Apr 3 16:36:48 2008 @@ -49,11 +49,11 @@ } public BinaryAnd(BinaryPredicate p, BinaryPredicate q) { - super(p,q); + super(p, q); } public BinaryAnd(BinaryPredicate p, BinaryPredicate q, BinaryPredicate r) { - super(p,q,r); + super(p, q, r); } // modifiers Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java Thu Apr 3 16:36:48 2008 @@ -32,33 +32,78 @@ // constructor - for beanish apis // ------------------------------------------------------------------------ + + /** + * Create a new Conditional. + */ public Conditional() { } // ------------------------------------------------------------------------ + /** + * Create a conditional procedure. + * @param q + * @param r + * @param s + * @return UnaryProcedure + */ public static final UnaryProcedure procedure(UnaryPredicate q, UnaryProcedure r, UnaryProcedure s) { - return new ConditionalUnaryProcedure(q,r,s); + return new ConditionalUnaryProcedure(q, r, s); } + /** + * + * @param q + * @param r + * @param s + * @return UnaryFunction + */ public static final UnaryFunction function(UnaryPredicate q, UnaryFunction r, UnaryFunction s) { - return new ConditionalUnaryFunction(q,r,s); + return new ConditionalUnaryFunction(q, r, s); } + /** + * + * @param q + * @param r + * @param s + * @return UnaryPredicate + */ public static final UnaryPredicate predicate(UnaryPredicate q, UnaryPredicate r, UnaryPredicate s) { - return new ConditionalUnaryPredicate(q,r,s); + return new ConditionalUnaryPredicate(q, r, s); } + /** + * + * @param q + * @param r + * @param s + * @return BinaryProcedure + */ public static final BinaryProcedure procedure(BinaryPredicate q, BinaryProcedure r, BinaryProcedure s) { - return new ConditionalBinaryProcedure(q,r,s); + return new ConditionalBinaryProcedure(q, r, s); } + /** + * + * @param q + * @param r + * @param s + * @return BinaryFunction + */ public static final BinaryFunction function(BinaryPredicate q, BinaryFunction r, BinaryFunction s) { - return new ConditionalBinaryFunction(q,r,s); + return new ConditionalBinaryFunction(q, r, s); } + /** + * + * @param q + * @param r + * @param s + * @return BinaryPredicate + */ public static final BinaryPredicate predicate(BinaryPredicate q, BinaryPredicate r, BinaryPredicate s) { - return new ConditionalBinaryPredicate(q,r,s); + return new ConditionalBinaryPredicate(q, r, s); } - } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java Thu Apr 3 16:36:48 2008 @@ -42,25 +42,44 @@ */ public final class ConditionalBinaryProcedure implements BinaryProcedure, Serializable { + // attributes + // ------------------------------------------------------------------------ + private BinaryPredicate ifPred = null; + private BinaryProcedure thenProc = null; + private BinaryProcedure elseProc = null; + // constructor // ------------------------------------------------------------------------ + /** + * Create a new ConditionalBinaryProcedure. + * @param ifPred + * @param thenPred + * @param elsePred + */ public ConditionalBinaryProcedure(BinaryPredicate ifPred, BinaryProcedure thenPred, BinaryProcedure elsePred) { this.ifPred = ifPred; this.thenProc = thenPred; this.elseProc = elsePred; } - + // predicate interface // ------------------------------------------------------------------------ + + /** + * [EMAIL PROTECTED] + */ public void run(Object left, Object right) { - if (ifPred.test(left,right)) { - thenProc.run(left,right); + if (ifPred.test(left, right)) { + thenProc.run(left, right); } else { - elseProc.run(left,right); + elseProc.run(left, right); } } + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object that) { if (that instanceof ConditionalBinaryProcedure) { return equals((ConditionalBinaryProcedure) that); @@ -69,13 +88,21 @@ } } + /** + * Learn whether a given ConditionalBinaryProcedure is equal to this. + * @param that compared object + * @return boolean + */ public boolean equals(ConditionalBinaryProcedure that) { - return null != that && - (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) && - (null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc)) && - (null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc)); + return null != that + && (null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) + && (null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc)) + && (null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc)); } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { int hash = "ConditionalBinaryProcedure".hashCode(); if (null != ifPred) { @@ -93,13 +120,10 @@ return hash; } + /** + * [EMAIL PROTECTED] + */ public String toString() { return "ConditionalBinaryProcedure<" + ifPred + "?" + thenProc + ":" + elseProc + ">"; } - - // attributes - // ------------------------------------------------------------------------ - private BinaryPredicate ifPred = null; - private BinaryProcedure thenProc = null; - private BinaryProcedure elseProc = null; } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java Thu Apr 3 16:36:48 2008 @@ -37,17 +37,27 @@ * @author Rodney Waldhoff */ public class DoWhileProcedure extends AbstractLoopProcedure { + /** + * Create a new DoWhileProcedure. + * @param action + * @param condition + */ public DoWhileProcedure(Procedure action, Predicate condition) { super(condition, action); } + /** + * [EMAIL PROTECTED] + */ public void run() { do { getAction().run(); - } while(getCondition().test()); + } while (getCondition().test()); } - + /** + * [EMAIL PROTECTED] + */ public boolean equals(Object object) { if (object instanceof DoWhileProcedure) { return super.equals(object); @@ -56,11 +66,17 @@ } } + /** + * [EMAIL PROTECTED] + */ public int hashCode() { return super.hashCode("DoWhileProcedure".hashCode()); } + /** + * [EMAIL PROTECTED] + */ public String toString() { - return "DoWhileProcedure<do("+getAction()+") while("+getCondition()+")>"; + return "DoWhileProcedure<do(" + getAction() + ") while(" + getCondition() + ")>"; } } Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java?rev=644563&r1=644562&r2=644563&view=diff ============================================================================== --- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java (original) +++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java Thu Apr 3 16:36:48 2008 @@ -35,6 +35,16 @@ * @author Rodney Waldhoff */ public final class Not implements Predicate, Serializable { + + // static + // ------------------------------------------------------------------------ + public static Predicate not(Predicate that) { + return null == that ? null : new Not(that); + } + + // attributes + // ------------------------------------------------------------------------ + private Predicate predicate = null; // constructor // ------------------------------------------------------------------------ @@ -72,14 +82,4 @@ public String toString() { return "Not<" + predicate + ">"; } - - // static - // ------------------------------------------------------------------------ - public static Predicate not(Predicate that) { - return null == that ? null : new Not(that); - } - - // attributes - // ------------------------------------------------------------------------ - private Predicate predicate = null; }