rwaldhoff 2003/02/18 12:35:40 Modified: functor/src/java/org/apache/commons/functor/adapter BinaryFunctionBinaryPredicate.java BinaryFunctionBinaryProcedure.java BinaryPredicateBinaryFunction.java BinaryProcedureBinaryFunction.java BoundFunction.java BoundPredicate.java BoundProcedure.java FunctionPredicate.java PredicateFunction.java UnaryFunctionUnaryPredicate.java UnaryPredicateUnaryFunction.java Log: ome javadocs Revision Changes Path 1.2 +7 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java Index: BinaryFunctionBinaryPredicate.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BinaryFunctionBinaryPredicate.java 27 Jan 2003 19:33:38 -0000 1.1 +++ BinaryFunctionBinaryPredicate.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -88,6 +88,10 @@ } /** + * Returns the <code>boolean</code> value of the non-<code>null</code> + * <code>Boolean</code> returned by the {@link BinaryFunction#evaluate evaluate} + * method of my underlying function. + * * @throws NullPointerException if my underlying function returns <code>null</code> * @throws ClassCastException if my underlying function returns a non-<code>Boolean</code> */ @@ -128,7 +132,7 @@ * * @param function the possibly-<code>null</code> * {@link BinaryFunction BinaryFunction} to adapt - * @return a {@link BinaryPredicate BinaryPredicate} wrapping the given + * @return a <code>BinaryFunctionBinaryPredicate</code> wrapping the given * {@link BinaryFunction BinaryFunction}, or <code>null</code> * if the given <code>BinaryFunction</code> is <code>null</code> */ 1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java Index: BinaryFunctionBinaryProcedure.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryFunctionBinaryProcedure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BinaryFunctionBinaryProcedure.java 27 Jan 2003 19:33:38 -0000 1.1 +++ BinaryFunctionBinaryProcedure.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -128,7 +128,7 @@ * * @param function the possibly-<code>null</code> * {@link BinaryFunction BinaryFunction} to adapt - * @return a {@link BinaryProcedure BinaryProcedure} wrapping the given + * @return a <code>BinaryFunctionBinaryProcedure</code> wrapping the given * {@link BinaryFunction BinaryFunction}, or <code>null</code> * if the given <code>BinaryFunction</code> is <code>null</code> */ 1.3 +24 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryPredicateBinaryFunction.java Index: BinaryPredicateBinaryFunction.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryPredicateBinaryFunction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BinaryPredicateBinaryFunction.java 28 Jan 2003 12:00:28 -0000 1.2 +++ BinaryPredicateBinaryFunction.java 18 Feb 2003 20:35:40 -0000 1.3 @@ -81,7 +81,14 @@ public BinaryPredicateBinaryFunction(BinaryPredicate predicate) { this.predicate = predicate; } - + + /** + * Returns <code>Boolean.TRUE</code> (<code>Boolean.FALSE</code>) + * when the {@link BinaryPredicate#test test} method of my underlying + * predicate returns <code>true</code> (<code>false</code>). + * + * @return a non-<code>null</code> <code>Boolean</code> instance + */ public Object evaluate(Object left, Object right) { return predicate.test(left,right) ? Boolean.TRUE : Boolean.FALSE; } @@ -110,6 +117,20 @@ return "BinaryPredicateBinaryFunction<" + predicate + ">"; } + + /** + * Adapt the given, possibly-<code>null</code>, + * {@link BinaryPredicate BinaryPredicate} to the + * {@link BinaryFunction BinaryFunction} interface. + * When the given <code>BinaryPredicate</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param predicate the possibly-<code>null</code> + * {@link BinaryPredicate BinaryPredicate} to adapt + * @return a <code>BinaryPredicateBinaryFunction</code> wrapping the given + * {@link BinaryPredicate BinaryPredicate}, or <code>null</code> + * if the given <code>BinaryPredicate</code> is <code>null</code> + */ public static BinaryPredicateBinaryFunction adapt(BinaryPredicate predicate) { return null == predicate ? null : new BinaryPredicateBinaryFunction(predicate); } 1.3 +15 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java Index: BinaryProcedureBinaryFunction.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BinaryProcedureBinaryFunction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BinaryProcedureBinaryFunction.java 28 Jan 2003 12:00:28 -0000 1.2 +++ BinaryProcedureBinaryFunction.java 18 Feb 2003 20:35:40 -0000 1.3 @@ -112,6 +112,19 @@ return "BinaryProcedureBinaryFunction<" + procedure + ">"; } + /** + * Adapt the given, possibly-<code>null</code>, + * {@link BinaryProcedure BinaryProcedure} to the + * {@link BinaryFunction BinaryFunction} interface. + * When the given <code>BinaryProcedure</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param procedure the possibly-<code>null</code> + * {@link BinaryFunction BinaryFunction} to adapt + * @return a <code>BinaryProcedureBinaryFunction</code> wrapping the given + * {@link BinaryFunction BinaryFunction}, or <code>null</code> + * if the given <code>BinaryFunction</code> is <code>null</code> + */ public static BinaryProcedureBinaryFunction adapt(BinaryProcedure procedure) { return null == procedure ? null : new BinaryProcedureBinaryFunction(procedure); } 1.2 +18 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundFunction.java Index: BoundFunction.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BoundFunction.java 28 Jan 2003 23:37:49 -0000 1.1 +++ BoundFunction.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -125,6 +125,22 @@ return "BoundFunction<" + function + "(" + param + ")>"; } + /** + * Adapt the given, possibly-<code>null</code>, + * {@link UnaryFunction UnaryFunction} to the + * {@link Function Function} interface by binding + * the specified <code>Object</code> as a constant + * argument. + * When the given <code>UnaryFunction</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param function the possibly-<code>null</code> + * {@link UnaryFunction UnaryFunction} to adapt + * @param arg the object to bind as a constant argument + * @return a <code>BoundFunction</code> wrapping the given + * {@link UnaryFunction UnaryFunction}, or <code>null</code> + * if the given <code>UnaryFunction</code> is <code>null</code> + */ public static BoundFunction adapt(UnaryFunction function, Object arg) { return null == function ? null : new BoundFunction(function,arg); } 1.2 +18 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundPredicate.java Index: BoundPredicate.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BoundPredicate.java 28 Jan 2003 23:37:49 -0000 1.1 +++ BoundPredicate.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -125,6 +125,22 @@ return "BoundPredicate<" + predicate + "(" + param + ")>"; } + /** + * Adapt the given, possibly-<code>null</code>, + * {@link UnaryPredicate UnaryPredicate} to the + * {@link Predicate Predicate} interface by binding + * the specified <code>Object</code> as a constant + * argument. + * When the given <code>UnaryPredicate</code> is <code>null</code>, + * returns <code>null</code>. + * + * @param predicate the possibly-<code>null</code> + * {@link UnaryPredicate UnaryPredicate} to adapt + * @param arg the object to bind as a constant argument + * @return a <code>BoundPredicate</code> wrapping the given + * {@link UnaryPredicate UnaryPredicate}, or <code>null</code> + * if the given <code>UnaryPredicate</code> is <code>null</code> + */ public static BoundPredicate adapt(UnaryPredicate predicate, Object arg) { return null == predicate ? null : new BoundPredicate(predicate,arg); } 1.2 +18 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundProcedure.java Index: BoundProcedure.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/BoundProcedure.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BoundProcedure.java 28 Jan 2003 23:37:49 -0000 1.1 +++ BoundProcedure.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -125,6 +125,22 @@ return "BoundProcedure<" + procedure + "(" + param + ")>"; } + /** + * Adapt the given, possibly-<code>null</code>, + * {@link UnaryProcedure UnaryProcedure} to the + * {@link 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> + * {@link UnaryProcedure UnaryProcedure} to adapt + * @param arg the object to bind as a constant argument + * @return a <code>BoundProcedure</code> wrapping the given + * {@link UnaryProcedure UnaryProcedure}, or <code>null</code> + * if the given <code>UnaryProcedure</code> is <code>null</code> + */ public static BoundProcedure adapt(UnaryProcedure procedure, Object arg) { return null == procedure ? null : new BoundProcedure(procedure,arg); } 1.2 +6 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/FunctionPredicate.java Index: FunctionPredicate.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/FunctionPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FunctionPredicate.java 27 Jan 2003 19:33:39 -0000 1.1 +++ FunctionPredicate.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -82,6 +82,10 @@ } /** + * Returns the <code>boolean</code> value of the non-<code>null</code> + * <code>Boolean</code> returned by the {@link Function#evaluate evaluate} + * method of my underlying function. + * * @throws NullPointerException if my underlying function returns <code>null</code> * @throws ClassCastException if my underlying function returns a non-<code>Boolean</code> */ 1.2 +9 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/PredicateFunction.java Index: PredicateFunction.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/PredicateFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PredicateFunction.java 27 Jan 2003 19:33:39 -0000 1.1 +++ PredicateFunction.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -82,6 +82,13 @@ this.predicate = predicate; } + /** + * Returns <code>Boolean.TRUE</code> (<code>Boolean.FALSE</code>) + * when the {@link Predicate#test test} method of my underlying + * predicate returns <code>true</code> (<code>false</code>). + * + * @return a non-<code>null</code> <code>Boolean</code> instance + */ public Object evaluate() { return predicate.test() ? Boolean.TRUE : Boolean.FALSE; } 1.2 +6 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java Index: UnaryFunctionUnaryPredicate.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- UnaryFunctionUnaryPredicate.java 27 Jan 2003 19:33:39 -0000 1.1 +++ UnaryFunctionUnaryPredicate.java 18 Feb 2003 20:35:40 -0000 1.2 @@ -88,6 +88,10 @@ } /** + * Returns the <code>boolean</code> value of the non-<code>null</code> + * <code>Boolean</code> returned by the {@link UnaryFunction#evaluate evaluate} + * method of my underlying function. + * * @throws NullPointerException if my underlying function returns <code>null</code> * @throws ClassCastException if my underlying function returns a non-<code>Boolean</code> */ 1.3 +9 -2 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java Index: UnaryPredicateUnaryFunction.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- UnaryPredicateUnaryFunction.java 28 Jan 2003 12:00:28 -0000 1.2 +++ UnaryPredicateUnaryFunction.java 18 Feb 2003 20:35:40 -0000 1.3 @@ -82,6 +82,13 @@ this.predicate = predicate; } + /** + * Returns <code>Boolean.TRUE</code> (<code>Boolean.FALSE</code>) + * when the {@link UnaryPredicate#test test} method of my underlying + * predicate returns <code>true</code> (<code>false</code>). + * + * @return a non-<code>null</code> <code>Boolean</code> instance + */ public Object evaluate(Object obj) { return predicate.test(obj) ? Boolean.TRUE : Boolean.FALSE; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]