Cleanup of functors package.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1366162 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2012-07-26 19:23:39 +00:00
parent af26dd95c2
commit 14eff09f21
55 changed files with 120 additions and 199 deletions

View File

@ -139,6 +139,9 @@
<contributor>
<name>Nathan Beyer</name>
</contributor>
<contributor>
<name>Rune Peter Bjørnstad</name>
</contributor>
<contributor>
<name>Janek Bogucki</name>
</contributor>

View File

@ -34,11 +34,7 @@ import org.apache.commons.collections.Predicate;
* threw an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @author Stephen Kestle
* @version $Id$
*/
public final class AllPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
@ -54,6 +50,7 @@ public final class AllPredicate<T> implements Predicate<T>, PredicateDecorator<T
* If the array is size zero, the predicate always returns true.
* If the array is size one, then that predicate is returned.
*
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
* @throws IllegalArgumentException if the predicates array is null
@ -77,6 +74,7 @@ public final class AllPredicate<T> implements Predicate<T>, PredicateDecorator<T
* If the collection is size zero, the predicate always returns true.
* If the collection is size one, then that predicate is returned.
*
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
* @throws IllegalArgumentException if the predicates array is null

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns true if both the predicates return true.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class AndPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
@ -41,6 +39,7 @@ public final class AndPredicate<T> implements Predicate<T>, PredicateDecorator<T
/**
* Factory to create the predicate.
*
* @param <T> the type that the predicate queries
* @param predicate1 the first predicate to check, not null
* @param predicate2 the second predicate to check, not null
* @return the <code>and</code> predicate

View File

@ -30,10 +30,7 @@ import org.apache.commons.collections.Predicate;
* threw an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @version $Id$
*/
public final class AnyPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
@ -49,6 +46,7 @@ public final class AnyPredicate<T> implements Predicate<T>, PredicateDecorator<T
* If the array is size zero, the predicate always returns false.
* If the array is size one, then that predicate is returned.
*
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>any</code> predicate
* @throws IllegalArgumentException if the predicates array is null
@ -72,6 +70,7 @@ public final class AnyPredicate<T> implements Predicate<T>, PredicateDecorator<T
* If the collection is size zero, the predicate always returns false.
* If the collection is size one, then that predicate is returned.
*
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
* @throws IllegalArgumentException if the predicates array is null

View File

@ -44,7 +44,7 @@ import org.apache.commons.collections.FunctorException;
* </pre>
*
* @since 4.0
* @version $Revision$
* @version $Id$
*/
public abstract class CatchAndRethrowClosure<E> implements Closure<E> {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Closure;
* Closure implementation that chains the specified closures together.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ChainedClosure<E> implements Closure<E>, Serializable {
@ -40,6 +38,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
/**
* Factory method that performs validation and copies the parameter array.
*
* @param <E> the type that the closure acts on
* @param closures the closures to chain, copied, no nulls
* @return the <code>chained</code> closure
* @throws IllegalArgumentException if the closures array is null
@ -58,6 +57,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
* result into the next closure. The ordering is that of the iterator()
* method on the collection.
*
* @param <E> the type that the closure acts on
* @param closures a collection of closures to chain
* @return the <code>chained</code> closure
* @throws IllegalArgumentException if the closures collection is null

View File

@ -28,9 +28,7 @@ import org.apache.commons.collections.Transformer;
* is passed to the second transformer and so on.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ChainedTransformer<T> implements Transformer<T, T>, Serializable {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* Clone is performed using <code>PrototypeFactory.getInstance(input).create()</code>.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class CloneTransformer<T> implements Transformer<T, T>, Serializable {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* and then returns the input.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ClosureTransformer<T> implements Transformer<T, T>, Serializable {

View File

@ -74,9 +74,7 @@ import org.apache.commons.collections.Predicate;
* return <code>true</code> if the comparator returns a value greater than <code>0</code>.
*
* @since 4.0
* @version $Revision$
*
* @author Rune Peter Bjørnstad.
* @version $Id$
*/
public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
@ -100,6 +98,7 @@ public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
/**
* Factory to create the comparator predicate
*
* @param <T> the type that the predicate queries
* @param object the object to compare to
* @param comparator the comparator to use for comparison
* @return the predicate
@ -112,6 +111,7 @@ public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
/**
* Factory to create the comparator predicate
*
* @param <T> the type that the predicate queries
* @param object the object to compare to
* @param comparator the comparator to use for comparison
* @param criterion the criterion to use to evaluate comparison
@ -156,7 +156,7 @@ public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
*
* @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
* @see java.util.Comparator#compare(java.lang.Object first, java.lang.Object second)
*
*
* @throws IllegalStateException if the criterion is invalid (really not possible)
*/
public boolean evaluate(T target) {

View File

@ -28,9 +28,7 @@ import org.apache.commons.collections.Factory;
* use the prototype factory.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ConstantFactory<T> implements Factory<T>, Serializable {

View File

@ -28,9 +28,7 @@ import org.apache.commons.collections.Transformer;
* use the prototype factory.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializable {

View File

@ -21,7 +21,7 @@ package org.apache.commons.collections.functors;
*
* @param <T>
* @since 4.0
* @version $Revision$
* @version $Id$
*/
public class DefaultEquator<T> implements Equator<T> {
/** Static instance */

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Predicate;
* as the one stored in this predicate by equals.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class EqualPredicate<T> implements Predicate<T>, Serializable {

View File

@ -10,8 +10,6 @@
*/
package org.apache.commons.collections.functors;
import org.apache.commons.collections.map.HashedMap;
/**
* <p>
* An equation function, which determines equality between objects of type T.
@ -22,9 +20,8 @@ import org.apache.commons.collections.map.HashedMap;
* </p>
*
* @param <T> the types of object this {@link Equator} can evaluate.
* @author Stephen Kestle
* @since 4.0
* @version $Revision$
* @version $Id$
*/
public interface Equator<T> {
/**
@ -40,7 +37,7 @@ public interface Equator<T> {
* Calculates the hash for the object, based on the method of equality used in the equate
* method. This is used for classes that delegate their {@link Object#equals(Object) equals(Object)} method to an
* Equator (and so must also delegate their {@link Object#hashCode() hashCode()} method), or for implementations
* of {@link HashedMap} that use an Equator for the key objects.
* of {@link org.apache.commons.collections.map.HashedMap} that use an Equator for the key objects.
*
* @param o the object to calculate the hash for.
* @return the hash of the object.

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.FunctorException;
* Closure implementation that always throws an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class ExceptionClosure<E> implements Closure<E>, Serializable {
@ -40,6 +38,7 @@ public final class ExceptionClosure<E> implements Closure<E>, Serializable {
/**
* Factory returning the singleton instance.
*
* @param <E> the type that the closure acts on
* @return the singleton instance
* @since 3.1
*/

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.FunctorException;
* Factory implementation that always throws an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class ExceptionFactory<T> implements Factory<T>, Serializable {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that always throws an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class ExceptionPredicate<T> implements Predicate<T>, Serializable {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that always throws an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Serializable {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that calls a Factory and returns the result.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class FactoryTransformer<I, O> implements Transformer<I, O>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that always returns false.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class FalsePredicate<T> implements Predicate<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Closure;
* Closure implementation that calls another closure n times, like a for loop.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class ForClosure<E> implements Closure<E>, Serializable {
@ -44,6 +42,7 @@ public class ForClosure<E> implements Closure<E>, Serializable {
* A null closure or zero count returns the <code>NOPClosure</code>.
* A count of one returns the specified closure.
*
* @param <E> the type that the closure acts on
* @param count the number of times to execute the closure
* @param closure the closure to execute, not null
* @return the <code>for</code> closure

View File

@ -26,10 +26,7 @@ import org.apache.commons.collections.Transformer;
* Internal utilities for functors.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @version $Id$
*/
class FunctorUtils {
@ -84,7 +81,8 @@ class FunctorUtils {
}
for (int i = 0; i < predicates.length; i++) {
if (predicates[i] == null) {
throw new IllegalArgumentException("The predicate array must not contain a null predicate, index " + i + " was null");
throw new IllegalArgumentException(
"The predicate array must not contain a null predicate, index " + i + " was null");
}
}
}

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Predicate;
* as the one stored in this predicate.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class IdentityPredicate<T> implements Predicate<T>, Serializable {

View File

@ -26,10 +26,7 @@ import org.apache.commons.collections.Predicate;
* based on a predicate.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @version $Id$
*/
public class IfClosure<E> implements Closure<E>, Serializable {
@ -49,6 +46,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
* This factory creates a closure that performs no action when
* the predicate is false.
*
* @param <E> the type that the closure acts on
* @param predicate predicate to switch on
* @param trueClosure closure used if true
* @return the <code>if</code> closure
@ -62,13 +60,16 @@ public class IfClosure<E> implements Closure<E>, Serializable {
/**
* Factory method that performs validation.
*
* @param <E> the type that the closure acts on
* @param predicate predicate to switch on
* @param trueClosure closure used if true
* @param falseClosure closure used if false
* @return the <code>if</code> closure
* @throws IllegalArgumentException if any argument is null
*/
public static <E> Closure<E> ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure) {
public static <E> Closure<E> ifClosure(Predicate<? super E> predicate,
Closure<? super E> trueClosure,
Closure<? super E> falseClosure) {
if (predicate == null) {
throw new IllegalArgumentException("Predicate must not be null");
}

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Predicate;
* the type stored in this predicate.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class InstanceofPredicate implements Predicate<Object>, Serializable {

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.FunctorException;
* Factory implementation that creates a new object instance by reflection.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class InstantiateFactory<T> implements Factory<T>, Serializable {

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that creates a new object instance by reflection.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class InstantiateTransformer<T> implements Transformer<Class<? extends T>, T>, Serializable {

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that creates a new object instance by reflection.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class InvokerTransformer<I, O> implements Transformer<I, O>, Serializable {
@ -126,11 +124,14 @@ public class InvokerTransformer<I, O> implements Transformer<I, O>, Serializable
Method method = cls.getMethod(iMethodName, iParamTypes);
return (O) method.invoke(input, iArgs);
} catch (NoSuchMethodException ex) {
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist");
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" +
input.getClass() + "' does not exist");
} catch (IllegalAccessException ex) {
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' cannot be accessed");
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" +
input.getClass() + "' cannot be accessed");
} catch (InvocationTargetException ex) {
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' threw an exception", ex);
throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" +
input.getClass() + "' threw an exception", ex);
}
}

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* using the input parameter as a key.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class MapTransformer<I, O> implements Transformer<I, O>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Closure;
* Closure implementation that does nothing.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NOPClosure<E> implements Closure<E>, Serializable {
@ -39,6 +37,7 @@ public final class NOPClosure<E> implements Closure<E>, Serializable {
/**
* Factory returning the singleton instance.
*
* @param <E> the type that the closure acts on
* @return the singleton instance
* @since 3.1
*/

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that does nothing.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class NOPTransformer<T> implements Transformer<T, T>, Serializable {

View File

@ -30,10 +30,7 @@ import org.apache.commons.collections.Predicate;
* threw an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @version $Id$
*/
public final class NonePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns true if the input is not null.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NotNullPredicate<T> implements Predicate<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns the opposite of the decorated predicate.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NotPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that throws an exception if the input is null.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NullIsExceptionPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns false if the input is null.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NullIsFalsePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns true if the input is null.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NullIsTruePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns true if the input is null.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class NullPredicate<T> implements Predicate<T>, Serializable {

View File

@ -30,10 +30,7 @@ import org.apache.commons.collections.Predicate;
* threw an exception.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @version $Id$
*/
public final class OnePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,9 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that returns true if either of the predicates return true.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class OrPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -24,10 +24,7 @@ import org.apache.commons.collections.Predicate;
* This interface enables tools to access the decorated predicates.
*
* @since 3.1
* @version $Revision$
*
* @author Stephen Colebourne
* @author Stephen Kestle
* @version $Id$
*/
public interface PredicateDecorator<T> extends Predicate<T> {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* and then returns the result.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class PredicateTransformer<T> implements Transformer<T, Boolean>, Serializable {

View File

@ -32,9 +32,7 @@ import org.apache.commons.collections.FunctorException;
* Factory implementation that creates a new instance each time based on a prototype.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class PrototypeFactory {

View File

@ -25,9 +25,7 @@ import org.apache.commons.collections.Transformer;
* <code>String.valueOf</code> on the input object.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class StringValueTransformer<T> implements Transformer<T, String>, Serializable {

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Predicate;
* like a switch statement.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class SwitchClosure<E> implements Closure<E>, Serializable {
@ -46,6 +44,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
/**
* Factory method that performs validation and copies the parameter arrays.
*
* @param <E> the type that the closure acts on
* @param predicates array of predicates, cloned, no nulls
* @param closures matching array of closures, cloned, no nulls
* @param defaultClosure the closure to use if no match, null means nop
@ -54,7 +53,9 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
* @throws IllegalArgumentException if any element in the array is null
*/
@SuppressWarnings("unchecked")
public static <E> Closure<E> switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure) {
public static <E> Closure<E> switchClosure(Predicate<? super E>[] predicates,
Closure<? super E>[] closures,
Closure<? super E> defaultClosure) {
FunctorUtils.validate(predicates);
FunctorUtils.validate(closures);
if (predicates.length != closures.length) {
@ -77,6 +78,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
* null key. The ordering is that of the iterator() method on the entryset
* collection of the map.
*
* @param <E> the type that the closure acts on
* @param predicatesAndClosures a map of predicates to closures
* @return the <code>switch</code> closure
* @throws IllegalArgumentException if the map is null
@ -114,7 +116,8 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
* @param defaultClosure the closure to use if no match, null means nop
*/
@SuppressWarnings("unchecked")
public SwitchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure) {
public SwitchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures,
Closure<? super E> defaultClosure) {
super();
iPredicates = predicates;
iClosures = closures;

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Transformer;
* like a switch statement.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* another <code>Predicate</code>.
*
* @since 3.1
* @version $Revision$
* @author Alban Peignier
* @author Stephen Colebourne
* @version $Id$
*/
public final class TransformedPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* and ignore the result.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class TransformerClosure<E> implements Closure<E>, Serializable {
@ -43,6 +41,7 @@ public class TransformerClosure<E> implements Closure<E>, Serializable {
* <p>
* A null transformer will return the <code>NOPClosure</code>.
*
* @param <E> the type that the closure acts on
* @param transformer the transformer to call, null means nop
* @return the <code>transformer</code> closure
*/

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Transformer;
* Predicate implementation that returns the result of a transformer.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class TransformerPredicate<T> implements Predicate<T>, Serializable {

View File

@ -24,10 +24,7 @@ import org.apache.commons.collections.Predicate;
* Predicate implementation that always returns true.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Stephen Kestle
* @version $Id$
*/
public final class TruePredicate<T> implements Predicate<T>, Serializable {

View File

@ -27,9 +27,7 @@ import org.apache.commons.collections.Predicate;
* passed into the predicate.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public final class UniquePredicate<T> implements Predicate<T>, Serializable {

View File

@ -26,9 +26,7 @@ import org.apache.commons.collections.Predicate;
* like a do-while or while loop.
*
* @since 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class WhileClosure<E> implements Closure<E>, Serializable {
@ -45,13 +43,15 @@ public class WhileClosure<E> implements Closure<E>, Serializable {
/**
* Factory method that performs validation.
*
* @param <E> the type that the closure acts on
* @param predicate the predicate used to evaluate when the loop terminates, not null
* @param closure the closure the execute, not null
* @param doLoop true to act as a do-while loop, always executing the closure once
* @return the <code>while</code> closure
* @throws IllegalArgumentException if the predicate or closure is null
*/
public static <E> Closure<E> whileClosure(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop) {
public static <E> Closure<E> whileClosure(Predicate<? super E> predicate,
Closure<? super E> closure, boolean doLoop) {
if (predicate == null) {
throw new IllegalArgumentException("Predicate must not be null");
}

View File

@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This package contains implementations of the
* {@link org.apache.commons.collections.Closure Closure},
* {@link org.apache.commons.collections.Predicate Predicate},
* {@link org.apache.commons.collections.Transformer Transformer} and
* {@link org.apache.commons.collections.Factory Factory} interfaces.
* These provide simple callbacks for processing with collections.
*
* @version $Id$
*/
package org.apache.commons.collections.functors;

View File

@ -1,27 +0,0 @@
<!-- $Id$ -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<BODY>
<p>
This package contains implementations of the
{@link org.apache.commons.collections.Closure Closure},
{@link org.apache.commons.collections.Predicate Predicate},
{@link org.apache.commons.collections.Transformer Transformer} and
{@link org.apache.commons.collections.Factory Factory} interfaces.
These provide simple callbacks for processing with collections.
</p>
</BODY>