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 [3/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/core/comparator/IsGreaterThan.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java Thu Apr 3 13:23:16 2008
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -45,7 +45,7 @@
/**
* Construct a <code>IsGreaterThan</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.
@@ -53,9 +53,9 @@
public IsGreaterThan(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
* greater than the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -78,7 +78,7 @@
* @see #equals(Object)
*/
public boolean equals(IsGreaterThan that) {
- return null != that &&
+ return null != that &&
null == comparator ? null == that.comparator : comparator.equals(that.comparator);
}
@@ -102,11 +102,11 @@
public static final IsGreaterThan instance() {
return COMPARABLE_INSTANCE;
}
-
+
public static final UnaryPredicate instance(Comparable right) {
return RightBoundPredicate.bind(instance(),right);
}
-
+
private Comparator comparator = null;
private static final IsGreaterThan COMPARABLE_INSTANCE = new IsGreaterThan();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java Thu Apr 3 13:23:16 2008
@@ -29,7 +29,7 @@
* to the 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.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -45,7 +45,7 @@
/**
* Construct a <code>IsGreaterThanOrEqual</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.
@@ -53,9 +53,9 @@
public IsGreaterThanOrEqual(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
* greater than or equal to the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -78,7 +78,7 @@
* @see #equals(Object)
*/
public boolean equals(IsGreaterThanOrEqual that) {
- return null != that &&
+ return null != that &&
null == comparator ? null == that.comparator : comparator.equals(that.comparator);
}
@@ -102,7 +102,7 @@
public static final IsGreaterThanOrEqual instance() {
return COMPARABLE_INSTANCE;
}
-
+
public static final UnaryPredicate instance(Comparable right) {
return RightBoundPredicate.bind(instance(),right);
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java Thu Apr 3 13:23:16 2008
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -45,7 +45,7 @@
/**
* Construct a <code>IsLessThan</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.
@@ -53,9 +53,9 @@
public IsLessThan(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
* less than the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -78,7 +78,7 @@
* @see #equals(Object)
*/
public boolean equals(IsLessThan that) {
- return null != that &&
+ return null != that &&
null == comparator ? null == that.comparator : comparator.equals(that.comparator);
}
@@ -106,7 +106,7 @@
public static final UnaryPredicate instance(Comparable right) {
return RightBoundPredicate.bind(instance(),right);
}
-
+
private Comparator comparator = null;
private static final IsLessThan COMPARABLE_INSTANCE = new IsLessThan();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java Thu Apr 3 13:23:16 2008
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -45,7 +45,7 @@
/**
* Construct a <code>IsLessThanOrEqual</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.
@@ -53,9 +53,9 @@
public IsLessThanOrEqual(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
* less than or equal to the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -78,7 +78,7 @@
* @see #equals(Object)
*/
public boolean equals(IsLessThanOrEqual that) {
- return null != that &&
+ return null != that &&
null == comparator ? null == that.comparator : comparator.equals(that.comparator);
}
@@ -106,7 +106,7 @@
public static final UnaryPredicate instance(Comparable right) {
return RightBoundPredicate.bind(instance(),right);
}
-
+
private Comparator comparator = null;
private static final IsLessThanOrEqual COMPARABLE_INSTANCE = new IsLessThanOrEqual();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.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 IsNotEquivalent implements BinaryPredicate, Serializable {
/**
@@ -48,7 +48,7 @@
/**
* Construct a <code>IsNotEquivalent</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 IsNotEquivalent(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
* not equal to the <i>right</i> parameter under my current
* {@link Comparator Comparator}.
*/
@@ -81,7 +81,7 @@
* @see #equals(Object)
*/
public boolean equals(IsNotEquivalent 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 IsNotEquivalent COMPARABLE_INSTANCE = new IsNotEquivalent();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.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,12 +36,12 @@
public Max(Comparator comparator) {
this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
-
+
/**
* @see org.apache.commons.functor.BinaryFunction#evaluate(Object, Object)
*/
public Object evaluate(Object left, Object right) {
- return (comparator.compare(left,right) >= 0) ? left : right;
+ return (comparator.compare(left,right) >= 0) ? left : right;
}
/**
@@ -79,7 +79,7 @@
public static Max instance() {
return INSTANCE;
}
-
+
private Comparator comparator = null;
private static final Max INSTANCE = new Max();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.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,12 +36,12 @@
public Min(Comparator comparator) {
this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
-
+
/**
* @see org.apache.commons.functor.BinaryFunction#evaluate(Object, Object)
*/
public Object evaluate(Object left, Object right) {
- return (comparator.compare(left,right) <= 0) ? left : right;
+ return (comparator.compare(left,right) <= 0) ? left : right;
}
/**
@@ -79,7 +79,7 @@
public static Min instance() {
return INSTANCE;
}
-
+
private Comparator comparator = null;
private static final Min INSTANCE = new Min();
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/AbstractLoopProcedure.java Thu Apr 3 13:23:16 2008
@@ -37,10 +37,10 @@
}
public boolean equals(Object object) {
- if (object instanceof AbstractLoopProcedure) {
+ if (object instanceof AbstractLoopProcedure) {
AbstractLoopProcedure that = (AbstractLoopProcedure)object;
return (null == getCondition() ? null == that.getCondition() : getCondition().equals(that.getCondition())) &&
- (null == getAction() ? null == that.getAction() : getAction().equals(that.getAction()));
+ (null == getAction() ? null == that.getAction() : getAction().equals(that.getAction()));
} else {
return false;
}
@@ -49,7 +49,7 @@
public int hashCode() {
return hashCode("AbstractLoopProcedure".hashCode());
}
-
+
public String toString() {
return getClass().getName() + "<" + getCondition() + "," + getAction() + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/And.java Thu Apr 3 13:23:16 2008
@@ -26,11 +26,11 @@
* Note that by this definition, the "and" of
* an empty collection of predicates tests <code>true</code>.
* <p>
- * Note that although this class implements
+ * Note that although this class implements
* {@link java.io.Serializable Serializable}, a given instance will
* only be truly <code>Serializable</code> if all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -55,14 +55,14 @@
public And(Predicate p, Predicate q, Predicate r) {
super(p,q,r);
}
-
+
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public And and(Predicate p) {
super.addPredicate(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test() {
@@ -81,17 +81,17 @@
return false;
}
}
-
+
public boolean equals(And that) {
return getPredicateListEquals(that);
}
-
+
public int hashCode() {
return "And".hashCode() ^ getPredicateListHashCode();
}
-
+
public String toString() {
return "And<" + getPredicateListToString() + ">";
}
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseBinaryPredicateList.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseBinaryPredicateList.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseBinaryPredicateList.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseBinaryPredicateList.java Thu Apr 3 13:23:16 2008
@@ -27,11 +27,11 @@
* Abstract base class for {@link BinaryPredicate BinaryPredicates}
* composed of a list of {@link BinaryPredicate BinaryPredicates}.
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -58,39 +58,39 @@
addBinaryPredicate(q);
addBinaryPredicate(r);
}
-
+
// abstract
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public abstract boolean equals(Object that);
public abstract int hashCode();
public abstract String toString();
public abstract boolean test(Object left, Object right);
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
protected void addBinaryPredicate(BinaryPredicate p) {
list.add(p);
}
-
+
// protected
// ------------------------------------------------------------------------
protected Iterator getBinaryPredicateIterator() {
return list.iterator();
}
-
+
protected boolean getBinaryPredicateListEquals(BaseBinaryPredicateList that) {
return (null != that && this.list.equals(that.list));
}
-
+
protected int getBinaryPredicateListHashCode() {
return list.hashCode();
}
-
+
protected String getBinaryPredicateListToString() {
return String.valueOf(list);
}
-
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BasePredicateList.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BasePredicateList.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BasePredicateList.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BasePredicateList.java Thu Apr 3 13:23:16 2008
@@ -27,11 +27,11 @@
* Abstract base class for {@link Predicate Predicates}
* composed of a list of {@link Predicate Predicates}.
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -58,39 +58,39 @@
addPredicate(q);
addPredicate(r);
}
-
+
// abstract
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public abstract boolean equals(Object that);
public abstract int hashCode();
public abstract String toString();
public abstract boolean test();
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
protected void addPredicate(Predicate p) {
list.add(p);
}
-
+
// protected
// ------------------------------------------------------------------------
protected Iterator getPredicateIterator() {
return list.iterator();
}
-
+
protected boolean getPredicateListEquals(BasePredicateList that) {
return (null != that && this.list.equals(that.list));
}
-
+
protected int getPredicateListHashCode() {
return list.hashCode();
}
-
+
protected String getPredicateListToString() {
return String.valueOf(list);
}
-
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BaseUnaryPredicateList.java Thu Apr 3 13:23:16 2008
@@ -27,11 +27,11 @@
* Abstract base class for {@link UnaryPredicate UnaryPredicates}
* composed of a list of {@link UnaryPredicate UnaryPredicates}.
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -58,39 +58,39 @@
addUnaryPredicate(q);
addUnaryPredicate(r);
}
-
+
// abstract
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public abstract boolean equals(Object that);
public abstract int hashCode();
public abstract String toString();
public abstract boolean test(Object obj);
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
protected void addUnaryPredicate(UnaryPredicate p) {
list.add(p);
}
-
+
// protected
// ------------------------------------------------------------------------
protected Iterator getUnaryPredicateIterator() {
return list.iterator();
}
-
+
protected boolean getUnaryPredicateListEquals(BaseUnaryPredicateList that) {
return (null != that && this.list.equals(that.list));
}
-
+
protected int getUnaryPredicateListHashCode() {
return list.hashCode();
}
-
+
protected String getUnaryPredicateListToString() {
return String.valueOf(list);
}
-
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryAnd.java Thu Apr 3 13:23:16 2008
@@ -26,11 +26,11 @@
* Note that by this definition, the "and" of
* an empty collection of predicates tests <code>true</code>.
* <p>
- * Note that although this class implements
+ * Note that although this class implements
* {@link java.io.Serializable Serializable}, a given instance will
* only be truly <code>Serializable</code> if all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -55,14 +55,14 @@
public BinaryAnd(BinaryPredicate p, BinaryPredicate q, BinaryPredicate r) {
super(p,q,r);
}
-
+
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public BinaryAnd and(BinaryPredicate p) {
super.addBinaryPredicate(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object a, Object b) {
@@ -81,17 +81,17 @@
return false;
}
}
-
+
public boolean equals(BinaryAnd that) {
return getBinaryPredicateListEquals(that);
}
-
+
public int hashCode() {
return "BinaryAnd".hashCode() ^ getBinaryPredicateListHashCode();
}
-
+
public String toString() {
return "BinaryAnd<" + getBinaryPredicateListToString() + ">";
}
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryCompositeBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryCompositeBinaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryCompositeBinaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryCompositeBinaryFunction.java Thu Apr 3 13:23:16 2008
@@ -23,14 +23,14 @@
/**
* A {@link BinaryFunction BinaryFunction} composed of
* three binary functions, <i>f</i>, <i>g</i> and <i>h</i>,
- * evaluating the ordered parameters <i>x</i>, <i>y</i>
+ * evaluating the ordered parameters <i>x</i>, <i>y</i>
* to <code><i>f</i>(<i>g</i>(<i>x</i>,<i>y</i>),<i>h</i>(<i>x</i>,<i>y</i>))</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -43,7 +43,7 @@
public BinaryCompositeBinaryFunction(BinaryFunction f, BinaryFunction g, BinaryFunction h) {
binary = f;
leftBinary = g;
- rightBinary = h;
+ rightBinary = h;
}
// function interface
@@ -59,35 +59,35 @@
return false;
}
}
-
+
public boolean equals(BinaryCompositeBinaryFunction that) {
return (null != that) &&
(null == binary ? null == that.binary : binary.equals(that.binary)) &&
(null == leftBinary ? null == that.leftBinary : leftBinary.equals(that.leftBinary)) &&
(null == rightBinary ? null == that.rightBinary : rightBinary.equals(that.rightBinary));
}
-
+
public int hashCode() {
int hash = "BinaryCompositeBinaryFunction".hashCode();
if(null != binary) {
hash <<= 4;
- hash ^= binary.hashCode();
+ hash ^= binary.hashCode();
}
if(null != leftBinary) {
hash <<= 4;
- hash ^= leftBinary.hashCode();
+ hash ^= leftBinary.hashCode();
}
if(null != rightBinary) {
hash <<= 4;
- hash ^= rightBinary.hashCode();
+ hash ^= rightBinary.hashCode();
}
return hash;
}
-
+
public String toString() {
return "BinaryCompositeBinaryFunction<" + binary + ";" + leftBinary + ";" + rightBinary + ">";
}
-
+
// attributes
// ------------------------------------------------------------------------
private BinaryFunction binary = null;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryNot.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryNot.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryNot.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryNot.java Thu Apr 3 13:23:16 2008
@@ -24,11 +24,11 @@
* {@link #test Tests} to the logical inverse
* of some other predicate.
* <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.
* </p>
* @version $Revision$ $Date$
@@ -42,7 +42,7 @@
public BinaryNot(BinaryPredicate p) {
this.predicate = p;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object left, Object right) {
@@ -56,11 +56,11 @@
return false;
}
}
-
+
public boolean equals(BinaryNot that) {
return null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate));
}
-
+
public int hashCode() {
int hash = "BinaryNot".hashCode();
if(null != predicate) {
@@ -68,7 +68,7 @@
}
return hash;
}
-
+
public String toString() {
return "BinaryNot<" + predicate + ">";
}
@@ -78,7 +78,7 @@
public static BinaryPredicate not(BinaryPredicate that) {
return null == that ? null : new BinaryNot(that);
}
-
+
// attributes
// ------------------------------------------------------------------------
private BinaryPredicate predicate = null;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinaryOr.java Thu Apr 3 13:23:16 2008
@@ -26,11 +26,11 @@
* Note that by this definition, the "or" of
* an empty collection of predicates tests <code>false</code>.
* <p>
- * Note that although this class implements
+ * Note that although this class implements
* {@link java.io.Serializable Serializable}, a given instance will
* only be truly <code>Serializable</code> if all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -55,14 +55,14 @@
public BinaryOr(BinaryPredicate p, BinaryPredicate q, BinaryPredicate r) {
super(p,q,r);
}
-
+
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public BinaryOr or(BinaryPredicate p) {
super.addBinaryPredicate(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object a, Object b) {
@@ -81,17 +81,17 @@
return false;
}
}
-
+
public boolean equals(BinaryOr that) {
return getBinaryPredicateListEquals(that);
}
-
+
public int hashCode() {
return "BinaryOr".hashCode() ^ getBinaryPredicateListHashCode();
}
-
+
public String toString() {
return "BinaryOr<" + getBinaryPredicateListToString() + ">";
}
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/BinarySequence.java Thu Apr 3 13:23:16 2008
@@ -24,20 +24,20 @@
import org.apache.commons.functor.BinaryProcedure;
/**
- * A {@link BinaryProcedure BinaryProcedure}
- * that {@link BinaryProcedure#run runs} an ordered
+ * A {@link BinaryProcedure BinaryProcedure}
+ * that {@link BinaryProcedure#run runs} an ordered
* sequence of {@link BinaryProcedure BinaryProcedures}.
* When the sequence is empty, this procedure is does
* nothing.
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
- *
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -58,15 +58,15 @@
}
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public BinarySequence then(BinaryProcedure p) {
list.add(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
- public void run(Object left, Object right) {
+ public void run(Object left, Object right) {
for(ListIterator iter = list.listIterator(list.size()); iter.hasPrevious();) {
((BinaryProcedure)iter.previous()).run(left,right);
}
@@ -79,22 +79,22 @@
return false;
}
}
-
+
public boolean equals(BinarySequence that) {
// by construction, list is never null
return null != that && list.equals(that.list);
}
-
+
public int hashCode() {
// by construction, list is never null
return "BinarySequence".hashCode() ^ list.hashCode();
}
-
+
public String toString() {
return "BinarySequence<" + list + ">";
}
-
-
+
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Composite.java Thu Apr 3 13:23:16 2008
@@ -32,18 +32,18 @@
// constructor - for beanish apis
// ------------------------------------------------------------------------
public Composite() { }
-
+
// ------------------------------------------------------------------------
- public static final CompositeUnaryProcedure procedure(UnaryProcedure p, UnaryFunction f) {
+ public static final CompositeUnaryProcedure procedure(UnaryProcedure p, UnaryFunction f) {
return new CompositeUnaryProcedure(p,f);
}
- public static final CompositeUnaryPredicate predicate(UnaryPredicate p, UnaryFunction f) {
+ public static final CompositeUnaryPredicate predicate(UnaryPredicate p, UnaryFunction f) {
return new CompositeUnaryPredicate(p,f);
}
- public static final BinaryPredicate predicate(BinaryPredicate p, UnaryFunction f, UnaryFunction g) {
+ public static final BinaryPredicate predicate(BinaryPredicate p, UnaryFunction f, UnaryFunction g) {
return new UnaryCompositeBinaryPredicate(p,f,g);
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryFunction.java Thu Apr 3 13:23:16 2008
@@ -24,27 +24,27 @@
import org.apache.commons.functor.UnaryFunction;
/**
- * A {@link UnaryFunction UnaryFunction}
- * representing the composition of
+ * A {@link UnaryFunction UnaryFunction}
+ * representing the composition of
* {@link UnaryFunction UnaryFunctions},
* "chaining" the output of one to the input
- * of another. For example,
+ * of another. For example,
* <pre>new CompositeUnaryFunction(f).of(g)</code>
- * {@link #evaluate evaluates} to
+ * {@link #evaluate evaluates} to
* <code>f.evaluate(g.evaluate(obj))</code>, and
* <pre>new CompositeUnaryFunction(f).of(g).of(h)</pre>
- * {@link #evaluate evaluates} to
+ * {@link #evaluate evaluates} to
* <code>f.evaluate(g.evaluate(h.evaluate(obj)))</code>.
* <p>
- * When the collection is empty, this function is
+ * When the collection is empty, this function is
* an identity function.
* </p>
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -67,15 +67,15 @@
}
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public CompositeUnaryFunction of(UnaryFunction f) {
list.add(f);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
- public Object evaluate(Object obj) {
+ public Object evaluate(Object obj) {
Object result = obj;
for(ListIterator iter = list.listIterator(list.size()); iter.hasPrevious();) {
result = ((UnaryFunction)iter.previous()).evaluate(result);
@@ -90,22 +90,22 @@
return false;
}
}
-
+
public boolean equals(CompositeUnaryFunction that) {
// by construction, list is never null
return null != that && list.equals(that.list);
}
-
+
public int hashCode() {
// by construction, list is never null
return "CompositeUnaryFunction".hashCode() ^ list.hashCode();
}
-
+
public String toString() {
return "CompositeUnaryFunction<" + list + ">";
}
-
-
+
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java Thu Apr 3 13:23:16 2008
@@ -22,23 +22,23 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * A {@link UnaryPredicate UnaryPredicate}
- * representing the composition of
+ * A {@link UnaryPredicate UnaryPredicate}
+ * representing the composition of
* {@link UnaryFunction UnaryFunctions},
* "chaining" the output of one to the input
- * of another. For example,
+ * of another. For example,
* <pre>new CompositeUnaryPredicate(p).of(f)</code>
- * {@link #test tests} to
+ * {@link #test tests} to
* <code>p.test(f.evaluate(obj))</code>, and
* <pre>new CompositeUnaryPredicate(p).of(f).of(g)</pre>
- * {@link #test tests} to
+ * {@link #test tests} to
* <code>p.test(f.evaluate(g.evaluate(obj)))</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -62,16 +62,16 @@
}
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public CompositeUnaryPredicate of(UnaryFunction f) {
function.of(f);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object obj) {
- return predicate.test(function.evaluate(obj));
+ return predicate.test(function.evaluate(obj));
}
public boolean equals(Object that) {
@@ -81,11 +81,11 @@
return false;
}
}
-
+
public boolean equals(CompositeUnaryPredicate that) {
return null != that && predicate.equals(that.predicate) && function.equals(that.function);
}
-
+
public int hashCode() {
int hash = "CompositeUnaryPredicate".hashCode();
hash <<= 2;
@@ -94,11 +94,11 @@
hash ^= function.hashCode();
return hash;
}
-
+
public String toString() {
return "CompositeUnaryFunction<" + predicate + ";" + function + ">";
}
-
+
// attributes
// ------------------------------------------------------------------------
private CompositeUnaryFunction function = null;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java Thu Apr 3 13:23:16 2008
@@ -22,23 +22,23 @@
import org.apache.commons.functor.UnaryProcedure;
/**
- * A {@link UnaryProcedure UnaryProcedure}
- * representing the composition of
+ * A {@link UnaryProcedure UnaryProcedure}
+ * representing the composition of
* {@link UnaryFunction UnaryFunctions},
* "chaining" the output of one to the input
- * of another. For example,
+ * of another. For example,
* <pre>new CompositeUnaryProcedure(p).of(f)</code>
- * {@link #run runs} to
+ * {@link #run runs} to
* <code>p.run(f.evaluate(obj))</code>, and
* <pre>new CompositeUnaryProcedure(p).of(f).of(g)</pre>
- * {@link #run runs}
+ * {@link #run runs}
* <code>p.run(f.evaluate(g.evaluate(obj)))</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -62,16 +62,16 @@
}
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public CompositeUnaryProcedure of(UnaryFunction f) {
function.of(f);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public void run(Object obj) {
- procedure.run(function.evaluate(obj));
+ procedure.run(function.evaluate(obj));
}
public boolean equals(Object that) {
@@ -81,11 +81,11 @@
return false;
}
}
-
+
public boolean equals(CompositeUnaryProcedure that) {
return null != that && procedure.equals(that.procedure) && function.equals(that.function);
}
-
+
public int hashCode() {
int hash = "CompositeUnaryProcedure".hashCode();
hash <<= 2;
@@ -94,11 +94,11 @@
hash ^= function.hashCode();
return hash;
}
-
+
public String toString() {
return "CompositeUnaryProcedure<" + procedure + ";" + function + ">";
}
-
+
// attributes
// ------------------------------------------------------------------------
private CompositeUnaryFunction function = null;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Conditional.java Thu Apr 3 13:23:16 2008
@@ -33,30 +33,30 @@
// constructor - for beanish apis
// ------------------------------------------------------------------------
public Conditional() { }
-
+
// ------------------------------------------------------------------------
- public static final UnaryProcedure procedure(UnaryPredicate q, UnaryProcedure r, UnaryProcedure s) {
+ public static final UnaryProcedure procedure(UnaryPredicate q, UnaryProcedure r, UnaryProcedure s) {
return new ConditionalUnaryProcedure(q,r,s);
}
- public static final UnaryFunction function(UnaryPredicate q, UnaryFunction r, UnaryFunction s) {
+ public static final UnaryFunction function(UnaryPredicate q, UnaryFunction r, UnaryFunction s) {
return new ConditionalUnaryFunction(q,r,s);
}
- public static final UnaryPredicate predicate(UnaryPredicate q, UnaryPredicate r, UnaryPredicate s) {
+ public static final UnaryPredicate predicate(UnaryPredicate q, UnaryPredicate r, UnaryPredicate s) {
return new ConditionalUnaryPredicate(q,r,s);
}
- public static final BinaryProcedure procedure(BinaryPredicate q, BinaryProcedure r, BinaryProcedure s) {
+ public static final BinaryProcedure procedure(BinaryPredicate q, BinaryProcedure r, BinaryProcedure s) {
return new ConditionalBinaryProcedure(q,r,s);
}
- public static final BinaryFunction function(BinaryPredicate q, BinaryFunction r, BinaryFunction s) {
+ public static final BinaryFunction function(BinaryPredicate q, BinaryFunction r, BinaryFunction s) {
return new ConditionalBinaryFunction(q,r,s);
}
- public static final BinaryPredicate predicate(BinaryPredicate q, BinaryPredicate r, BinaryPredicate s) {
+ public static final BinaryPredicate predicate(BinaryPredicate q, BinaryPredicate r, BinaryPredicate s) {
return new ConditionalBinaryPredicate(q,r,s);
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryFunction.java Thu Apr 3 13:23:16 2008
@@ -22,20 +22,20 @@
import org.apache.commons.functor.BinaryPredicate;
/**
- * A {@link BinaryFunction BinaryFunction}
- * similiar to Java's "ternary"
+ * A {@link BinaryFunction BinaryFunction}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link BinaryPredicate predicate}
* <i>p</i> and {@link BinaryFunction functions}
* <i>f</i> and <i>g</i>, {@link #evaluate evalautes}
- * to
+ * to
* <code>p.test(x,y) ? f.evaluate(x,y) : g.evaluate(x,y)</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -51,7 +51,7 @@
this.thenFunc = thenPred;
this.elseFunc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public Object evaluate(Object left, Object right) {
@@ -65,31 +65,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalBinaryFunction that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
(null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
}
-
+
public int hashCode() {
int hash = "ConditionalBinaryFunction".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenFunc) {
hash <<= 4;
- hash ^= thenFunc.hashCode();
+ hash ^= thenFunc.hashCode();
}
if(null != elseFunc) {
hash <<= 4;
- hash ^= elseFunc.hashCode();
+ hash ^= elseFunc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalBinaryFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryPredicate.java Thu Apr 3 13:23:16 2008
@@ -21,20 +21,20 @@
import org.apache.commons.functor.BinaryPredicate;
/**
- * A {@link BinaryPredicate BinaryPredicate}
- * similiar to Java's "ternary"
+ * A {@link BinaryPredicate BinaryPredicate}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given three {@link BinaryPredicate predicates}
* <i>p</i>, <i>q</i>, <i>r</i>,
* {@link #test tests}
- * to
+ * to
* <code>p.test(x,y) ? q.test(x,y) : r.test(x,y)</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenPred = thenPred;
this.elsePred = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object left, Object right) {
@@ -64,31 +64,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalBinaryPredicate that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenPred ? null == that.thenPred : thenPred.equals(that.thenPred)) &&
(null == elsePred ? null == that.elsePred : elsePred.equals(that.elsePred));
}
-
+
public int hashCode() {
int hash = "ConditionalBinaryPredicate".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenPred) {
hash <<= 4;
- hash ^= thenPred.hashCode();
+ hash ^= thenPred.hashCode();
}
if(null != elsePred) {
hash <<= 4;
- hash ^= elsePred.hashCode();
+ hash ^= elsePred.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalBinaryPredicate<" + ifPred + "?" + thenPred + ":" + elsePred + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalBinaryProcedure.java Thu Apr 3 13:23:16 2008
@@ -22,19 +22,19 @@
import org.apache.commons.functor.BinaryProcedure;
/**
- * A {@link BinaryProcedure BinaryProcedure}
- * similiar to Java's "ternary"
+ * A {@link BinaryProcedure BinaryProcedure}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link BinaryPredicate predicate}
* <i>p</i> and {@link BinaryProcedure procedures}
* <i>q</i> and <i>r</i>, {@link #run runs}
* <code>if(p.test(x,y)) { q.run(x,y); } else { r.run(x,y); }</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenProc = thenPred;
this.elseProc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public void run(Object left, Object right) {
@@ -68,31 +68,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalBinaryProcedure that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc)) &&
(null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc));
}
-
+
public int hashCode() {
int hash = "ConditionalBinaryProcedure".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenProc) {
hash <<= 4;
- hash ^= thenProc.hashCode();
+ hash ^= thenProc.hashCode();
}
if(null != elseProc) {
hash <<= 4;
- hash ^= elseProc.hashCode();
+ hash ^= elseProc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalBinaryProcedure<" + ifPred + "?" + thenProc + ":" + elseProc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalFunction.java Thu Apr 3 13:23:16 2008
@@ -22,20 +22,20 @@
import org.apache.commons.functor.Predicate;
/**
- * A {@link Function Function}
- * similiar to Java's "ternary"
+ * A {@link Function Function}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link Predicate predicate}
* <i>p</i> and {@link Function functions}
* <i>f</i> and <i>g</i>, {@link #evaluate evalautes}
- * to
+ * to
* <code>p.test() ? f.evaluate() : g.evaluate()</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -51,7 +51,7 @@
this.thenFunc = thenPred;
this.elseFunc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public Object evaluate() {
@@ -65,31 +65,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalFunction that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
(null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
}
-
+
public int hashCode() {
int hash = "ConditionalFunction".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenFunc) {
hash <<= 4;
- hash ^= thenFunc.hashCode();
+ hash ^= thenFunc.hashCode();
}
if(null != elseFunc) {
hash <<= 4;
- hash ^= elseFunc.hashCode();
+ hash ^= elseFunc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalPredicate.java Thu Apr 3 13:23:16 2008
@@ -21,20 +21,20 @@
import org.apache.commons.functor.Predicate;
/**
- * A {@link Predicate Predicate}
- * similiar to Java's "ternary"
+ * A {@link Predicate Predicate}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given three {@link Predicate predicates}
* <i>p</i>, <i>q</i>, <i>r</i>,
* {@link #test tests}
- * to
+ * to
* <code>p.test() ? q.test() : r.test()</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenPred = thenPred;
this.elsePred = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test() {
@@ -64,31 +64,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalPredicate that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenPred ? null == that.thenPred : thenPred.equals(that.thenPred)) &&
(null == elsePred ? null == that.elsePred : elsePred.equals(that.elsePred));
}
-
+
public int hashCode() {
int hash = "ConditionalPredicate".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenPred) {
hash <<= 4;
- hash ^= thenPred.hashCode();
+ hash ^= thenPred.hashCode();
}
if(null != elsePred) {
hash <<= 4;
- hash ^= elsePred.hashCode();
+ hash ^= elsePred.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalPredicate<" + ifPred + "?" + thenPred + ":" + elsePred + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalProcedure.java Thu Apr 3 13:23:16 2008
@@ -22,19 +22,19 @@
import org.apache.commons.functor.Procedure;
/**
- * A {@link Procedure Procedure}
- * similiar to Java's "ternary"
+ * A {@link Procedure Procedure}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link Predicate predicate}
* <i>p</i> and {@link Procedure procedures}
* <i>q</i> and <i>r</i>, {@link #run runs}
* <code>if(p.test()) { q.run(); } else { r.run(); }</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenProc = thenPred;
this.elseProc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public void run() {
@@ -68,31 +68,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalProcedure that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc)) &&
(null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc));
}
-
+
public int hashCode() {
int hash = "ConditionalProcedure".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenProc) {
hash <<= 4;
- hash ^= thenProc.hashCode();
+ hash ^= thenProc.hashCode();
}
if(null != elseProc) {
hash <<= 4;
- hash ^= elseProc.hashCode();
+ hash ^= elseProc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalProcedure<" + ifPred + "?" + thenProc + ":" + elseProc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryFunction.java Thu Apr 3 13:23:16 2008
@@ -22,20 +22,20 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * A {@link UnaryFunction UnaryFunction}
- * similiar to Java's "ternary"
+ * A {@link UnaryFunction UnaryFunction}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link UnaryPredicate predicate}
* <i>p</i> and {@link UnaryFunction functions}
* <i>f</i> and <i>g</i>, {@link #evaluate evalautes}
- * to
+ * to
* <code>p.test(x) ? f.evaluate(x) : g.evaluate(x)</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -51,7 +51,7 @@
this.thenFunc = thenPred;
this.elseFunc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public Object evaluate(Object obj) {
@@ -65,31 +65,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalUnaryFunction that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenFunc ? null == that.thenFunc : thenFunc.equals(that.thenFunc)) &&
(null == elseFunc ? null == that.elseFunc : elseFunc.equals(that.elseFunc));
}
-
+
public int hashCode() {
int hash = "ConditionalUnaryFunction".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenFunc) {
hash <<= 4;
- hash ^= thenFunc.hashCode();
+ hash ^= thenFunc.hashCode();
}
if(null != elseFunc) {
hash <<= 4;
- hash ^= elseFunc.hashCode();
+ hash ^= elseFunc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalUnaryFunction<" + ifPred + "?" + thenFunc + ":" + elseFunc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java Thu Apr 3 13:23:16 2008
@@ -21,20 +21,20 @@
import org.apache.commons.functor.UnaryPredicate;
/**
- * A {@link UnaryPredicate UnaryPredicate}
- * similiar to Java's "ternary"
+ * A {@link UnaryPredicate UnaryPredicate}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given three {@link UnaryPredicate predicate}
* <i>p</i>, <i>q</i>, <i>r</i>,
* {@link #test tests}
- * to
+ * to
* <code>p.test(x) ? q.test(x) : r.test(x)</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenPred = thenPred;
this.elsePred = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test(Object obj) {
@@ -64,31 +64,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalUnaryPredicate that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenPred ? null == that.thenPred : thenPred.equals(that.thenPred)) &&
(null == elsePred ? null == that.elsePred : elsePred.equals(that.elsePred));
}
-
+
public int hashCode() {
int hash = "ConditionalUnaryPredicate".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenPred) {
hash <<= 4;
- hash ^= thenPred.hashCode();
+ hash ^= thenPred.hashCode();
}
if(null != elsePred) {
hash <<= 4;
- hash ^= elsePred.hashCode();
+ hash ^= elsePred.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalUnaryPredicate<" + ifPred + "?" + thenPred + ":" + elsePred + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryProcedure.java Thu Apr 3 13:23:16 2008
@@ -22,19 +22,19 @@
import org.apache.commons.functor.UnaryProcedure;
/**
- * A {@link UnaryProcedure UnaryProcedure}
- * similiar to Java's "ternary"
+ * A {@link UnaryProcedure UnaryProcedure}
+ * similiar to Java's "ternary"
* or "conditional" operator (<code>? :</code>).
* Given a {@link UnaryPredicate predicate}
* <i>p</i> and {@link UnaryProcedure procedures}
* <i>q</i> and <i>r</i>, {@link #run runs}
* <code>if(p.test(x)) { q.run(x); } else { r.run(x); }</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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -50,7 +50,7 @@
this.thenProc = thenPred;
this.elseProc = elsePred;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public void run(Object obj) {
@@ -68,31 +68,31 @@
return false;
}
}
-
+
public boolean equals(ConditionalUnaryProcedure that) {
- return null != that &&
+ return null != that &&
(null == ifPred ? null == that.ifPred : ifPred.equals(that.ifPred)) &&
(null == thenProc ? null == that.thenProc : thenProc.equals(that.thenProc)) &&
(null == elseProc ? null == that.elseProc : elseProc.equals(that.elseProc));
}
-
+
public int hashCode() {
int hash = "ConditionalUnaryProcedure".hashCode();
if(null != ifPred) {
hash <<= 4;
- hash ^= ifPred.hashCode();
+ hash ^= ifPred.hashCode();
}
if(null != thenProc) {
hash <<= 4;
- hash ^= thenProc.hashCode();
+ hash ^= thenProc.hashCode();
}
if(null != elseProc) {
hash <<= 4;
- hash ^= elseProc.hashCode();
+ hash ^= elseProc.hashCode();
}
return hash;
}
-
+
public String toString() {
return "ConditionalUnaryProcedure<" + ifPred + "?" + thenProc + ":" + elseProc + ">";
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java Thu Apr 3 13:23:16 2008
@@ -21,15 +21,15 @@
/**
- * A {@link Procedure} implementation of a while loop. Given a {@link Predicate}
+ * A {@link Procedure} implementation of a while loop. Given a {@link Predicate}
* <i>c</i> and an {@link Procedure} <i>p</i>, {@link #run runs}
* <code>do { p.run(); } while(c.test())</code>.
* <p>
- * Note that although this class implements
+ * Note that although this class implements
* {@link java.io.Serializable}, a given instance will
* only be truly <code>Serializable</code> if all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Not.java Thu Apr 3 13:23:16 2008
@@ -24,11 +24,11 @@
* {@link #test Tests} to the logical inverse
* of some other predicate.
* <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.
* </p>
* @version $Revision$ $Date$
@@ -42,7 +42,7 @@
public Not(Predicate p) {
this.predicate = p;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test() {
@@ -56,11 +56,11 @@
return false;
}
}
-
+
public boolean equals(Not that) {
return null != that && (null == predicate ? null == that.predicate : predicate.equals(that.predicate));
}
-
+
public int hashCode() {
int hash = "Not".hashCode();
if(null != predicate) {
@@ -68,7 +68,7 @@
}
return hash;
}
-
+
public String toString() {
return "Not<" + predicate + ">";
}
@@ -78,7 +78,7 @@
public static Predicate not(Predicate that) {
return null == that ? null : new Not(that);
}
-
+
// attributes
// ------------------------------------------------------------------------
private Predicate predicate = null;
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Or.java Thu Apr 3 13:23:16 2008
@@ -26,11 +26,11 @@
* Note that by this definition, the "or" of
* an empty collection of predicates tests <code>false</code>.
* <p>
- * Note that although this class implements
+ * Note that although this class implements
* {@link java.io.Serializable Serializable}, a given instance will
* only be truly <code>Serializable</code> if all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -55,14 +55,14 @@
public Or(Predicate p, Predicate q, Predicate r) {
super(p,q,r);
}
-
+
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public Or or(Predicate p) {
super.addPredicate(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
public boolean test() {
@@ -81,17 +81,17 @@
return false;
}
}
-
+
public boolean equals(Or that) {
return getPredicateListEquals(that);
}
-
+
public int hashCode() {
return "Or".hashCode() ^ getPredicateListHashCode();
}
-
+
public String toString() {
return "Or<" + getPredicateListToString() + ">";
}
-
+
}
Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java?rev=644470&r1=644469&r2=644470&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/Sequence.java Thu Apr 3 13:23:16 2008
@@ -24,17 +24,17 @@
import org.apache.commons.functor.Procedure;
/**
- * A {@link Procedure Procedure}
- * that {@link Procedure#run runs} an ordered
+ * A {@link Procedure Procedure}
+ * that {@link Procedure#run runs} an ordered
* sequence of {@link Procedure Procedures}.
* When the sequence is empty, this procedure is does
* nothing.
* <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 all the
* underlying functors are. Attempts to serialize
- * an instance whose delegates are not all
+ * an instance whose delegates are not all
* <code>Serializable</code> will result in an exception.
* </p>
* @version $Revision$ $Date$
@@ -57,15 +57,15 @@
}
// modifiers
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
public Sequence then(Procedure p) {
list.add(p);
return this;
}
-
+
// predicate interface
// ------------------------------------------------------------------------
- public void run() {
+ public void run() {
for(ListIterator iter = list.listIterator(list.size()); iter.hasPrevious();) {
((Procedure)iter.previous()).run();
}
@@ -78,22 +78,22 @@
return false;
}
}
-
+
public boolean equals(Sequence that) {
// by construction, list is never null
return null != that && list.equals(that.list);
}
-
+
public int hashCode() {
// by construction, list is never null
return "Sequence".hashCode() ^ list.hashCode();
}
-
+
public String toString() {
return "Sequence<" + list + ">";
}
-
-
+
+
// attributes
// ------------------------------------------------------------------------
private List list = new ArrayList();