|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.fn.UnaryFunctor<java.util.Iterator<? extends T>,LookAheadIterator<T>>
net.sf.jga.fn.algorithm.LookAheadFunctor<T>
net.sf.jga.fn.algorithm.FindMismatch<T>
public class FindMismatch<T>
Locates the next element in an iteration that is not equal to the corresponding element in a given collection.
To Serialize a FindMismatch, the generic parameter T must be serializable.
Copyright © 2003 David A. Hall
| Nested Class Summary | |
|---|---|
static interface |
FindMismatch.Visitor
Interface for classes that may interpret a FindMismatch functor |
| Constructor Summary | |
|---|---|
FindMismatch(java.util.Collection<? extends T> elements)
Builds a FindMismatch functor that uses !equals() to compare elements. |
|
FindMismatch(java.util.Collection<? extends T> elements,
BinaryFunctor<T,T,java.lang.Boolean> neq)
Builds a FindMismatch functor that uses the given functor to compare elements. |
|
FindMismatch(java.util.Iterator<? extends T> iter,
BinaryFunctor<T,T,java.lang.Boolean> neq)
Builds one-time use FindMismatch finder that will test against the contents of an iteration rather than a collection. |
|
| Method Summary | |
|---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(FindMismatch) method, if it
implements the nested Visitor interface. |
LookAheadIterator<T> |
fn(java.util.Iterator<? extends T> iterator)
Locates the first/next element in an iteration that is not the same as the corresponding element in the given collection/iteration. |
BinaryFunctor<T,T,java.lang.Boolean> |
getComparisonFn()
Returns the functor that is used to test matching elements |
java.util.Collection<? extends T> |
getElements()
Returns the collection against which the argument will be compared. |
T |
getMismatchedElement()
Returns the mismatched element in the given collection/iteration on the last call to fn(). |
java.lang.String |
toString()
|
| Methods inherited from class net.sf.jga.fn.algorithm.LookAheadFunctor |
|---|
wrap |
| Methods inherited from class net.sf.jga.fn.UnaryFunctor |
|---|
bind, compose, compose, generate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FindMismatch(java.util.Collection<? extends T> elements)
public FindMismatch(java.util.Collection<? extends T> elements,
BinaryFunctor<T,T,java.lang.Boolean> neq)
public FindMismatch(java.util.Iterator<? extends T> iter,
BinaryFunctor<T,T,java.lang.Boolean> neq)
A FindMismatch built this way cannot be used more than once as the contents of the iteration will be consumed in the first execution.
| Method Detail |
|---|
public java.util.Collection<? extends T> getElements()
public BinaryFunctor<T,T,java.lang.Boolean> getComparisonFn()
public T getMismatchedElement()
java.lang.IllegalStateException - if called before a call to fn.public LookAheadIterator<T> fn(java.util.Iterator<? extends T> iterator)
fn in class UnaryFunctor<java.util.Iterator<? extends T>,LookAheadIterator<T>>public void accept(Visitor v)
visit(FindMismatch) method, if it
implements the nested Visitor interface.
accept in interface Visitableaccept in class UnaryFunctor<java.util.Iterator<? extends T>,LookAheadIterator<T>>public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||