You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2004/05/26 23:50:52 UTC
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections TransformerUtils.java PredicateUtils.java ClosureUtils.java
scolebourne 2004/05/26 14:50:52
Modified: collections/src/java/org/apache/commons/collections
TransformerUtils.java PredicateUtils.java
ClosureUtils.java
Log:
Replace calls to Utils classes with direct references to implementations
Revision Changes Path
1.13 +3 -2 jakarta-commons/collections/src/java/org/apache/commons/collections/TransformerUtils.java
Index: TransformerUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/TransformerUtils.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TransformerUtils.java 14 Apr 2004 21:47:47 -0000 1.12
+++ TransformerUtils.java 26 May 2004 21:50:52 -0000 1.13
@@ -23,6 +23,7 @@
import org.apache.commons.collections.functors.CloneTransformer;
import org.apache.commons.collections.functors.ClosureTransformer;
import org.apache.commons.collections.functors.ConstantTransformer;
+import org.apache.commons.collections.functors.EqualPredicate;
import org.apache.commons.collections.functors.ExceptionTransformer;
import org.apache.commons.collections.functors.FactoryTransformer;
import org.apache.commons.collections.functors.InstantiateTransformer;
@@ -339,7 +340,7 @@
int i = 0;
for (Iterator it = objectsAndTransformers.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
- preds[i] = PredicateUtils.equalPredicate(entry.getKey());
+ preds[i] = EqualPredicate.getInstance(entry.getKey());
trs[i] = (Transformer) entry.getValue();
i++;
}
1.19 +5 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/PredicateUtils.java
Index: PredicateUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/PredicateUtils.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- PredicateUtils.java 14 Apr 2004 21:47:47 -0000 1.18
+++ PredicateUtils.java 26 May 2004 21:50:52 -0000 1.19
@@ -25,6 +25,7 @@
import org.apache.commons.collections.functors.FalsePredicate;
import org.apache.commons.collections.functors.IdentityPredicate;
import org.apache.commons.collections.functors.InstanceofPredicate;
+import org.apache.commons.collections.functors.InvokerTransformer;
import org.apache.commons.collections.functors.NonePredicate;
import org.apache.commons.collections.functors.NotNullPredicate;
import org.apache.commons.collections.functors.NotPredicate;
@@ -60,6 +61,7 @@
* <li>False - always return false
* <li>Exception - always throws an exception
* <li>NullIsException/NullIsFalse/NullIsTrue - check for null input
+ * <li>Transformed - transforms the input before calling the predicate
* </ul>
* All the supplied predicates are Serializable.
*
@@ -213,7 +215,7 @@
*/
public static Predicate invokerPredicate(String methodName){
// reuse transformer as it has caching - this is lazy really, should have inner class here
- return asPredicate(TransformerUtils.invokerTransformer(methodName));
+ return asPredicate(InvokerTransformer.getInstance(methodName));
}
/**
@@ -238,7 +240,7 @@
*/
public static Predicate invokerPredicate(String methodName, Class[] paramTypes, Object[] args){
// reuse transformer as it has caching - this is lazy really, should have inner class here
- return asPredicate(TransformerUtils.invokerTransformer(methodName, paramTypes, args));
+ return asPredicate(InvokerTransformer.getInstance(methodName, paramTypes, args));
}
// Boolean combinations
1.9 +6 -4 jakarta-commons/collections/src/java/org/apache/commons/collections/ClosureUtils.java
Index: ClosureUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ClosureUtils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ClosureUtils.java 14 Apr 2004 21:47:47 -0000 1.8
+++ ClosureUtils.java 26 May 2004 21:50:52 -0000 1.9
@@ -20,9 +20,11 @@
import java.util.Map;
import org.apache.commons.collections.functors.ChainedClosure;
+import org.apache.commons.collections.functors.EqualPredicate;
import org.apache.commons.collections.functors.ExceptionClosure;
import org.apache.commons.collections.functors.ForClosure;
import org.apache.commons.collections.functors.IfClosure;
+import org.apache.commons.collections.functors.InvokerTransformer;
import org.apache.commons.collections.functors.NOPClosure;
import org.apache.commons.collections.functors.SwitchClosure;
import org.apache.commons.collections.functors.TransformerClosure;
@@ -155,7 +157,7 @@
*/
public static Closure invokerClosure(String methodName) {
// reuse transformer as it has caching - this is lazy really, should have inner class here
- return asClosure(TransformerUtils.invokerTransformer(methodName, null, null));
+ return asClosure(InvokerTransformer.getInstance(methodName));
}
/**
@@ -174,7 +176,7 @@
*/
public static Closure invokerClosure(String methodName, Class[] paramTypes, Object[] args) {
// reuse transformer as it has caching - this is lazy really, should have inner class here
- return asClosure(TransformerUtils.invokerTransformer(methodName, paramTypes, args));
+ return asClosure(InvokerTransformer.getInstance(methodName, paramTypes, args));
}
/**
@@ -339,7 +341,7 @@
int i = 0;
for (Iterator it = objectsAndClosures.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
- preds[i] = PredicateUtils.equalPredicate(entry.getKey());
+ preds[i] = EqualPredicate.getInstance(entry.getKey());
trs[i] = (Closure) entry.getValue();
i++;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org