net.sf.jga.fn.algorithm
public class FindRepeated<T> extends AbstractUnaryFunctor<Iterator<? extends T>,LookAheadIterator<T>> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | FindRepeated.Visitor
Interface for classes that may interpret an FindRepeated functor. |
Constructor Summary | |
---|---|
FindRepeated(int count, T value)
Builds a FindRepeated functor that will look for a run of the given size,
using the equals() method. | |
FindRepeated(int count, T value, Equality<T> eq)
Builds a FindRepeated functor that will look for a run of the given size,
using the given equality functor. | |
FindRepeated(int count, UnaryFunctor<T,Boolean> eq)
Builds a FindRepeated functor that will look for a run of the given size,
using the given functor. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(FindRepeated) method, if it
implements the nested Visitor interface. |
LookAheadIterator<T> | fn(Iterator<? extends T> iterator)
Locates the first/next run of the given length containing elements that
meet the given criteria. |
UnaryFunctor<T,Boolean> | getComparisonFn()
Returns the functor used to determine if the element should be included
in the run |
int | getRunLength()
Returns the length of the run being sought |
String | toString() |
visit(FindRepeated)
method, if it
implements the nested Visitor interface.Returns: an Iterator whose next() [if it hasNext()] points at the first element in the desired run. If no such run of elements exists, then the returned iterator's hasNext() will be false.