net.sf.jga.fn.algorithm
public class FindElement<T> extends AbstractUnaryFunctor<Iterator<? extends T>,FindIterator<T>> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | FindElement.Visitor
Interface for classes that may interpret a FindElement
functor |
Constructor Summary | |
---|---|
FindElement(Collection<? extends T> elements)
Builds a FindElement functor that locates values in the given collection
using the contains() method. | |
FindElement(Collection<? extends T> elements, BinaryFunctor<T,T,Boolean> eq)
Builds a FindElement functor that locates values in the given collection
using the given functor. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(FindElement) method, if it
implements the nested Visitor interface. |
FindIterator<T> | fn(Iterator<? extends T> iterator)
Finds the first/next element in the iteration that is an element of the
given collection.
|
BinaryFunctor<T,T,Boolean> | getComparisonFn()
Returns the (possibly null) functor used to compare a value to the
contents of the given collection. |
Collection<? extends T> | getElementSet()
Returns the set of values being sought. |
String | toString() |
visit(FindElement)
method, if it
implements the nested Visitor interface.Returns: an iterator whose next() [if it hasNext()] points to the next element in the iteration that is an element of the given collection. If no such element exists, then the returned iterator's hasNext() will be false.