net.sf.jga.fn.algorithm
public class Find<T> extends AbstractUnaryFunctor<Iterator<? extends T>,FindIterator<T>> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | Find.Visitor
Interface for classes that may interpret an Find functor. |
Constructor Summary | |
---|---|
Find(T value)
Builds a Find functor that looks for the given value, using the value's
equals() method. | |
Find(Equality<T> eq, T value)
Builds a Find functor that looks for the given value, using the given
Equality predicate. | |
Find(UnaryFunctor<T,Boolean> eq)
Builds a Find functor that looks for values for which the given predicate
returns TRUE. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(Find) method, if it
implements the nested Visitor interface. |
FindIterator<T> | fn(Iterator<? extends T> iterator)
Locates the first/next element that meets the given criteria. |
UnaryFunctor<T,Boolean> | getComparisonFn()
Returns the functor used to determine if an element is the one being
searched for. |
String | toString() |
visit(Find)
method, if it
implements the nested Visitor interface.Returns: an Iterator whose next() [if it hasNext()] will return an element that meets the given criteria. If no such element exists, then the returned iterator's hasNext() is false.