You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/04/03 22:23:31 UTC
svn commit: r644470 [2/7] - in /commons/sandbox/functor/trunk/src:
main/java/org/apache/commons/functor/
main/java/org/apache/commons/functor/adapter/
main/java/org/apache/commons/functor/core/
main/java/org/apache/commons/functor/core/collection/ main...
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryFunction UnaryFunction}
- * to the
- * {@link BinaryFunction BinaryFunction} interface
+ * {@link UnaryFunction UnaryFunction}
+ * to the
+ * {@link BinaryFunction BinaryFunction} interface
* by ignoring the first binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreLeftFunction(UnaryFunction function) {
this.function = function;
}
-
+
public Object evaluate(Object left, Object right) {
return function.evaluate(right);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreLeftFunction) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreLeftFunction that) {
return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function)));
}
-
+
public int hashCode() {
int hash = "IgnoreLeftFunction".hashCode();
if(null != function) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreLeftFunction<" + function + ">";
}
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryPredicate UnaryPredicate}
- * to the
- * {@link BinaryPredicate BinaryPredicate} interface
+ * {@link UnaryPredicate UnaryPredicate}
+ * to the
+ * {@link BinaryPredicate BinaryPredicate} interface
* by ignoring the first binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreLeftPredicate(UnaryPredicate predicate) {
this.predicate = predicate;
}
-
+
public boolean test(Object left, Object right) {
return predicate.test(right);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreLeftPredicate) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreLeftPredicate that) {
return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
}
-
+
public int hashCode() {
int hash = "IgnoreLeftPredicate".hashCode();
if(null != predicate) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreLeftPredicate<" + predicate + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreLeftProcedure.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryProcedure UnaryProcedure}
- * to the
- * {@link BinaryProcedure BinaryProcedure} interface
+ * {@link UnaryProcedure UnaryProcedure}
+ * to the
+ * {@link BinaryProcedure BinaryProcedure} interface
* by ignoring the first binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreLeftProcedure(UnaryProcedure procedure) {
this.procedure = procedure;
}
-
+
public void run(Object left, Object right) {
procedure.run(left);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreLeftProcedure) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreLeftProcedure that) {
return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
}
-
+
public int hashCode() {
int hash = "IgnoreLeftProcedure".hashCode();
if(null != procedure) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreLeftProcedure<" + procedure + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryFunction UnaryFunction}
- * to the
- * {@link BinaryFunction BinaryFunction} interface
+ * {@link UnaryFunction UnaryFunction}
+ * to the
+ * {@link BinaryFunction BinaryFunction} interface
* by ignoring the second binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreRightFunction(UnaryFunction function) {
this.function = function;
}
-
+
public Object evaluate(Object left, Object right) {
return function.evaluate(left);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreRightFunction) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreRightFunction that) {
return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function)));
}
-
+
public int hashCode() {
int hash = "IgnoreRightFunction".hashCode();
if(null != function) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreRightFunction<" + function + ">";
}
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryPredicate UnaryPredicate}
- * to the
- * {@link BinaryPredicate BinaryPredicate} interface
+ * {@link UnaryPredicate UnaryPredicate}
+ * to the
+ * {@link BinaryPredicate BinaryPredicate} interface
* by ignoring the second binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreRightPredicate(UnaryPredicate predicate) {
this.predicate = predicate;
}
-
+
public boolean test(Object left, Object right) {
return predicate.test(left);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreRightPredicate) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreRightPredicate that) {
return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
}
-
+
public int hashCode() {
int hash = "IgnoreRightPredicate".hashCode();
if(null != predicate) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreRightPredicate<" + predicate + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/IgnoreRightProcedure.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryProcedure UnaryProcedure}
- * to the
- * {@link BinaryProcedure BinaryProcedure} interface
+ * {@link UnaryProcedure UnaryProcedure}
+ * to the
+ * {@link BinaryProcedure BinaryProcedure} interface
* by ignoring the second binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public IgnoreRightProcedure(UnaryProcedure procedure) {
this.procedure = procedure;
}
-
+
public void run(Object left, Object right) {
procedure.run(left);
- }
+ }
public boolean equals(Object that) {
if(that instanceof IgnoreRightProcedure) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(IgnoreRightProcedure that) {
return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
}
-
+
public int hashCode() {
int hash = "IgnoreRightProcedure".hashCode();
if(null != procedure) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "IgnoreRightProcedure<" + procedure + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryFunction BinaryFunction}
- * to the
- * {@link UnaryFunction UnaryFunction} interface
+ * {@link BinaryFunction BinaryFunction}
+ * to the
+ * {@link UnaryFunction UnaryFunction} interface
* using a constant left-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.function = function;
this.param = arg;
}
-
+
public Object evaluate(Object obj) {
return function.evaluate(param,obj);
- }
+ }
public boolean equals(Object that) {
if(that instanceof LeftBoundFunction) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(LeftBoundFunction that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == function ? null == that.function : function.equals(that.function)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "LeftBoundFunction".hashCode();
if(null != function) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "LeftBoundFunction<" + function + "(" + param + ",?)>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundPredicate.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryPredicate BinaryPredicate}
- * to the
- * {@link UnaryPredicate UnaryPredicate} interface
+ * {@link BinaryPredicate BinaryPredicate}
+ * to the
+ * {@link UnaryPredicate UnaryPredicate} interface
* using a constant left-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.predicate = predicate;
this.param = arg;
}
-
+
public boolean test(Object obj) {
return predicate.test(param,obj);
- }
+ }
public boolean equals(Object that) {
if(that instanceof LeftBoundPredicate) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(LeftBoundPredicate that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == predicate ? null == that.predicate : predicate.equals(that.predicate)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "LeftBoundPredicate".hashCode();
if(null != predicate) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "LeftBoundPredicate<" + predicate + "(" + param + ",?)>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryProcedure BinaryProcedure}
- * to the
- * {@link UnaryProcedure UnaryProcedure} interface
+ * {@link BinaryProcedure BinaryProcedure}
+ * to the
+ * {@link UnaryProcedure UnaryProcedure} interface
* using a constant left-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.procedure = procedure;
this.param = arg;
}
-
+
public void run(Object obj) {
procedure.run(param,obj);
- }
+ }
public boolean equals(Object that) {
if(that instanceof LeftBoundProcedure) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(LeftBoundProcedure that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == procedure ? null == that.procedure : procedure.equals(that.procedure)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "LeftBoundProcedure".hashCode();
if(null != procedure) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "LeftBoundProcedure<" + procedure + "(" + param + ",?)>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateFunction.java Thu Apr 3 13:23:16 2008
@@ -23,17 +23,17 @@
/**
* Adapts a
- * {@link Predicate Predicate}
- * to the
+ * {@link Predicate Predicate}
+ * to the
* {@link Function Function} interface.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying predicate is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -41,17 +41,17 @@
public PredicateFunction(Predicate predicate) {
this.predicate = predicate;
}
-
+
/**
* Returns <code>Boolean.TRUE</code> (<code>Boolean.FALSE</code>)
- * when the {@link Predicate#test test} method of my underlying
+ * 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;
- }
+ }
public boolean equals(Object that) {
if(that instanceof PredicateFunction) {
@@ -60,11 +60,11 @@
return false;
}
}
-
+
public boolean equals(PredicateFunction that) {
return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
}
-
+
public int hashCode() {
int hash = "PredicateFunction".hashCode();
if(null != predicate) {
@@ -72,7 +72,7 @@
}
return hash;
}
-
+
public String toString() {
return "PredicateFunction<" + predicate + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/PredicateUnaryPredicate.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link Predicate Predicate}
- * to the
- * {@link UnaryPredicate UnaryPredicate} interface
+ * {@link Predicate Predicate}
+ * to the
+ * {@link UnaryPredicate UnaryPredicate} interface
* by ignoring the given argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public PredicateUnaryPredicate(Predicate predicate) {
this.predicate = predicate;
}
-
+
public boolean test(Object obj) {
return predicate.test();
- }
+ }
public boolean equals(Object that) {
if(that instanceof PredicateUnaryPredicate) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(PredicateUnaryPredicate that) {
return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
}
-
+
public int hashCode() {
int hash = "PredicateUnaryPredicate".hashCode();
if(null != predicate) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "PredicateUnaryPredicate<" + predicate + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link Procedure Procedure}
- * to the
+ * {@link Procedure Procedure}
+ * to the
* {@link Function Function} interface
* by always returning <code>null</code>.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying procedure is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,11 +42,11 @@
public ProcedureFunction(Procedure procedure) {
this.procedure = procedure;
}
-
+
public Object evaluate() {
procedure.run();
return null;
- }
+ }
public boolean equals(Object that) {
if(that instanceof ProcedureFunction) {
@@ -55,11 +55,11 @@
return false;
}
}
-
+
public boolean equals(ProcedureFunction that) {
return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
}
-
+
public int hashCode() {
int hash = "ProcedureFunction".hashCode();
if(null != procedure) {
@@ -67,7 +67,7 @@
}
return hash;
}
-
+
public String toString() {
return "ProcedureFunction<" + procedure + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureUnaryProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureUnaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/ProcedureUnaryProcedure.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link Procedure Procedure}
- * to the
- * {@link UnaryProcedure UnaryProcedure} interface
+ * {@link Procedure Procedure}
+ * to the
+ * {@link UnaryProcedure UnaryProcedure} interface
* by ignoring the second binary argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying functor is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,10 +42,10 @@
public ProcedureUnaryProcedure(Procedure procedure) {
this.procedure = procedure;
}
-
+
public void run(Object obj) {
procedure.run();
- }
+ }
public boolean equals(Object that) {
if(that instanceof ProcedureUnaryProcedure) {
@@ -54,11 +54,11 @@
return false;
}
}
-
+
public boolean equals(ProcedureUnaryProcedure that) {
return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
}
-
+
public int hashCode() {
int hash = "ProcedureUnaryProcedure".hashCode();
if(null != procedure) {
@@ -66,7 +66,7 @@
}
return hash;
}
-
+
public String toString() {
return "ProcedureUnaryProcedure<" + procedure + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryFunction BinaryFunction}
- * to the
- * {@link UnaryFunction UnaryFunction} interface
+ * {@link BinaryFunction BinaryFunction}
+ * to the
+ * {@link UnaryFunction UnaryFunction} interface
* using a constant right-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.function = function;
this.param = arg;
}
-
+
public Object evaluate(Object obj) {
return function.evaluate(obj,param);
- }
+ }
public boolean equals(Object that) {
if(that instanceof RightBoundFunction) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(RightBoundFunction that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == function ? null == that.function : function.equals(that.function)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "RightBoundFunction".hashCode();
if(null != function) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "RightBoundFunction<" + function + "(?," + param + ")>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundPredicate.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryPredicate BinaryPredicate}
- * to the
- * {@link UnaryPredicate UnaryPredicate} interface
+ * {@link BinaryPredicate BinaryPredicate}
+ * to the
+ * {@link UnaryPredicate UnaryPredicate} interface
* using a constant left-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.predicate = predicate;
this.param = arg;
}
-
+
public boolean test(Object obj) {
return predicate.test(obj,param);
- }
+ }
public boolean equals(Object that) {
if(that instanceof RightBoundPredicate) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(RightBoundPredicate that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == predicate ? null == that.predicate : predicate.equals(that.predicate)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "RightBoundPredicate".hashCode();
if(null != predicate) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "RightBoundPredicate<" + predicate + "(?," + param + ")>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/RightBoundProcedure.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link BinaryProcedure BinaryProcedure}
- * to the
- * {@link UnaryProcedure UnaryProcedure} interface
+ * {@link BinaryProcedure BinaryProcedure}
+ * to the
+ * {@link UnaryProcedure UnaryProcedure} interface
* using a constant left-side argument.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying objects are. Attempts to serialize
- * an instance whose delegates are not
+ * an instance whose delegates are not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -47,10 +47,10 @@
this.procedure = procedure;
this.param = arg;
}
-
+
public void run(Object obj) {
procedure.run(obj,param);
- }
+ }
public boolean equals(Object that) {
if(that instanceof RightBoundProcedure) {
@@ -59,15 +59,15 @@
return false;
}
}
-
+
public boolean equals(RightBoundProcedure that) {
- return that == this || (
- (null != that) &&
+ return that == this || (
+ (null != that) &&
(null == procedure ? null == that.procedure : procedure.equals(that.procedure)) &&
(null == param ? null == that.param : param.equals(that.param)) );
-
+
}
-
+
public int hashCode() {
int hash = "RightBoundProcedure".hashCode();
if(null != procedure) {
@@ -80,7 +80,7 @@
}
return hash;
}
-
+
public String toString() {
return "RightBoundProcedure<" + procedure + "(?," + param + ")>";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryFunctionUnaryPredicate.java Thu Apr 3 13:23:16 2008
@@ -27,13 +27,13 @@
* to the {@link UnaryPredicate UnaryPredicate}
* interface.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying function is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -46,18 +46,18 @@
public UnaryFunctionUnaryPredicate(UnaryFunction function) {
this.function = function;
}
-
+
/**
* 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>
*/
public boolean test(Object obj) {
return ((Boolean)(function.evaluate(obj))).booleanValue();
- }
+ }
public boolean equals(Object that) {
if(that instanceof UnaryFunctionUnaryPredicate) {
@@ -66,11 +66,11 @@
return false;
}
}
-
+
public boolean equals(UnaryFunctionUnaryPredicate that) {
return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function)));
}
-
+
public int hashCode() {
int hash = "UnaryFunctionUnaryPredicate".hashCode();
if(null != function) {
@@ -78,19 +78,19 @@
}
return hash;
}
-
+
public String toString() {
return "UnaryFunctionUnaryPredicate<" + function + ">";
}
-
+
/**
- * Adapt the given, possibly-<code>null</code>,
+ * Adapt the given, possibly-<code>null</code>,
* {@link UnaryFunction UnaryFunction} to the
* {@link UnaryPredicate UnaryPredicate} interface.
* When the given <code>UnaryFunction</code> is <code>null</code>,
* returns <code>null</code>.
- *
- * @param function the possibly-<code>null</code>
+ *
+ * @param function the possibly-<code>null</code>
* {@link UnaryFunction UnaryFunction} to adapt
* @return a {@link UnaryPredicate UnaryPredicate} wrapping the given
* {@link UnaryFunction UnaryFunction}, or <code>null</code>
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -27,13 +27,13 @@
* interface by ignoring the value returned
* by the function.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying function is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -46,14 +46,14 @@
public UnaryFunctionUnaryProcedure(UnaryFunction function) {
this.function = function;
}
-
+
/**
- * {@link UnaryFunction#evaluate Evaluate} my function, but
+ * {@link UnaryFunction#evaluate Evaluate} my function, but
* ignore its returned value.
*/
public void run(Object obj) {
function.evaluate(obj);
- }
+ }
public boolean equals(Object that) {
if(that instanceof UnaryFunctionUnaryProcedure) {
@@ -62,11 +62,11 @@
return false;
}
}
-
+
public boolean equals(UnaryFunctionUnaryProcedure that) {
return that == this || (null != that && (null == function ? null == that.function : function.equals(that.function)));
}
-
+
public int hashCode() {
int hash = "UnaryFunctionUnaryProcedure".hashCode();
if(null != function) {
@@ -74,19 +74,19 @@
}
return hash;
}
-
+
public String toString() {
return "UnaryFunctionUnaryProcedure<" + function + ">";
}
-
+
/**
- * Adapt the given, possibly-<code>null</code>,
+ * Adapt the given, possibly-<code>null</code>,
* {@link UnaryFunction UnaryFunction} to the
* {@link UnaryProcedure UnaryProcedure} interface.
* When the given <code>UnaryFunction</code> is <code>null</code>,
* returns <code>null</code>.
- *
- * @param function the possibly-<code>null</code>
+ *
+ * @param function the possibly-<code>null</code>
* {@link UnaryFunction UnaryFunction} to adapt
* @return a {@link UnaryProcedure UnaryProcedure} wrapping the given
* {@link UnaryFunction UnaryFunction}, or <code>null</code>
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryPredicateUnaryFunction.java Thu Apr 3 13:23:16 2008
@@ -22,18 +22,18 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * Adapts a
- * {@link UnaryPredicate UnaryPredicate}
- * to the
+ * Adapts a
+ * {@link UnaryPredicate UnaryPredicate}
+ * to the
* {@link UnaryFunction UnaryFunction} interface.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying predicate is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -41,17 +41,17 @@
public UnaryPredicateUnaryFunction(UnaryPredicate predicate) {
this.predicate = predicate;
}
-
+
/**
* Returns <code>Boolean.TRUE</code> (<code>Boolean.FALSE</code>)
- * when the {@link UnaryPredicate#test test} method of my underlying
+ * 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;
- }
+ }
public boolean equals(Object that) {
if(that instanceof UnaryPredicateUnaryFunction) {
@@ -60,11 +60,11 @@
return false;
}
}
-
+
public boolean equals(UnaryPredicateUnaryFunction that) {
return that == this || (null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate)));
}
-
+
public int hashCode() {
int hash = "UnaryPredicateUnaryFunction".hashCode();
if(null != predicate) {
@@ -72,7 +72,7 @@
}
return hash;
}
-
+
public String toString() {
return "UnaryPredicateUnaryFunction<" + predicate + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/adapter/UnaryProcedureUnaryFunction.java Thu Apr 3 13:23:16 2008
@@ -23,18 +23,18 @@
/**
* Adapts a
- * {@link UnaryProcedure UnaryProcedure}
- * to the
+ * {@link UnaryProcedure UnaryProcedure}
+ * to the
* {@link UnaryFunction UnaryFunction} interface
* by always returning <code>null</code>.
* <p/>
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* underlying procedure is. Attempts to serialize
- * an instance whose delegate is not
+ * an instance whose delegate is not
* <code>Serializable</code> will result in an exception.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -42,11 +42,11 @@
public UnaryProcedureUnaryFunction(UnaryProcedure procedure) {
this.procedure = procedure;
}
-
+
public Object evaluate(Object obj) {
procedure.run(obj);
return null;
- }
+ }
public boolean equals(Object that) {
if(that instanceof UnaryProcedureUnaryFunction) {
@@ -55,11 +55,11 @@
return false;
}
}
-
+
public boolean equals(UnaryProcedureUnaryFunction that) {
return that == this || (null != that && (null == procedure ? null == that.procedure : procedure.equals(that.procedure)));
}
-
+
public int hashCode() {
int hash = "UnaryProcedureUnaryFunction".hashCode();
if(null != procedure) {
@@ -67,7 +67,7 @@
}
return hash;
}
-
+
public String toString() {
return "UnaryProcedureUnaryFunction<" + procedure + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Constant.java Thu Apr 3 13:23:16 2008
@@ -31,11 +31,11 @@
* {@link #test Tests} to a constant value, assuming
* a boolean of Boolean value is supplied.
*
- * Note that although this class implements
+ * Note that although this class implements
* {@link Serializable}, a given instance will
* only be truly <code>Serializable</code> if the
* constant <code>Object</code> is. Attempts to serialize
- * an instance whose value is not
+ * an instance whose value is not
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -52,7 +52,7 @@
public Constant(Object value) {
this.value = value;
}
-
+
// function interface
// ------------------------------------------------------------------------
public Object evaluate() {
@@ -86,11 +86,11 @@
return false;
}
}
-
+
public boolean equals(Constant that) {
return (null != that && (null == this.value ? null == that.value : this.value.equals(that.value)));
}
-
+
public int hashCode() {
int hash = "Constant".hashCode();
if(null != value) {
@@ -98,19 +98,19 @@
}
return hash;
}
-
+
public String toString() {
return "Constant<" + String.valueOf(value) + ">";
}
-
+
// attributes
// ------------------------------------------------------------------------
private Object value;
// static methods
// ------------------------------------------------------------------------
-
- /**
+
+ /**
* Get a <code>Constant</code> that always
* returns <code>true</code>
* @return a <code>Constant</code> that always
@@ -120,7 +120,7 @@
return TRUE_PREDICATE;
}
- /**
+ /**
* Get a <code>Constant</code> that always
* returns <code>false</code>
* @return a <code>Constant</code> that always
@@ -129,8 +129,8 @@
public static Constant falsePredicate() {
return FALSE_PREDICATE;
}
-
- /**
+
+ /**
* Get a <code>Constant</code> that always
* returns <i>value</i>
* @param value the constant value
@@ -144,7 +144,7 @@
public static Constant instance(Object value) {
return new Constant(value);
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final Constant TRUE_PREDICATE = new Constant(true);
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -23,13 +23,13 @@
/**
* {@link #evaluate Evaluates} to its input argument.
- *
+ *
* {@link #test Tests} to the <code>boolean</code>
* value of the <code>Boolean</code>-valued parameter.
- * The {@link #test} method throws an exception if
- * the parameter isn't a non-<code>null</code>
+ * The {@link #test} method throws an exception if
+ * the parameter isn't a non-<code>null</code>
* <code>Boolean</code>.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -39,7 +39,7 @@
// ------------------------------------------------------------------------
public Identity() {
}
-
+
// function interface
// ------------------------------------------------------------------------
public Object evaluate(Object obj) {
@@ -57,21 +57,21 @@
public boolean equals(Object that) {
return (that instanceof Identity);
}
-
+
public int hashCode() {
return "Identity".hashCode();
}
-
+
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/IsEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsEqual.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsEqual.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsEqual.java Thu Apr 3 13:23:16 2008
@@ -21,17 +21,17 @@
import org.apache.commons.functor.BinaryPredicate;
/**
- * {@link #test Tests}
- * <code>true</code> iff its arguments are
- * {@link Object#equals equal} or both
+ * {@link #test Tests}
+ * <code>true</code> iff its arguments are
+ * {@link Object#equals equal} or both
* <code>null</code>.
* <p>
- * This relation is
- * an equivalence relation on
- * the set of objects that adhere to the
+ * This relation is
+ * an equivalence relation on
+ * the set of objects that adhere to the
* <code>Object.equals</code> contract.
* </p>
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -41,7 +41,7 @@
// ------------------------------------------------------------------------
public IsEqual() {
}
-
+
// predicate interface
// ------------------------------------------------------------------------
@@ -52,21 +52,21 @@
public boolean equals(Object that) {
return that instanceof IsEqual;
}
-
+
public int hashCode() {
return "IsEqual".hashCode();
}
-
+
public String toString() {
return "IsEqual";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static IsEqual instance() {
return INSTANCE;
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final IsEqual INSTANCE = new IsEqual();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsInstanceOf.java Thu Apr 3 13:23:16 2008
@@ -21,11 +21,11 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * {@link #test Tests}
- * <code>true</code> iff its argument
- * {@link Class#isInstance is an instance}
+ * {@link #test Tests}
+ * <code>true</code> iff its argument
+ * {@link Class#isInstance is an instance}
* of some specified {@link Class Class}.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -36,7 +36,7 @@
public IsInstanceOf(Class klass) {
this.klass = klass;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
@@ -51,11 +51,11 @@
return false;
}
}
-
+
public boolean equals(IsInstanceOf that) {
return (null != that && (null == this.klass ? null == that.klass : this.klass.equals(that.klass)));
}
-
+
public int hashCode() {
int hash = "IsInstanceOf".hashCode();
if(null != klass) {
@@ -63,11 +63,11 @@
}
return hash;
}
-
+
public String toString() {
return "IsInstanceOf<" + klass + ">";
}
-
+
// attributes
// ------------------------------------------------------------------------
private Class klass;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotEqual.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotEqual.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotEqual.java Thu Apr 3 13:23:16 2008
@@ -21,12 +21,12 @@
import org.apache.commons.functor.BinaryPredicate;
/**
- * {@link #test Tests}
- * <code>true</code> iff its arguments are
- * not {@link Object#equals equal} or both
+ * {@link #test Tests}
+ * <code>true</code> iff its arguments are
+ * not {@link Object#equals equal} or both
* <code>null</code>.
* <p>
- * This relation is symmetric but irreflexive
+ * This relation is symmetric but irreflexive
* and not transitive.
* </p>
* @version $Revision$ $Date$
@@ -38,7 +38,7 @@
// ------------------------------------------------------------------------
public IsNotEqual() {
}
-
+
// predicate interface
// ------------------------------------------------------------------------
@@ -49,21 +49,21 @@
public boolean equals(Object that) {
return that instanceof IsNotEqual;
}
-
+
public int hashCode() {
return "IsNotEqual".hashCode();
}
-
+
public String toString() {
return "IsNotEqual";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static IsNotEqual instance() {
return INSTANCE;
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final IsNotEqual INSTANCE = new IsNotEqual();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotNull.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotNull.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotNull.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNotNull.java Thu Apr 3 13:23:16 2008
@@ -21,10 +21,10 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * {@link #test Tests}
- * <code>false</code> iff its argument
+ * {@link #test Tests}
+ * <code>false</code> iff its argument
* is <code>null</code>.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -34,7 +34,7 @@
// ------------------------------------------------------------------------
public IsNotNull() {
}
-
+
// predicate interface
// ------------------------------------------------------------------------
@@ -45,21 +45,21 @@
public boolean equals(Object that) {
return that instanceof IsNotNull;
}
-
+
public int hashCode() {
return "IsNotNull".hashCode();
}
-
+
public String toString() {
return "IsNotNull";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static IsNotNull instance() {
return INSTANCE;
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final IsNotNull INSTANCE = new IsNotNull();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/IsNull.java Thu Apr 3 13:23:16 2008
@@ -24,10 +24,10 @@
import org.apache.commons.functor.adapter.IgnoreRightPredicate;
/**
- * {@link #test Tests}
- * <code>true</code> iff its argument
+ * {@link #test Tests}
+ * <code>true</code> iff its argument
* is <code>null</code>.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -37,7 +37,7 @@
// ------------------------------------------------------------------------
public IsNull() {
}
-
+
// predicate interface
// ------------------------------------------------------------------------
@@ -48,21 +48,21 @@
public boolean equals(Object that) {
return that instanceof IsNull;
}
-
+
public int hashCode() {
return "IsNull".hashCode();
}
-
+
public String toString() {
return "IsNull";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static IsNull instance() {
return INSTANCE;
}
-
+
public static BinaryPredicate left() {
return LEFT;
}
@@ -70,7 +70,7 @@
public static BinaryPredicate right() {
return RIGHT;
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final IsNull INSTANCE = new IsNull();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/LeftIdentity.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/LeftIdentity.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/LeftIdentity.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/LeftIdentity.java Thu Apr 3 13:23:16 2008
@@ -23,23 +23,23 @@
/**
* {@link #evaluate Evaluates} to its first argument.
- *
+ *
* {@link #test Tests} to the <code>boolean</code>
* value of the <code>Boolean</code>-valued first
- * argument. The {@link #test test} method
- * throws an exception if the parameter isn't a
+ * argument. The {@link #test test} method
+ * throws an exception if the parameter isn't a
* non-<code>null</code> <code>Boolean</code>.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
public final class LeftIdentity implements BinaryPredicate, BinaryFunction, Serializable {
-
+
// constructor
// ------------------------------------------------------------------------
public LeftIdentity() {
}
-
+
// functor interface
// ------------------------------------------------------------------------
@@ -58,21 +58,21 @@
public boolean equals(Object that) {
return (that instanceof LeftIdentity);
}
-
+
public int hashCode() {
return "LeftIdentity".hashCode();
}
-
+
public String toString() {
return "LeftIdentity";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static LeftIdentity instance() {
return INSTANCE;
}
-
+
// static attributes
// ------------------------------------------------------------------------
private static final LeftIdentity INSTANCE = new LeftIdentity();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Limit.java Thu Apr 3 13:23:16 2008
@@ -22,7 +22,7 @@
/**
* A predicate that returns <code>true</code>
- * the first <i>n</i> times it is invoked.
+ * the first <i>n</i> times it is invoked.
*
* @since 1.0
* @version $Revision$ $Date$
@@ -33,7 +33,7 @@
public final class Limit implements Predicate, UnaryPredicate, BinaryPredicate {
public Limit(int count) {
- if(count < 0) {
+ if(count < 0) {
throw new IllegalArgumentException("Argument must be a non-negative integer.");
}
this.max = count;
@@ -50,11 +50,11 @@
}
public boolean test(Object obj) {
- return test();
+ return test();
}
public boolean test(Object a, Object b) {
- return test();
+ return test();
}
public String toString() {
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/NoOp.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/NoOp.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/NoOp.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/NoOp.java Thu Apr 3 13:23:16 2008
@@ -27,7 +27,7 @@
* <p>
* Note that this class implements {@link Procedure},
* {@link UnaryProcedure}, and {@link BinaryProcedure}.
- * </p>
+ * </p>
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -37,7 +37,7 @@
// ------------------------------------------------------------------------
public NoOp() {
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public void run() {
@@ -52,15 +52,15 @@
public boolean equals(Object that) {
return (that instanceof NoOp);
}
-
+
public int hashCode() {
return "NoOp".hashCode();
}
-
+
public String toString() {
return "NoOp";
}
-
+
// static methods
// ------------------------------------------------------------------------
public static NoOp instance() {
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Offset.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Offset.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Offset.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/Offset.java Thu Apr 3 13:23:16 2008
@@ -23,7 +23,7 @@
/**
* A predicate that returns <code>false</code>
* the first <i>n</i> times it is invoked, and
- * <code>true</code> thereafter.
+ * <code>true</code> thereafter.
*
* @since 1.0
* @version $Revision$ $Date$
@@ -34,7 +34,7 @@
public final class Offset implements Predicate, UnaryPredicate, BinaryPredicate {
public Offset(int count) {
- if(count < 0) {
+ if(count < 0) {
throw new IllegalArgumentException("Argument must be a non-negative integer.");
}
this.min = count;
@@ -51,11 +51,11 @@
}
public boolean test(Object obj) {
- return test();
+ return test();
}
public boolean test(Object a, Object b) {
- return test();
+ return test();
}
public String toString() {
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -23,23 +23,23 @@
/**
* {@link #evaluate Evaluates} to its second argument.
- *
+ *
* {@link #test Tests} to the <code>boolean</code>
* value of the <code>Boolean</code>-valued second
- * argument. The {@link #test test} method
- * throws an exception if the parameter isn't a
+ * argument. The {@link #test test} method
+ * throws an exception if the parameter isn't a
* non-<code>null</code> <code>Boolean</code>.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
public final class RightIdentity implements BinaryPredicate, BinaryFunction, Serializable {
-
+
// constructor
// ------------------------------------------------------------------------
public RightIdentity() {
}
-
+
// functor interface
// ------------------------------------------------------------------------
@@ -58,21 +58,21 @@
public boolean equals(Object that) {
return (that instanceof RightIdentity);
}
-
+
public int hashCode() {
return "RightIdentity".hashCode();
}
-
+
public String toString() {
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/FilteredIterator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterator.java Thu Apr 3 13:23:16 2008
@@ -29,7 +29,7 @@
// constructor
// ------------------------------------------------------------------------
-
+
public FilteredIterator(Iterator iterator, UnaryPredicate predicate) {
if(null == iterator || null == predicate) {
throw new NullPointerException();
@@ -38,10 +38,10 @@
this.iterator = iterator;
}
}
-
+
// iterator methods
// ------------------------------------------------------------------------
-
+
/**
* @see java.util.Iterator#hasNext()
*/
@@ -57,7 +57,7 @@
* @see java.util.Iterator#next()
*/
public Object next() {
- if(hasNext()) {
+ if(hasNext()) {
return returnNext();
} else {
throw new NoSuchElementException();
@@ -75,12 +75,12 @@
throw new IllegalStateException();
}
}
-
+
public boolean equals(Object obj) {
if(obj instanceof FilteredIterator) {
FilteredIterator that = (FilteredIterator)obj;
- return predicate.equals(that.predicate) && iterator.equals(that.iterator);
+ return predicate.equals(that.predicate) && iterator.equals(that.iterator);
} else {
return false;
}
@@ -98,17 +98,17 @@
public String toString() {
return "FilteredIterator<" + iterator + "," + predicate + ">";
}
-
+
// class methods
// ------------------------------------------------------------------------
-
+
public static Iterator filter(Iterator iter, UnaryPredicate pred) {
return null == pred ? iter : (null == iter ? null : new FilteredIterator(iter,pred));
}
-
+
// private
// ------------------------------------------------------------------------
-
+
private boolean setNext() {
while(iterator.hasNext()) {
canRemove = false;
@@ -123,7 +123,7 @@
nextSet = false;
return false;
}
-
+
private Object returnNext() {
Object temp = next;
canRemove = true;
@@ -131,15 +131,15 @@
nextSet = false;
return temp;
}
-
+
// attributes
// ------------------------------------------------------------------------
-
+
private UnaryPredicate predicate = null;
private Iterator iterator = null;
private Object next = null;
private boolean nextSet = false;
private boolean canRemove = false;
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java Thu Apr 3 13:23:16 2008
@@ -43,7 +43,7 @@
// instance methods
//---------------------------------------------------------------
-
+
public boolean test(Object obj, Object col) {
if(col instanceof Collection) {
return testCollection(obj,(Collection)col);
@@ -55,7 +55,7 @@
throw new IllegalArgumentException("Expected Collection or Array, found " + col.getClass());
}
}
-
+
public boolean equals(Object obj) {
return (obj instanceof IsElementOf);
}
@@ -74,7 +74,7 @@
private boolean testArray(Object obj, Object array) {
for(int i=0,m=Array.getLength(array);i<m;i++) {
- Object value = Array.get(array,i);
+ Object value = Array.get(array,i);
if(null == obj) {
if(null == value) {
return true;
@@ -89,11 +89,11 @@
// class methods
//---------------------------------------------------------------
-
+
public static IsElementOf instance() {
return INSTANCE;
}
-
+
public static UnaryPredicate instance(Object obj) {
if(null == obj) {
throw new NullPointerException("Argument must not be null");
@@ -105,10 +105,10 @@
throw new IllegalArgumentException("Expected Collection or Array, found " + obj.getClass());
}
}
-
+
// class variables
//---------------------------------------------------------------
-
+
private static IsElementOf INSTANCE = new IsElementOf();
}
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -31,12 +31,12 @@
// constructor
// ------------------------------------------------------------------------
-
+
public IsEmpty() { }
// instance methods
// ------------------------------------------------------------------------
-
+
public boolean test(Object obj) {
if(obj instanceof Collection) {
return testCollection((Collection)obj);
@@ -50,7 +50,7 @@
throw new NullPointerException("Argument must not be null");
} else {
throw new IllegalArgumentException("Expected Collection, Map, String or Array, found " + obj.getClass());
- }
+ }
}
/**
@@ -77,29 +77,29 @@
private boolean testCollection(Collection col) {
return col.isEmpty();
}
-
+
private boolean testMap(Map map) {
return map.isEmpty();
}
-
+
private boolean testString(String str) {
return 0 == str.length();
}
-
+
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/collection/Size.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/Size.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/Size.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/Size.java Thu Apr 3 13:23:16 2008
@@ -32,9 +32,9 @@
// constructor
// ------------------------------------------------------------------------
-
+
public Size() { }
-
+
public Object evaluate(Object obj) {
if(obj instanceof Collection) {
return evaluate((Collection)obj);
@@ -46,7 +46,7 @@
throw new NullPointerException("Argument must not be null");
} else {
throw new ClassCastException("Expected Collection, String or Array, found " + obj);
- }
+ }
}
/**
@@ -77,15 +77,15 @@
private Object evaluate(Collection col) {
return new Integer(col.size());
}
-
+
private Object evaluate(String str) {
return new Integer(str.length());
}
-
+
private Object evaluateArray(Object array) {
return new Integer(Array.getLength(array));
}
-
+
private static final Size INSTANCE = new Size();
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/TransformedIterator.java Thu Apr 3 13:23:16 2008
@@ -28,7 +28,7 @@
// constructor
// ------------------------------------------------------------------------
-
+
public TransformedIterator(Iterator iterator, UnaryFunction function) {
if(null == iterator || null == function) {
throw new NullPointerException();
@@ -37,10 +37,10 @@
this.iterator = iterator;
}
}
-
+
// iterator methods
// ------------------------------------------------------------------------
-
+
/**
* @see java.util.Iterator#hasNext()
*/
@@ -65,7 +65,7 @@
public boolean equals(Object obj) {
if(obj instanceof TransformedIterator) {
TransformedIterator that = (TransformedIterator)obj;
- return function.equals(that.function) && iterator.equals(that.iterator);
+ return function.equals(that.function) && iterator.equals(that.iterator);
} else {
return false;
}
@@ -83,20 +83,20 @@
public String toString() {
return "TransformedIterator<" + iterator + "," + function + ">";
}
-
+
// class methods
// ------------------------------------------------------------------------
-
+
public static Iterator transform(Iterator iter, UnaryFunction func) {
return null == func ? iter : (null == iter ? null : new TransformedIterator(iter,func));
}
-
-
+
+
// attributes
// ------------------------------------------------------------------------
-
+
private UnaryFunction function = null;
private Iterator iterator = null;
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java Thu Apr 3 13:23:16 2008
@@ -20,23 +20,23 @@
import java.util.Comparator;
/**
- * See Commons-Collections for a public version
+ * See Commons-Collections for a public version
* of this class.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
final class ComparableComparator implements Comparator, Serializable {
public ComparableComparator() {
}
-
+
/**
* @see java.util.Comparator#compare(Object, Object)
*/
public int compare(Object o1, Object o2) {
return ((Comparable)o1).compareTo(o2);
}
-
+
/**
* @see java.lang.Object#equals(Object)
*/
@@ -57,11 +57,11 @@
public String toString() {
return" ComparableComparator";
}
-
+
public static final ComparableComparator instance() {
return INSTANCE;
}
-
+
public static final ComparableComparator INSTANCE = new ComparableComparator();
}
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=644470&r1=644469&r2=644470&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 13:23:16 2008
@@ -24,7 +24,7 @@
/**
* Adapts a {@link Comparator Comparator} to the
* {@link BinaryFunction} interface.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -36,7 +36,7 @@
public ComparatorFunction(Comparator comparator) {
this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
-
+
/**
* @see org.apache.commons.functor.BinaryFunction#evaluate(Object, Object)
*/
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java Thu Apr 3 13:23:16 2008
@@ -29,12 +29,12 @@
* right argument under the specified {@link Comparator}.
* When no (or a <code>null</code> <code>Comparator</code> is specified,
* a {@link Comparable Comparable} <code>Comparator</code> is used.
- *
+ *
* @see org.apache.commons.functor.core.IsEqual
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
- *
+ *
*/
public final class IsEquivalent implements BinaryPredicate, Serializable {
/**
@@ -48,7 +48,7 @@
/**
* Construct an <code>IsEquivalent</code> {@link BinaryPredicate predicate}
* for the given {@link Comparator Comparator}.
- *
+ *
* @param comparator the {@link Comparator Comparator}, when <code>null</code>,
* a <code>Comparator</code> for {@link Comparable Comparable}s will
* be used.
@@ -56,9 +56,9 @@
public IsEquivalent(Comparator comparator) {
this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
-
+
/**
- * Return <code>true</code> iff the <i>left</i> parameter is
+ * Return <code>true</code> iff the <i>left</i> parameter is
* equal to the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -81,7 +81,7 @@
* @see #equals(Object)
*/
public boolean equals(IsEquivalent that) {
- return null != that &&
+ return null != that &&
null == comparator ? null == that.comparator : comparator.equals(that.comparator);
}
@@ -109,7 +109,7 @@
public static final UnaryPredicate instance(Comparable right) {
return RightBoundPredicate.bind(instance(),right);
}
-
+
private Comparator comparator = null;
private static final IsEquivalent COMPARABLE_INSTANCE = new IsEquivalent();
}