Package org.apache.commons.functor.core
Class Limit
- java.lang.Object
-
- org.apache.commons.functor.core.Limit
-
- All Implemented Interfaces:
BinaryFunctor<java.lang.Object,java.lang.Object>,BinaryPredicate<java.lang.Object,java.lang.Object>,Functor,NullaryFunctor,Predicate,UnaryFunctor<java.lang.Object>,UnaryPredicate<java.lang.Object>
public final class Limit extends java.lang.Object implements Predicate, UnaryPredicate<java.lang.Object>, BinaryPredicate<java.lang.Object,java.lang.Object>
A predicate that returnstruethe first n times it is invoked.- Since:
- 1.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description Limit(int count)Create a new Limit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleantest()Evaluate this predicate.booleantest(java.lang.Object obj)Evaluate this predicate.booleantest(java.lang.Object a, java.lang.Object b)Evaluate this predicate.java.lang.StringtoString()Returns a human readable description of this functor.
-
-
-
Method Detail
-
test
public boolean test()
Evaluate this predicate.
-
test
public boolean test(java.lang.Object obj)
Evaluate this predicate.- Specified by:
testin interfaceUnaryPredicate<java.lang.Object>- Parameters:
obj- the A object to test- Returns:
- the result of this test
-
test
public boolean test(java.lang.Object a, java.lang.Object b)Evaluate this predicate.- Specified by:
testin interfaceBinaryPredicate<java.lang.Object,java.lang.Object>- Parameters:
a- the L element of the ordered pair of argumentsb- the R element of the ordered pair of arguments- Returns:
- the result of this test for the given arguments
-
toString
public java.lang.String toString()
Returns a human readable description of this functor. Implementators are strongly encouraged but not strictly required to override the defaultObjectimplementation of this method.
-
-