You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/11/24 21:12:18 UTC
cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java
rwaldhoff 2003/11/24 12:12:17
Modified: functor/src/test/org/apache/commons/functor/core/composite
TestTransposedProcedure.java
functor/src/test/org/apache/commons/functor/core
TestIsNotEqual.java TestRightIdentityFunction.java
TestLeftIdentityPredicate.java
TestIdentityFunction.java TestIsNotNull.java
TestRightIdentityPredicate.java TestNoOp.java
TestIsEqual.java TestLeftIdentityFunction.java
TestIdentityPredicate.java TestIsNull.java
functor/src/java/org/apache/commons/functor/core
IsNotNull.java RightIdentityFunction.java
RightIdentityPredicate.java IsNotEqual.java
LeftIdentityPredicate.java IsEqual.java
IdentityPredicate.java IdentityFunction.java
IsNull.java NoOp.java LeftIdentityFunction.java
functor/src/test/org/apache/commons/functor/example
QuicksortExample.java FlexiMapExample.java
functor/src/test/org/apache/commons/functor/core/comparator
TestComparableComparator.java
TestIsGreaterThan.java TestIsEquivalent.java
TestIsGreaterThanOrEqual.java
functor/src/test/org/apache/commons/functor/generator
TestGenerator.java
functor/src/java/org/apache/commons/functor/core/comparator
IsNotEquivalent.java ComparatorFunction.java
IsGreaterThanOrEqual.java IsEquivalent.java
IsLessThanOrEqual.java IsGreaterThan.java
ComparableComparator.java IsLessThan.java
functor/src/test/org/apache/commons/functor/core/collection
TestCollectionAlgorithms.java TestIsEmpty.java
TestSize.java
functor/src/java/org/apache/commons/functor/core/collection
IsEmpty.java Size.java
functor/src/test/org/apache/commons/functor
TestAlgorithms.java
Log:
rename all singleton-instance-accessor methods to instance()
Revision Changes Path
1.4 +7 -7 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedProcedure.java
Index: TestTransposedProcedure.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestTransposedProcedure.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestTransposedProcedure.java 4 Mar 2003 23:11:11 -0000 1.3
+++ TestTransposedProcedure.java 24 Nov 2003 20:12:15 -0000 1.4
@@ -84,7 +84,7 @@
// ------------------------------------------------------------------------
protected Object makeFunctor() {
- return new TransposedProcedure(NoOp.getNoOpProcedure());
+ return new TransposedProcedure(NoOp.instance());
}
// Lifecycle
@@ -112,11 +112,11 @@
}
public void testEquals() throws Exception {
- BinaryProcedure p = new TransposedProcedure(NoOp.getNoOpProcedure());
+ BinaryProcedure p = new TransposedProcedure(NoOp.instance());
assertEquals(p,p);
- assertObjectsAreEqual(p,new TransposedProcedure(NoOp.getNoOpProcedure()));
- assertObjectsAreEqual(p,TransposedProcedure.transpose(NoOp.getNoOpProcedure()));
- assertObjectsAreNotEqual(p,new TransposedProcedure(new TransposedProcedure(NoOp.getNoOpProcedure())));
+ assertObjectsAreEqual(p,new TransposedProcedure(NoOp.instance()));
+ assertObjectsAreEqual(p,TransposedProcedure.transpose(NoOp.instance()));
+ assertObjectsAreNotEqual(p,new TransposedProcedure(new TransposedProcedure(NoOp.instance())));
assertObjectsAreNotEqual(p,new TransposedProcedure(null));
assertObjectsAreNotEqual(p,new NoOp());
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNotEqual.java
Index: TestIsNotEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNotEqual.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestIsNotEqual.java 24 Feb 2003 11:38:06 -0000 1.1
+++ TestIsNotEqual.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -120,12 +120,12 @@
BinaryPredicate p = new IsNotEqual();
assertEquals(p,p);
assertObjectsAreEqual(p,new IsNotEqual());
- assertObjectsAreEqual(p,IsNotEqual.getNotEqualPredicate());
+ assertObjectsAreEqual(p,IsNotEqual.instance());
assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate());
}
public void testConstant() throws Exception {
- assertEquals(IsNotEqual.getNotEqualPredicate(),IsNotEqual.getNotEqualPredicate());
- assertSame(IsNotEqual.getNotEqualPredicate(),IsNotEqual.getNotEqualPredicate());
+ assertEquals(IsNotEqual.instance(),IsNotEqual.instance());
+ assertSame(IsNotEqual.instance(),IsNotEqual.instance());
}
}
1.3 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentityFunction.java
Index: TestRightIdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestRightIdentityFunction.java 4 Mar 2003 23:11:12 -0000 1.2
+++ TestRightIdentityFunction.java 24 Nov 2003 20:12:15 -0000 1.3
@@ -116,12 +116,12 @@
BinaryFunction f = new RightIdentityFunction();
assertEquals(f,f);
assertObjectsAreEqual(f,new RightIdentityFunction());
- assertObjectsAreEqual(f,RightIdentityFunction.getRightIdentityFunction());
+ assertObjectsAreEqual(f,RightIdentityFunction.instance());
assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
}
public void testConstant() throws Exception {
- assertEquals(RightIdentityFunction.getRightIdentityFunction(),RightIdentityFunction.getRightIdentityFunction());
- assertSame(RightIdentityFunction.getRightIdentityFunction(),RightIdentityFunction.getRightIdentityFunction());
+ assertEquals(RightIdentityFunction.instance(),RightIdentityFunction.instance());
+ assertSame(RightIdentityFunction.instance(),RightIdentityFunction.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityPredicate.java
Index: TestLeftIdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestLeftIdentityPredicate.java 29 Jan 2003 23:03:18 -0000 1.1
+++ TestLeftIdentityPredicate.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -122,13 +122,13 @@
LeftIdentityPredicate p = new LeftIdentityPredicate();
assertEquals(p,p);
assertObjectsAreEqual(p,new LeftIdentityPredicate());
- assertObjectsAreEqual(p,LeftIdentityPredicate.getLeftIdentityPredicate());
+ assertObjectsAreEqual(p,LeftIdentityPredicate.instance());
assertObjectsAreNotEqual(p,new IdentityPredicate());
assertObjectsAreNotEqual(p,new ConstantPredicate(true));
}
public void testConstant() throws Exception {
- assertEquals(LeftIdentityPredicate.getLeftIdentityPredicate(),LeftIdentityPredicate.getLeftIdentityPredicate());
- assertSame(LeftIdentityPredicate.getLeftIdentityPredicate(),LeftIdentityPredicate.getLeftIdentityPredicate());
+ assertEquals(LeftIdentityPredicate.instance(),LeftIdentityPredicate.instance());
+ assertSame(LeftIdentityPredicate.instance(),LeftIdentityPredicate.instance());
}
}
1.3 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityFunction.java
Index: TestIdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestIdentityFunction.java 4 Mar 2003 23:11:12 -0000 1.2
+++ TestIdentityFunction.java 24 Nov 2003 20:12:15 -0000 1.3
@@ -113,12 +113,12 @@
UnaryFunction f = new IdentityFunction();
assertEquals(f,f);
assertObjectsAreEqual(f,new IdentityFunction());
- assertObjectsAreEqual(f,IdentityFunction.getIdentityFunction());
+ assertObjectsAreEqual(f,IdentityFunction.instance());
assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
}
public void testConstant() throws Exception {
- assertEquals(IdentityFunction.getIdentityFunction(),IdentityFunction.getIdentityFunction());
- assertSame(IdentityFunction.getIdentityFunction(),IdentityFunction.getIdentityFunction());
+ assertEquals(IdentityFunction.instance(),IdentityFunction.instance());
+ assertSame(IdentityFunction.instance(),IdentityFunction.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNotNull.java
Index: TestIsNotNull.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNotNull.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestIsNotNull.java 24 Feb 2003 11:38:06 -0000 1.1
+++ TestIsNotNull.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -111,12 +111,12 @@
UnaryPredicate p = new IsNotNull();
assertEquals(p,p);
assertObjectsAreEqual(p,new IsNotNull());
- assertObjectsAreEqual(p,IsNotNull.getIsNotNullPredicate());
+ assertObjectsAreEqual(p,IsNotNull.instance());
assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate());
}
public void testConstant() throws Exception {
- assertEquals(IsNotNull.getIsNotNullPredicate(),IsNotNull.getIsNotNullPredicate());
- assertSame(IsNotNull.getIsNotNullPredicate(),IsNotNull.getIsNotNullPredicate());
+ assertEquals(IsNotNull.instance(),IsNotNull.instance());
+ assertSame(IsNotNull.instance(),IsNotNull.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentityPredicate.java
Index: TestRightIdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestRightIdentityPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestRightIdentityPredicate.java 29 Jan 2003 23:03:18 -0000 1.1
+++ TestRightIdentityPredicate.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -122,13 +122,13 @@
RightIdentityPredicate p = new RightIdentityPredicate();
assertEquals(p,p);
assertObjectsAreEqual(p,new RightIdentityPredicate());
- assertObjectsAreEqual(p,RightIdentityPredicate.getRightIdentityPredicate());
+ assertObjectsAreEqual(p,RightIdentityPredicate.instance());
assertObjectsAreNotEqual(p,new IdentityPredicate());
assertObjectsAreNotEqual(p,new ConstantPredicate(true));
}
public void testConstant() throws Exception {
- assertEquals(RightIdentityPredicate.getRightIdentityPredicate(),RightIdentityPredicate.getRightIdentityPredicate());
- assertSame(RightIdentityPredicate.getRightIdentityPredicate(),RightIdentityPredicate.getRightIdentityPredicate());
+ assertEquals(RightIdentityPredicate.instance(),RightIdentityPredicate.instance());
+ assertSame(RightIdentityPredicate.instance(),RightIdentityPredicate.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestNoOp.java
Index: TestNoOp.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestNoOp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestNoOp.java 24 Feb 2003 11:48:09 -0000 1.1
+++ TestNoOp.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -117,14 +117,14 @@
NoOp p = new NoOp();
assertEquals(p,p);
assertObjectsAreEqual(p,new NoOp());
- assertObjectsAreEqual(p,NoOp.getNoOpProcedure());
+ assertObjectsAreEqual(p,NoOp.instance());
assertObjectsAreNotEqual(p,new Procedure() { public void run() { } });
assertObjectsAreNotEqual(p,new UnaryProcedure() { public void run(Object a) { } });
assertObjectsAreNotEqual(p,new BinaryProcedure() { public void run(Object a, Object b) { } });
}
public void testConstant() throws Exception {
- assertEquals(NoOp.getNoOpProcedure(),NoOp.getNoOpProcedure());
- assertSame(NoOp.getNoOpProcedure(),NoOp.getNoOpProcedure());
+ assertEquals(NoOp.instance(),NoOp.instance());
+ assertSame(NoOp.instance(),NoOp.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsEqual.java
Index: TestIsEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsEqual.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestIsEqual.java 24 Feb 2003 11:38:06 -0000 1.1
+++ TestIsEqual.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -121,12 +121,12 @@
assertEquals(f,f);
assertObjectsAreEqual(f,new IsEqual());
- assertObjectsAreEqual(f,IsEqual.getEqualPredicate());
+ assertObjectsAreEqual(f,IsEqual.instance());
assertObjectsAreNotEqual(f,ConstantPredicate.getTruePredicate());
}
public void testConstant() throws Exception {
- assertEquals(IsEqual.getEqualPredicate(),IsEqual.getEqualPredicate());
- assertSame(IsEqual.getEqualPredicate(),IsEqual.getEqualPredicate());
+ assertEquals(IsEqual.instance(),IsEqual.instance());
+ assertSame(IsEqual.instance(),IsEqual.instance());
}
}
1.3 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityFunction.java
Index: TestLeftIdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestLeftIdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestLeftIdentityFunction.java 4 Mar 2003 23:11:12 -0000 1.2
+++ TestLeftIdentityFunction.java 24 Nov 2003 20:12:15 -0000 1.3
@@ -116,12 +116,12 @@
BinaryFunction f = new LeftIdentityFunction();
assertEquals(f,f);
assertObjectsAreEqual(f,new LeftIdentityFunction());
- assertObjectsAreEqual(f,LeftIdentityFunction.getLeftIdentityFunction());
+ assertObjectsAreEqual(f,LeftIdentityFunction.instance());
assertObjectsAreNotEqual(f,new ConstantFunction("abcde"));
}
public void testConstant() throws Exception {
- assertEquals(LeftIdentityFunction.getLeftIdentityFunction(),LeftIdentityFunction.getLeftIdentityFunction());
- assertSame(LeftIdentityFunction.getLeftIdentityFunction(),LeftIdentityFunction.getLeftIdentityFunction());
+ assertEquals(LeftIdentityFunction.instance(),LeftIdentityFunction.instance());
+ assertSame(LeftIdentityFunction.instance(),LeftIdentityFunction.instance());
}
}
1.3 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityPredicate.java
Index: TestIdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIdentityPredicate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestIdentityPredicate.java 4 Mar 2003 23:11:12 -0000 1.2
+++ TestIdentityPredicate.java 24 Nov 2003 20:12:15 -0000 1.3
@@ -122,12 +122,12 @@
UnaryPredicate f = new IdentityPredicate();
assertEquals(f,f);
assertObjectsAreEqual(f,new IdentityPredicate());
- assertObjectsAreEqual(f,IdentityPredicate.getIdentityPredicate());
+ assertObjectsAreEqual(f,IdentityPredicate.instance());
assertObjectsAreNotEqual(f,new ConstantPredicate(true));
}
public void testConstant() throws Exception {
- assertEquals(IdentityPredicate.getIdentityPredicate(),IdentityPredicate.getIdentityPredicate());
- assertSame(IdentityPredicate.getIdentityPredicate(),IdentityPredicate.getIdentityPredicate());
+ assertEquals(IdentityPredicate.instance(),IdentityPredicate.instance());
+ assertSame(IdentityPredicate.instance(),IdentityPredicate.instance());
}
}
1.2 +5 -5 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNull.java
Index: TestIsNull.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/TestIsNull.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestIsNull.java 24 Feb 2003 11:38:06 -0000 1.1
+++ TestIsNull.java 24 Nov 2003 20:12:15 -0000 1.2
@@ -111,12 +111,12 @@
UnaryPredicate p = new IsNull();
assertEquals(p,p);
assertObjectsAreEqual(p,new IsNull());
- assertObjectsAreEqual(p,IsNull.getIsNullPredicate());
+ assertObjectsAreEqual(p,IsNull.instance());
assertObjectsAreNotEqual(p,ConstantPredicate.getTruePredicate());
}
public void testConstant() throws Exception {
- assertEquals(IsNull.getIsNullPredicate(),IsNull.getIsNullPredicate());
- assertSame(IsNull.getIsNullPredicate(),IsNull.getIsNullPredicate());
+ assertEquals(IsNull.instance(),IsNull.instance());
+ assertSame(IsNull.instance(),IsNull.instance());
}
}
1.2 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNotNull.java
Index: IsNotNull.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNotNull.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IsNotNull.java 24 Feb 2003 11:38:06 -0000 1.1
+++ IsNotNull.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -94,9 +94,9 @@
return "IsNotNull";
}
- // static attributes
+ // static methods
// ------------------------------------------------------------------------
- public static IsNotNull getIsNotNullPredicate() {
+ public static IsNotNull instance() {
return INSTANCE;
}
1.3 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/RightIdentityFunction.java
Index: RightIdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/RightIdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RightIdentityFunction.java 28 Jan 2003 12:00:28 -0000 1.2
+++ RightIdentityFunction.java 24 Nov 2003 20:12:16 -0000 1.3
@@ -93,7 +93,7 @@
// static methods
// ------------------------------------------------------------------------
- public static RightIdentityFunction getRightIdentityFunction() {
+ public static RightIdentityFunction instance() {
return INSTANCE;
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/RightIdentityPredicate.java
Index: RightIdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/RightIdentityPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RightIdentityPredicate.java 29 Jan 2003 23:03:18 -0000 1.1
+++ RightIdentityPredicate.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -102,7 +102,7 @@
// static methods
// ------------------------------------------------------------------------
- public static RightIdentityPredicate getRightIdentityPredicate() {
+ public static RightIdentityPredicate instance() {
return INSTANCE;
}
1.2 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNotEqual.java
Index: IsNotEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNotEqual.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IsNotEqual.java 24 Feb 2003 11:38:06 -0000 1.1
+++ IsNotEqual.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -98,9 +98,9 @@
return "IsNotEqual";
}
- // static attributes
+ // static methods
// ------------------------------------------------------------------------
- public static IsNotEqual getNotEqualPredicate() {
+ public static IsNotEqual instance() {
return INSTANCE;
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityPredicate.java
Index: LeftIdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LeftIdentityPredicate.java 29 Jan 2003 23:03:17 -0000 1.1
+++ LeftIdentityPredicate.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -102,7 +102,7 @@
// static methods
// ------------------------------------------------------------------------
- public static LeftIdentityPredicate getLeftIdentityPredicate() {
+ public static LeftIdentityPredicate instance() {
return INSTANCE;
}
1.2 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsEqual.java
Index: IsEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsEqual.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IsEqual.java 24 Feb 2003 11:38:06 -0000 1.1
+++ IsEqual.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -101,9 +101,9 @@
return "IsEqual";
}
- // static attributes
+ // static methods
// ------------------------------------------------------------------------
- public static IsEqual getEqualPredicate() {
+ public static IsEqual instance() {
return INSTANCE;
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityPredicate.java
Index: IdentityPredicate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IdentityPredicate.java 29 Jan 2003 23:03:17 -0000 1.1
+++ IdentityPredicate.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -101,7 +101,7 @@
// static methods
// ------------------------------------------------------------------------
- public static IdentityPredicate getIdentityPredicate() {
+ public static IdentityPredicate instance() {
return INSTANCE;
}
1.3 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityFunction.java
Index: IdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IdentityFunction.java 28 Jan 2003 12:00:28 -0000 1.2
+++ IdentityFunction.java 24 Nov 2003 20:12:16 -0000 1.3
@@ -93,7 +93,7 @@
// static methods
// ------------------------------------------------------------------------
- public static IdentityFunction getIdentityFunction() {
+ public static IdentityFunction instance() {
return INSTANCE;
}
1.2 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNull.java
Index: IsNull.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/IsNull.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IsNull.java 24 Feb 2003 11:38:06 -0000 1.1
+++ IsNull.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -94,9 +94,9 @@
return "IsNull";
}
- // static attributes
+ // static methods
// ------------------------------------------------------------------------
- public static IsNull getIsNullPredicate() {
+ public static IsNull instance() {
return INSTANCE;
}
1.2 +7 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/NoOp.java
Index: NoOp.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/NoOp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NoOp.java 24 Feb 2003 11:48:08 -0000 1.1
+++ NoOp.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -64,7 +64,10 @@
/**
* A procedure that does nothing at all.
- *
+ * <p>
+ * Note that this class implements {@link Procedure},
+ * {@link UnaryProcedure}, and {@link BinaryProcedure}.
+ * </p>
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
@@ -100,7 +103,7 @@
// static methods
// ------------------------------------------------------------------------
- public static NoOp getNoOpProcedure() {
+ public static NoOp instance() {
return INSTANCE;
}
1.3 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityFunction.java
Index: LeftIdentityFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/LeftIdentityFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LeftIdentityFunction.java 28 Jan 2003 12:00:28 -0000 1.2
+++ LeftIdentityFunction.java 24 Nov 2003 20:12:16 -0000 1.3
@@ -93,7 +93,7 @@
// static methods
// ------------------------------------------------------------------------
- public static LeftIdentityFunction getLeftIdentityFunction() {
+ public static LeftIdentityFunction instance() {
return INSTANCE;
}
1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java
Index: QuicksortExample.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/QuicksortExample.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- QuicksortExample.java 31 Mar 2003 18:21:52 -0000 1.3
+++ QuicksortExample.java 24 Nov 2003 20:12:16 -0000 1.4
@@ -382,7 +382,7 @@
private UnaryFunction quicksort = new ConditionalUnaryFunction(
/* if the list is empty... */
- IsEmpty.getIsEmpty(),
+ IsEmpty.instance(),
/* ...then return an empty list... */
new ConstantFunction(Collections.EMPTY_LIST),
/* ...else, apply the following function... */
@@ -519,7 +519,7 @@
return CollectionAlgorithms.select(
((List)tail).iterator(),
RightBoundPredicate.bind(
- IsGreaterThanOrEqual.getIsGreaterThanOrEqual(),
+ IsGreaterThanOrEqual.instance(),
head));
}
};
1.6 +7 -7 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/FlexiMapExample.java
Index: FlexiMapExample.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/FlexiMapExample.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FlexiMapExample.java 29 Mar 2003 01:14:22 -0000 1.5
+++ FlexiMapExample.java 24 Nov 2003 20:12:16 -0000 1.6
@@ -449,7 +449,7 @@
/*
* we'll test for null,
*/
- IsNull.getIsNullPredicate(),
+ IsNull.instance(),
/*
* throwing a NullPointerException when the value is null,
*/
@@ -457,7 +457,7 @@
/*
* and passing through all non-null values.
*/
- IdentityFunction.getIdentityFunction()
+ IdentityFunction.instance()
)
),
null
@@ -483,7 +483,7 @@
/*
* we'll test for null,
*/
- IsNull.getIsNullPredicate(),
+ IsNull.instance(),
/*
* returning our default when the value is otherwise null,
*/
@@ -491,7 +491,7 @@
/*
* and passing through all non-null values.
*/
- IdentityFunction.getIdentityFunction()
+ IdentityFunction.instance()
)
)
);
@@ -515,7 +515,7 @@
/*
* and either pass the given value through,
*/
- IdentityFunction.getIdentityFunction(),
+ IdentityFunction.instance(),
/*
* or throw a ClassCastException.
*/
1.2 +9 -9 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestComparableComparator.java
Index: TestComparableComparator.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestComparableComparator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestComparableComparator.java 20 Feb 2003 01:12:41 -0000 1.1
+++ TestComparableComparator.java 24 Nov 2003 20:12:16 -0000 1.2
@@ -92,16 +92,16 @@
// ------------------------------------------------------------------------
public void testCompareIntegers() {
- assertTrue(ComparableComparator.getInstance().compare(new Integer(Integer.MIN_VALUE),new Integer(Integer.MIN_VALUE)) == 0);
- assertTrue(ComparableComparator.getInstance().compare(new Integer(-1),new Integer(-1)) == 0);
- assertTrue(ComparableComparator.getInstance().compare(new Integer(0),new Integer(0)) == 0);
- assertTrue(ComparableComparator.getInstance().compare(new Integer(Integer.MAX_VALUE),new Integer(Integer.MAX_VALUE)) == 0);
- assertTrue(ComparableComparator.getInstance().compare(new Integer(1),new Integer(1)) == 0);
+ assertTrue(ComparableComparator.instance().compare(new Integer(Integer.MIN_VALUE),new Integer(Integer.MIN_VALUE)) == 0);
+ assertTrue(ComparableComparator.instance().compare(new Integer(-1),new Integer(-1)) == 0);
+ assertTrue(ComparableComparator.instance().compare(new Integer(0),new Integer(0)) == 0);
+ assertTrue(ComparableComparator.instance().compare(new Integer(Integer.MAX_VALUE),new Integer(Integer.MAX_VALUE)) == 0);
+ assertTrue(ComparableComparator.instance().compare(new Integer(1),new Integer(1)) == 0);
}
public void testCompareIncomparable() {
try {
- ComparableComparator.getInstance().compare(new Object(),new Integer(2));
+ ComparableComparator.instance().compare(new Object(),new Integer(2));
fail("Expected ClassCastException");
} catch(ClassCastException e) {
// expected
@@ -110,7 +110,7 @@
public void testCompareNull() {
try {
- ComparableComparator.getInstance().compare(null,new Integer(2));
+ ComparableComparator.instance().compare(null,new Integer(2));
fail("Expected NullPointerException");
} catch(NullPointerException e) {
// expected
1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java
Index: TestIsGreaterThan.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestIsGreaterThan.java 4 Mar 2003 23:11:13 -0000 1.3
+++ TestIsGreaterThan.java 24 Nov 2003 20:12:16 -0000 1.4
@@ -115,8 +115,8 @@
assertObjectsAreEqual(p,new IsGreaterThan());
assertObjectsAreEqual(p,new IsGreaterThan(null));
assertObjectsAreEqual(p,new IsGreaterThan(new ComparableComparator()));
- assertObjectsAreEqual(p,IsGreaterThan.getIsGreaterThan());
- assertSame(IsGreaterThan.getIsGreaterThan(),IsGreaterThan.getIsGreaterThan());
+ assertObjectsAreEqual(p,IsGreaterThan.instance());
+ assertSame(IsGreaterThan.instance(),IsGreaterThan.instance());
assertObjectsAreNotEqual(p,new ConstantPredicate(false));
}
1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsEquivalent.java
Index: TestIsEquivalent.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsEquivalent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestIsEquivalent.java 4 Mar 2003 23:11:13 -0000 1.3
+++ TestIsEquivalent.java 24 Nov 2003 20:12:16 -0000 1.4
@@ -115,8 +115,8 @@
assertObjectsAreEqual(p,new IsEquivalent());
assertObjectsAreEqual(p,new IsEquivalent(null));
assertObjectsAreEqual(p,new IsEquivalent(new ComparableComparator()));
- assertObjectsAreEqual(p,IsEquivalent.getIsEquivalent());
- assertSame(IsEquivalent.getIsEquivalent(),IsEquivalent.getIsEquivalent());
+ assertObjectsAreEqual(p,IsEquivalent.instance());
+ assertSame(IsEquivalent.instance(),IsEquivalent.instance());
assertObjectsAreNotEqual(p,new ConstantPredicate(false));
}
1.4 +4 -4 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java
Index: TestIsGreaterThanOrEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestIsGreaterThanOrEqual.java 4 Mar 2003 23:11:13 -0000 1.3
+++ TestIsGreaterThanOrEqual.java 24 Nov 2003 20:12:16 -0000 1.4
@@ -115,8 +115,8 @@
assertObjectsAreEqual(p,new IsGreaterThanOrEqual());
assertObjectsAreEqual(p,new IsGreaterThanOrEqual(null));
assertObjectsAreEqual(p,new IsGreaterThanOrEqual(new ComparableComparator()));
- assertObjectsAreEqual(p,IsGreaterThanOrEqual.getIsGreaterThanOrEqual());
- assertSame(IsGreaterThanOrEqual.getIsGreaterThanOrEqual(),IsGreaterThanOrEqual.getIsGreaterThanOrEqual());
+ assertObjectsAreEqual(p,IsGreaterThanOrEqual.instance());
+ assertSame(IsGreaterThanOrEqual.instance(),IsGreaterThanOrEqual.instance());
assertObjectsAreNotEqual(p,new ConstantPredicate(false));
}
1.5 +6 -6 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java
Index: TestGenerator.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestGenerator.java 19 Jul 2003 22:12:25 -0000 1.4
+++ TestGenerator.java 24 Nov 2003 20:12:17 -0000 1.5
@@ -203,7 +203,7 @@
// ------------------------------------------------------------------------
public void testApply() {
- Collection result = EachElement.from(list).apply(IdentityFunction.getIdentityFunction()).toCollection();
+ Collection result = EachElement.from(list).apply(IdentityFunction.instance()).toCollection();
assertNotNull(result);
assertEquals(list.size(),result.size());
assertEquals(list,result);
@@ -211,7 +211,7 @@
public void testApply2() {
Set set = new HashSet();
- assertSame(set,EachElement.from(list).apply(IdentityFunction.getIdentityFunction()).to(set));
+ assertSame(set,EachElement.from(list).apply(IdentityFunction.instance()).to(set));
assertEquals(list.size(),set.size());
for(Iterator iter = list.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -220,7 +220,7 @@
public void testApply3() {
Set set = new HashSet();
- assertSame(set,EachElement.from(listWithDuplicates).apply(IdentityFunction.getIdentityFunction()).to(set));
+ assertSame(set,EachElement.from(listWithDuplicates).apply(IdentityFunction.instance()).to(set));
assertTrue(listWithDuplicates.size() > set.size());
for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -319,8 +319,8 @@
private List evens = null;
private List listWithDuplicates = null;
private int sum = 0;
- private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(3));
- private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(23));
+ private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
+ private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
private UnaryPredicate isEven = new UnaryPredicate() {
public boolean test(Object obj) {
return ((Number)obj).intValue() % 2 == 0;
1.4 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
Index: IsNotEquivalent.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsNotEquivalent.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsNotEquivalent.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -92,7 +92,7 @@
* be used.
*/
public IsNotEquivalent(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
1.3 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java
Index: ComparatorFunction.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComparatorFunction.java 21 Feb 2003 00:12:28 -0000 1.2
+++ ComparatorFunction.java 24 Nov 2003 20:12:17 -0000 1.3
@@ -74,7 +74,7 @@
}
public ComparatorFunction(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
1.4 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
Index: IsGreaterThanOrEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsGreaterThanOrEqual.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsGreaterThanOrEqual.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -89,7 +89,7 @@
* be used.
*/
public IsGreaterThanOrEqual(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
@@ -137,7 +137,7 @@
return "IsGreaterThanOrEqual<" + comparator + ">";
}
- public static final IsGreaterThanOrEqual getIsGreaterThanOrEqual() {
+ public static final IsGreaterThanOrEqual instance() {
return COMPARABLE_INSTANCE;
}
1.4 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
Index: IsEquivalent.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsEquivalent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsEquivalent.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsEquivalent.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -92,7 +92,7 @@
* be used.
*/
public IsEquivalent(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
@@ -140,7 +140,7 @@
return "IsEquivalent<" + comparator + ">";
}
- public static final IsEquivalent getIsEquivalent() {
+ public static final IsEquivalent instance() {
return COMPARABLE_INSTANCE;
}
1.4 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
Index: IsLessThanOrEqual.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsLessThanOrEqual.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsLessThanOrEqual.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -89,7 +89,7 @@
* be used.
*/
public IsLessThanOrEqual(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
1.4 +4 -4 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
Index: IsGreaterThan.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsGreaterThan.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsGreaterThan.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -89,7 +89,7 @@
* be used.
*/
public IsGreaterThan(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
@@ -137,7 +137,7 @@
return "IsGreaterThan<" + comparator + ">";
}
- public static final IsGreaterThan getIsGreaterThan() {
+ public static final IsGreaterThan instance() {
return COMPARABLE_INSTANCE;
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
Index: ComparableComparator.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/ComparableComparator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ComparableComparator.java 20 Feb 2003 01:12:40 -0000 1.1
+++ ComparableComparator.java 24 Nov 2003 20:12:17 -0000 1.2
@@ -98,7 +98,7 @@
return" ComparableComparator";
}
- public static final ComparableComparator getInstance() {
+ public static final ComparableComparator instance() {
return INSTANCE;
}
1.4 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsLessThan.java
Index: IsLessThan.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/comparator/IsLessThan.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IsLessThan.java 4 Mar 2003 17:28:21 -0000 1.3
+++ IsLessThan.java 24 Nov 2003 20:12:17 -0000 1.4
@@ -89,7 +89,7 @@
* be used.
*/
public IsLessThan(Comparator comparator) {
- this.comparator = null == comparator ? ComparableComparator.getInstance() : comparator;
+ this.comparator = null == comparator ? ComparableComparator.instance() : comparator;
}
/**
1.6 +7 -7 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java
Index: TestCollectionAlgorithms.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestCollectionAlgorithms.java 4 Mar 2003 23:11:14 -0000 1.5
+++ TestCollectionAlgorithms.java 24 Nov 2003 20:12:17 -0000 1.6
@@ -132,7 +132,7 @@
}
public void testCollect() {
- Collection result = CollectionAlgorithms.collect(list.iterator(),IdentityFunction.getIdentityFunction());
+ Collection result = CollectionAlgorithms.collect(list.iterator(),IdentityFunction.instance());
assertNotNull(result);
assertEquals(list.size(),result.size());
assertEquals(list,result);
@@ -140,7 +140,7 @@
public void testCollect2() {
Set set = new HashSet();
- assertSame(set,CollectionAlgorithms.collect(list.iterator(),IdentityFunction.getIdentityFunction(),set));
+ assertSame(set,CollectionAlgorithms.collect(list.iterator(),IdentityFunction.instance(),set));
assertEquals(list.size(),set.size());
for(Iterator iter = list.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -149,7 +149,7 @@
public void testCollect3() {
Set set = new HashSet();
- assertSame(set,CollectionAlgorithms.collect(listWithDuplicates.iterator(),IdentityFunction.getIdentityFunction(),set));
+ assertSame(set,CollectionAlgorithms.collect(listWithDuplicates.iterator(),IdentityFunction.instance(),set));
assertTrue(listWithDuplicates.size() > set.size());
for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -247,8 +247,8 @@
private List evens = null;
private List listWithDuplicates = null;
private int sum = 0;
- private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(3));
- private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(23));
+ private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
+ private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
private UnaryPredicate isEven = new UnaryPredicate() {
public boolean test(Object obj) {
return ((Number)obj).intValue() % 2 == 0;
1.3 +12 -12 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java
Index: TestIsEmpty.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestIsEmpty.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestIsEmpty.java 4 Mar 2003 14:48:07 -0000 1.2
+++ TestIsEmpty.java 24 Nov 2003 20:12:17 -0000 1.3
@@ -109,25 +109,25 @@
// ------------------------------------------------------------------------
public void testTest() throws Exception {
- assertTrue(IsEmpty.getIsEmpty().test(Collections.EMPTY_LIST));
- assertTrue(IsEmpty.getIsEmpty().test(Collections.EMPTY_SET));
+ assertTrue(IsEmpty.instance().test(Collections.EMPTY_LIST));
+ assertTrue(IsEmpty.instance().test(Collections.EMPTY_SET));
{
List list = new ArrayList();
- assertTrue(IsEmpty.getIsEmpty().test(list));
+ assertTrue(IsEmpty.instance().test(list));
list.add("Xyzzy");
- assertTrue(!IsEmpty.getIsEmpty().test(list));
+ assertTrue(!IsEmpty.instance().test(list));
}
{
Set set = new HashSet();
- assertTrue(IsEmpty.getIsEmpty().test(set));
+ assertTrue(IsEmpty.instance().test(set));
set.add("Xyzzy");
- assertTrue(!IsEmpty.getIsEmpty().test(set));
+ assertTrue(!IsEmpty.instance().test(set));
}
}
public void testTestNull() throws Exception {
try {
- IsEmpty.getIsEmpty().test(null);
+ IsEmpty.instance().test(null);
fail("Expected NullPointerException");
} catch(NullPointerException e) {
// expected
@@ -136,7 +136,7 @@
public void testTestNonCollection() throws Exception {
try {
- IsEmpty.getIsEmpty().test(new Integer(3));
+ IsEmpty.instance().test(new Integer(3));
fail("Expected ClassCastException");
} catch(ClassCastException e) {
// expected
@@ -147,8 +147,8 @@
UnaryPredicate p = new IsEmpty();
assertEquals(p,p);
assertObjectsAreEqual(p,new IsEmpty());
- assertObjectsAreEqual(p,IsEmpty.getIsEmpty());
- assertSame(IsEmpty.getIsEmpty(),IsEmpty.getIsEmpty());
+ assertObjectsAreEqual(p,IsEmpty.instance());
+ assertSame(IsEmpty.instance(),IsEmpty.instance());
assertObjectsAreNotEqual(p,new ConstantPredicate(true));
assertObjectsAreNotEqual(p,new UnaryNot(null));
}
1.2 +14 -14 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java
Index: TestSize.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestSize.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSize.java 21 Feb 2003 00:12:28 -0000 1.1
+++ TestSize.java 24 Nov 2003 20:12:17 -0000 1.2
@@ -108,31 +108,31 @@
// ------------------------------------------------------------------------
public void testEvaluate() throws Exception {
- assertEquals(new Integer(0),Size.getSize().evaluate(Collections.EMPTY_LIST));
- assertEquals(new Integer(0),Size.getSize().evaluate(Collections.EMPTY_SET));
+ assertEquals(new Integer(0),Size.instance().evaluate(Collections.EMPTY_LIST));
+ assertEquals(new Integer(0),Size.instance().evaluate(Collections.EMPTY_SET));
{
List list = new ArrayList();
- assertEquals(new Integer(0),Size.getSize().evaluate(list));
+ assertEquals(new Integer(0),Size.instance().evaluate(list));
for(int i=0;i<2;i++) {
- assertEquals(new Integer(i),Size.getSize().evaluate(list));
+ assertEquals(new Integer(i),Size.instance().evaluate(list));
list.add(new Integer(i));
- assertEquals(new Integer(i+1),Size.getSize().evaluate(list));
+ assertEquals(new Integer(i+1),Size.instance().evaluate(list));
}
}
{
Set set = new HashSet();
- assertEquals(new Integer(0),Size.getSize().evaluate(set));
+ assertEquals(new Integer(0),Size.instance().evaluate(set));
for(int i=0;i<2;i++) {
- assertEquals(new Integer(i),Size.getSize().evaluate(set));
+ assertEquals(new Integer(i),Size.instance().evaluate(set));
set.add(new Integer(i));
- assertEquals(new Integer(i+1),Size.getSize().evaluate(set));
+ assertEquals(new Integer(i+1),Size.instance().evaluate(set));
}
}
}
public void testEvaluateNull() throws Exception {
try {
- Size.getSize().evaluate(null);
+ Size.instance().evaluate(null);
fail("Expected NullPointerException");
} catch(NullPointerException e) {
// expected
@@ -141,7 +141,7 @@
public void testTestNonCollection() throws Exception {
try {
- Size.getSize().evaluate(new Integer(3));
+ Size.instance().evaluate(new Integer(3));
fail("Expected ClassCastException");
} catch(ClassCastException e) {
// expected
@@ -152,8 +152,8 @@
UnaryFunction f = new Size();
assertEquals(f,f);
assertObjectsAreEqual(f,new Size());
- assertObjectsAreEqual(f,Size.getSize());
- assertSame(Size.getSize(),Size.getSize());
+ assertObjectsAreEqual(f,Size.instance());
+ assertSame(Size.instance(),Size.instance());
assertObjectsAreNotEqual(f,new ConstantFunction(null));
assertTrue(! f.equals((Size)null) );
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java
Index: IsEmpty.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/IsEmpty.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IsEmpty.java 20 Feb 2003 01:12:39 -0000 1.1
+++ IsEmpty.java 24 Nov 2003 20:12:17 -0000 1.2
@@ -97,7 +97,7 @@
return "IsEmpty()";
}
- public static final IsEmpty getIsEmpty() {
+ public static final IsEmpty instance() {
return INSTANCE;
}
1.2 +3 -3 jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/Size.java
Index: Size.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/Size.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Size.java 20 Feb 2003 01:12:39 -0000 1.1
+++ Size.java 24 Nov 2003 20:12:17 -0000 1.2
@@ -97,7 +97,7 @@
return "Size()";
}
- public static final Size getSize() {
+ public static final Size instance() {
return INSTANCE;
}
1.3 +7 -7 jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java
Index: TestAlgorithms.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestAlgorithms.java 30 Jun 2003 11:00:18 -0000 1.2
+++ TestAlgorithms.java 24 Nov 2003 20:12:17 -0000 1.3
@@ -132,7 +132,7 @@
}
public void testApply() {
- Collection result = Algorithms.apply(list.iterator(),IdentityFunction.getIdentityFunction()).toCollection();
+ Collection result = Algorithms.apply(list.iterator(),IdentityFunction.instance()).toCollection();
assertNotNull(result);
assertEquals(list.size(),result.size());
assertEquals(list,result);
@@ -140,7 +140,7 @@
public void testApply2() {
Set set = new HashSet();
- assertSame(set,Algorithms.apply(list.iterator(),IdentityFunction.getIdentityFunction()).to(set));
+ assertSame(set,Algorithms.apply(list.iterator(),IdentityFunction.instance()).to(set));
assertEquals(list.size(),set.size());
for(Iterator iter = list.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -149,7 +149,7 @@
public void testApply3() {
Set set = new HashSet();
- assertSame(set,Algorithms.apply(listWithDuplicates.iterator(),IdentityFunction.getIdentityFunction()).to(set));
+ assertSame(set,Algorithms.apply(listWithDuplicates.iterator(),IdentityFunction.instance()).to(set));
assertTrue(listWithDuplicates.size() > set.size());
for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
assertTrue(set.contains(iter.next()));
@@ -266,8 +266,8 @@
private List evens = null;
private List listWithDuplicates = null;
private int sum = 0;
- private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(3));
- private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.getEqualPredicate(),new Integer(23));
+ private UnaryPredicate equalsThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(3));
+ private UnaryPredicate equalsTwentyThree = LeftBoundPredicate.bind(IsEqual.instance(),new Integer(23));
private UnaryPredicate isEven = new UnaryPredicate() {
public boolean test(Object obj) {
return ((Number)obj).intValue() % 2 == 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org