net.sf.jga.fn.algorithm
public class FindAdjacent<T> extends AbstractUnaryFunctor<Iterator<? extends T>,LookAheadIterator<T>> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | FindAdjacent.Visitor
Interface for classes that may interpret an FindAdjacent functor. |
Constructor Summary | |
---|---|
FindAdjacent()
Builds a FindAdjacent functor that uses the equals() method to determine
if adjacent values are the same. | |
FindAdjacent(BinaryFunctor<T,T,Boolean> eq)
Builds a FindAdjacent functor that uses the given predicate to determine
if adjacent values are the same. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(FindAdjacent) method, if it
implements the nested Visitor interface. |
LookAheadIterator<T> | fn(Iterator<? extends T> iterator)
Locates the first/next pair of adjacent elements in an iteration that
are the same value. |
BinaryFunctor<T,T,Boolean> | getComparisonFn()
Returns the functor used to determine if two adjacent values are the same |
String | toString() |
visit(FindAdjacent)
method, if it
implements the nested Visitor interface.Returns: an iterator whose next() [if it hasNext()] points to the first of a pair of adjacent equivalent values. If no such pair exists, then the iterator's hasNext() will be false.