net.sf.jga.fn.algorithm
public class FindSequence<T> extends AbstractUnaryFunctor<Iterator<? extends T>,LookAheadIterator<T>> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | FindSequence.Visitor
Interface for classes that may interpret a FindSequence
functor |
Constructor Summary | |
---|---|
FindSequence(Collection<? extends T> pattern)
Builds a FindSequence functor that locates the given pattern using the
equals() method to compare elements. | |
FindSequence(Collection<? extends T> pattern, BinaryFunctor<T,T,Boolean> eq)
Builds a FindSequence functor that locates the given pattern using
given functor to compare elements. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(FindSequence) method, if it
implements the nested Visitor interface. |
LookAheadIterator<T> | fn(Iterator<? extends T> iterator)
Locates a sequence that matches the given pattern. |
BinaryFunctor<T,T,Boolean> | getComparisonFn()
Returns the functor used to compare elements in the iteration and
the pattern. |
Collection<? extends T> | getPattern()
Returns the pattern being sought |
String | toString() |
Throws: IllegalArgumentException if the functor is null.
visit(FindSequence)
method, if it
implements the nested Visitor interface.Returns: an iterator whose next() [if it hasNext()] points to the beginning of a sequence in the iteration that matches the given pattern. If no such sequence exists, then the returned interator's hasNext() will be false.