net.sf.jga.algorithms
Class Find

java.lang.Object
  extended by net.sf.jga.algorithms.Find

public class Find
extends java.lang.Object

Algorithms that return an iterator pointing at the first/next element of the input that meets some condition.

NOTE To find and return a value in the input, see the various flavors of Summarize.lookup(Iterable,Object)


Constructor Summary
Find()
           
 
Method Summary
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(java.util.Collection<? extends T> values)
           
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(java.util.Collection<? extends T> values, BinaryFunctor<T,T,java.lang.Boolean> bf)
           
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(java.util.Collection<? extends T> values, java.util.Comparator<? super T> comp)
           
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(T[] values)
           
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(T[] values, BinaryFunctor<T,T,java.lang.Boolean> bf)
           
static
<T> UnaryFunctor<T,java.lang.Boolean>
elementOf(T[] values, java.util.Comparator<? super T> comp)
           
static
<T> java.util.Iterator<T>
find(java.lang.Iterable<? extends T> iter, T value)
          Finds an arbitrary value in the input using the equals() method.
static
<T> java.util.Iterator<T>
find(java.lang.Iterable<? extends T> iter, T value, java.util.Comparator<? super T> comp)
          Finds an arbitrary value in the input using the given Comparator.
static
<T> java.util.Iterator<T>
find(java.lang.Iterable<? extends T> iter, T value, Equality<T> eq)
          Finds an arbitrary value in the input using the given Equality operator.
static
<T> java.util.Iterator<T>
find(java.lang.Iterable<? extends T> iter, UnaryFunctor<T,java.lang.Boolean> fn)
          Finds a value in the input for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
find(java.util.Iterator<? extends T> iterator, T value)
          Finds an arbitrary value in the input using the equals() method.
static
<T> java.util.Iterator<T>
find(java.util.Iterator<? extends T> iterator, T value, java.util.Comparator<? super T> comp)
          Finds an arbitrary value in the input using the given Comparator.
static
<T> java.util.Iterator<T>
find(java.util.Iterator<? extends T> iterator, T value, Equality<T> eq)
          Finds an arbitrary value in the input using the given Equality operator.
static
<T> java.util.Iterator<T>
find(java.util.Iterator<? extends T> iterator, UnaryFunctor<T,java.lang.Boolean> eq)
          Finds a value in the input for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
find(T[] ts, T value)
          Finds an arbitrary value in the array using the equals() method.
static
<T> java.util.Iterator<T>
find(T[] ts, T value, java.util.Comparator<? super T> comp)
          Finds an arbitrary value in the array using the given Comparator.
static
<T> java.util.Iterator<T>
find(T[] ts, T value, Equality<T> eq)
          Finds an arbitrary value in the array using the given Equality operator.
static
<T> java.util.Iterator<T>
find(T[] ts, UnaryFunctor<T,java.lang.Boolean> fn)
          Finds a value in the input for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
findAdjacent(java.lang.Iterable<? extends T> iter)
          Locates the first/next pair of adjacent elements in the input that are the same value, using the equals() method.
static
<T> java.util.Iterator<T>
findAdjacent(java.lang.Iterable<? extends T> iter, BinaryFunctor<T,T,java.lang.Boolean> eq)
          Locates the first/next pair of adjacent elements in the input that are the same value, using the given functor.
static
<T> java.util.Iterator<T>
findAdjacent(java.lang.Iterable<? extends T> iter, java.util.Comparator<? super T> comp)
          Locates the first/next pair of adjacent elements in the input that are the same value, using the given comparator.
static
<T> java.util.Iterator<T>
findAdjacent(java.util.Iterator<? extends T> iterator)
          Locates the first/next pair of adjacent elements in an iteration that are the same value, using the equals() method.
static
<T> java.util.Iterator<T>
findAdjacent(java.util.Iterator<? extends T> iterator, BinaryFunctor<T,T,java.lang.Boolean> eq)
          Locates the first/next pair of adjacent elements in an iteration that are the same value, using the given functor.
static
<T> java.util.Iterator<T>
findAdjacent(java.util.Iterator<? extends T> iterator, java.util.Comparator<? super T> comp)
          Locates the first/next pair of adjacent elements in an iteration that are the same value, using the given comparator.
static
<T> java.util.Iterator<T>
findAdjacent(T[] ts)
          Locates the first/next pair of adjacent elements in the array that are the same value, using the equals() method.
static
<T> java.util.Iterator<T>
findAdjacent(T[] ts, BinaryFunctor<T,T,java.lang.Boolean> eq)
          Locates the first/next pair of adjacent elements in the array that are the same value, using the given functor.
static
<T> java.util.Iterator<T>
findAdjacent(T[] ts, java.util.Comparator<? super T> comp)
          Locates the first/next pair of adjacent elements in the array that are the same value, using the given comparator.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> values)
          Finds first/next value in the input that is an element of the given collection, using the collection's contains() method.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> values, java.util.Comparator<? super T> comp)
          Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, T[] values)
          Finds first/next value in the input that is an element of the given array.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, T[] values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next value in the input that is an element of the given array, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.lang.Iterable<? extends T> iter, T[] values, java.util.Comparator<? super T> comp)
          Finds first/next value in the input that is an element of the given array, using the given Comparator to compare values.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> values)
          Finds first/next value in the input that is an element of the given collection, using the collection's contains() method.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> values, java.util.Comparator<? super T> comp)
          Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, T[] values)
          Finds first/next value in the input that is an element of the given array.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, T[] values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next value in the input that is an element of the given array, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(java.util.Iterator<? extends T> iterator, T[] values, java.util.Comparator<? super T> comp)
          Finds first/next value in the input that is an element of the given array, using the given Comparator to compare values.
static
<T> java.util.Iterator<T>
findElement(T[] ts, java.util.Collection<? extends T> values)
          Finds first/next element in the array that is also in the collection of values, using the collection's contains() method.
static
<T> java.util.Iterator<T>
findElement(T[] ts, java.util.Collection<? extends T> values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next element in the input that is in the values collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(T[] ts, java.util.Collection<? extends T> values, java.util.Comparator<? super T> comp)
          Finds first/next element in the array that is also in the values collection, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(T[] ts, T[] values)
          Finds first/next element in the array that is also in the values array.
static
<T> java.util.Iterator<T>
findElement(T[] ts, T[] values, BinaryFunctor<T,T,java.lang.Boolean> bf)
          Finds first/next element in the array that is also in the values array, using the given functor to compare values.
static
<T> java.util.Iterator<T>
findElement(T[] ts, T[] values, java.util.Comparator<? super T> comp)
          Finds first/next element in the array that is also in the values array, using the given Comparator to compare values.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern)
          Finds the point at which the input differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, T[] pattern)
          Finds the point at which the input differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.lang.Iterable<? extends T> iter, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern)
          Finds the point at which the input differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, T[] pattern)
          Finds the point at which the input differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(java.util.Iterator<? extends T> iterator, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, java.util.Collection<? extends T> pattern)
          Finds the point at which the array differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the array differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, java.util.Collection<? extends T> pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the array differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, T[] pattern)
          Finds the point at which the array differs from the pattern.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> neq)
          Finds the point at which the array differs from the pattern, using the given functor to determine the mismatch.
static
<T> java.util.Iterator<T>
findMismatch(T[] ts, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the point at which the array differs from the pattern, using the given comparator to determine the mismatch.
static
<T> java.util.Iterator<T>
findRepeated(java.lang.Iterable<? extends T> iter, int count, T value)
          Finds first/next arbitrary length run of a given value in the input.
static
<T> java.util.Iterator<T>
findRepeated(java.lang.Iterable<? extends T> iter, int count, T value, java.util.Comparator<? super T> comp)
          Finds first/next arbitrary length run of a given value in the input using the given comparator.
static
<T> java.util.Iterator<T>
findRepeated(java.lang.Iterable<? extends T> iter, int count, T value, Equality<T> eq)
          Finds first/next arbitrary length run of a given value in the input using the given equality function.
static
<T> java.util.Iterator<T>
findRepeated(java.lang.Iterable<? extends T> iter, int count, UnaryFunctor<T,java.lang.Boolean> eq)
          Finds first/next arbitrary length run of elements in the input for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
findRepeated(java.util.Iterator<? extends T> iterator, int count, T value)
          Finds first/next arbitrary length run of a given value in an iteration.
static
<T> java.util.Iterator<T>
findRepeated(java.util.Iterator<? extends T> iterator, int count, T value, java.util.Comparator<? super T> comp)
          Finds first/next arbitrary length run of a given value in an iteration using the given comparator.
static
<T> java.util.Iterator<T>
findRepeated(java.util.Iterator<? extends T> iterator, int count, T value, Equality<T> eq)
          Finds first/next arbitrary length run of a given value in an iteration using the given equality function.
static
<T> java.util.Iterator<T>
findRepeated(java.util.Iterator<? extends T> iterator, int count, UnaryFunctor<T,java.lang.Boolean> eq)
          Finds first/next arbitrary length run of elements in an iteration for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
findRepeated(T[] ts, int count, T value)
          Finds first/next arbitrary length run of a given value in the input.
static
<T> java.util.Iterator<T>
findRepeated(T[] ts, int count, T value, java.util.Comparator<? super T> comp)
          Finds first/next arbitrary length run of a given value in the input using the given comparator.
static
<T> java.util.Iterator<T>
findRepeated(T[] ts, int count, T value, Equality<T> eq)
          Finds first/next arbitrary length run of a given value in the input using the given equality function.
static
<T> java.util.Iterator<T>
findRepeated(T[] ts, int count, UnaryFunctor<T,java.lang.Boolean> eq)
          Finds first/next arbitrary length run of elements in the input for which the given function returns TRUE.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the input using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, java.util.Collection<? extends T> pattern, java.util.Comparator<T> comp)
          Finds the given pattern in the input using the given comparator to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, T[] pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the input using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.lang.Iterable<? extends T> iter, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the given pattern in the input using the given comparator to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the collection using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, java.util.Collection<? extends T> pattern, java.util.Comparator<T> comp)
          Finds the given pattern in the collection using the given comparator to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, T[] pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the collection using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(java.util.Iterator<? extends T> iterator, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the given pattern in the input using the given comparator to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, java.util.Collection<? extends T> pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, java.util.Collection<? extends T> pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the input using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, java.util.Collection<? extends T> pattern, java.util.Comparator<T> comp)
          Finds the given pattern in the input using the given comparator to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, T[] pattern)
          Finds the given pattern in the input using the equals method.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, T[] pattern, BinaryFunctor<T,T,java.lang.Boolean> fn)
          Finds the given pattern in the input using the given functor to determine equivalence.
static
<T> java.util.Iterator<T>
findSequence(T[] ts, T[] pattern, java.util.Comparator<? super T> comp)
          Finds the given pattern in the input using the given comparator to determine equivalence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Find

public Find()
Method Detail

find

public static <T> java.util.Iterator<T> find(T[] ts,
                                             T value)
Finds an arbitrary value in the array using the equals() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the array, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(T[] ts,
                                             T value,
                                             java.util.Comparator<? super T> comp)
Finds an arbitrary value in the array using the given Comparator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the array, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(T[] ts,
                                             T value,
                                             Equality<T> eq)
Finds an arbitrary value in the array using the given Equality operator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the array, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(T[] ts,
                                             UnaryFunctor<T,java.lang.Boolean> fn)
Finds a value in the input for which the given function returns TRUE.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of such a value. If no such value is in the array, then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    T[] values)
Finds first/next element in the array that is also in the values array.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    java.util.Collection<? extends T> values)
Finds first/next element in the array that is also in the collection of values, using the collection's contains() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the collection of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    T[] values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next element in the array that is also in the values array, using the given Comparator to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    java.util.Collection<? extends T> values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next element in the array that is also in the values collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    T[] values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next element in the array that is also in the values array, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(T[] ts,
                                                    java.util.Collection<? extends T> values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next element in the input that is in the values collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(T[] ts)
Locates the first/next pair of adjacent elements in the array that are the same value, using the equals() method.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(T[] ts,
                                                     java.util.Comparator<? super T> comp)
Locates the first/next pair of adjacent elements in the array that are the same value, using the given comparator.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(T[] ts,
                                                     BinaryFunctor<T,T,java.lang.Boolean> eq)
Locates the first/next pair of adjacent elements in the array that are the same value, using the given functor. The functor should return TRUE when two values are to be considered equal.

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.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(T[] ts,
                                                     int count,
                                                     T value)
Finds first/next arbitrary length run of a given value in the input. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(T[] ts,
                                                     int count,
                                                     T value,
                                                     java.util.Comparator<? super T> comp)
Finds first/next arbitrary length run of a given value in the input using the given comparator. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(T[] ts,
                                                     int count,
                                                     T value,
                                                     Equality<T> eq)
Finds first/next arbitrary length run of a given value in the input using the given equality function. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(T[] ts,
                                                     int count,
                                                     UnaryFunctor<T,java.lang.Boolean> eq)
Finds first/next arbitrary length run of elements in the input for which the given function returns TRUE. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     T[] pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     java.util.Collection<? extends T> pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the given pattern in the input using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<T> comp)
Finds the given pattern in the input using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the input using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(T[] ts,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the input using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     T[] pattern)
Finds the point at which the array differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     java.util.Collection<? extends T> pattern)
Finds the point at which the array differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the array differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the array differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the array differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(T[] ts,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the array differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

find

public static <T> java.util.Iterator<T> find(java.lang.Iterable<? extends T> iter,
                                             T value)
Finds an arbitrary value in the input using the equals() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.lang.Iterable<? extends T> iter,
                                             T value,
                                             java.util.Comparator<? super T> comp)
Finds an arbitrary value in the input using the given Comparator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.lang.Iterable<? extends T> iter,
                                             T value,
                                             Equality<T> eq)
Finds an arbitrary value in the input using the given Equality operator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.lang.Iterable<? extends T> iter,
                                             UnaryFunctor<T,java.lang.Boolean> fn)
Finds a value in the input for which the given function returns TRUE.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    T[] values)
Finds first/next value in the input that is an element of the given array.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    java.util.Collection<? extends T> values)
Finds first/next value in the input that is an element of the given collection, using the collection's contains() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the collection of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    T[] values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next value in the input that is an element of the given array, using the given Comparator to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    java.util.Collection<? extends T> values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    T[] values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next value in the input that is an element of the given array, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.lang.Iterable<? extends T> iter,
                                                    java.util.Collection<? extends T> values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.lang.Iterable<? extends T> iter)
Locates the first/next pair of adjacent elements in the input that are the same value, using the equals() method.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.lang.Iterable<? extends T> iter,
                                                     java.util.Comparator<? super T> comp)
Locates the first/next pair of adjacent elements in the input that are the same value, using the given comparator.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.lang.Iterable<? extends T> iter,
                                                     BinaryFunctor<T,T,java.lang.Boolean> eq)
Locates the first/next pair of adjacent elements in the input that are the same value, using the given functor. The functor should return TRUE when two values are to be considered equal.

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.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.lang.Iterable<? extends T> iter,
                                                     int count,
                                                     T value)
Finds first/next arbitrary length run of a given value in the input. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.lang.Iterable<? extends T> iter,
                                                     int count,
                                                     T value,
                                                     java.util.Comparator<? super T> comp)
Finds first/next arbitrary length run of a given value in the input using the given comparator. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.lang.Iterable<? extends T> iter,
                                                     int count,
                                                     T value,
                                                     Equality<T> eq)
Finds first/next arbitrary length run of a given value in the input using the given equality function. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.lang.Iterable<? extends T> iter,
                                                     int count,
                                                     UnaryFunctor<T,java.lang.Boolean> eq)
Finds first/next arbitrary length run of elements in the input for which the given function returns TRUE. Runs of length zero are well-defined: every input begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the given pattern in the input using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<T> comp)
Finds the given pattern in the input using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the input using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the input using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern)
Finds the point at which the input differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern)
Finds the point at which the input differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the input but is longer, the returned iterator's hasNext() will report false. If the pattern matches the input but is shorter, the returned iterator will point at the next element in the input after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the input but is longer, the returned iterator's hasNext() will report false. If the pattern matches the input but is shorter, the returned iterator will point at the next element in the input after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.lang.Iterable<? extends T> iter,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern.

find

public static <T> java.util.Iterator<T> find(java.util.Iterator<? extends T> iterator,
                                             T value)
Finds an arbitrary value in the input using the equals() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.util.Iterator<? extends T> iterator,
                                             T value,
                                             java.util.Comparator<? super T> comp)
Finds an arbitrary value in the input using the given Comparator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.util.Iterator<? extends T> iterator,
                                             T value,
                                             Equality<T> eq)
Finds an arbitrary value in the input using the given Equality operator.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of the value. If the value is not in the input, then the returned iterator's hasNext() will report false.

find

public static <T> java.util.Iterator<T> find(java.util.Iterator<? extends T> iterator,
                                             UnaryFunctor<T,java.lang.Boolean> eq)
Finds a value in the input for which the given function returns TRUE.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of such a value. If no such value is in the input, then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    T[] values)
Finds first/next value in the input that is an element of the given array.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    java.util.Collection<? extends T> values)
Finds first/next value in the input that is an element of the given collection, using the collection's contains() method.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the collection of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    T[] values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next value in the input that is an element of the given array, using the given Comparator to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    java.util.Collection<? extends T> values,
                                                    java.util.Comparator<? super T> comp)
Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    T[] values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next value in the input that is an element of the given array, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in the array of values. If no such element is found then the returned iterator's hasNext() will report false.

findElement

public static <T> java.util.Iterator<T> findElement(java.util.Iterator<? extends T> iterator,
                                                    java.util.Collection<? extends T> values,
                                                    BinaryFunctor<T,T,java.lang.Boolean> bf)
Finds first/next value in the input that is an element of the given collection, using the given functor to compare values.

Returns:
an iterator whose next() [if it hasNext()] will return the first instance of any element found in collection of values. If no such value is found then the returned iterator's hasNext() will report false.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.util.Iterator<? extends T> iterator)
Locates the first/next pair of adjacent elements in an iteration that are the same value, using the equals() method.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.util.Iterator<? extends T> iterator,
                                                     java.util.Comparator<? super T> comp)
Locates the first/next pair of adjacent elements in an iteration that are the same value, using the given comparator.

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.

findAdjacent

public static <T> java.util.Iterator<T> findAdjacent(java.util.Iterator<? extends T> iterator,
                                                     BinaryFunctor<T,T,java.lang.Boolean> eq)
Locates the first/next pair of adjacent elements in an iteration that are the same value, using the given functor. The functor should return TRUE when two values are to be considered equal.

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.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.util.Iterator<? extends T> iterator,
                                                     int count,
                                                     T value)
Finds first/next arbitrary length run of a given value in an iteration. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.util.Iterator<? extends T> iterator,
                                                     int count,
                                                     T value,
                                                     java.util.Comparator<? super T> comp)
Finds first/next arbitrary length run of a given value in an iteration using the given comparator. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.util.Iterator<? extends T> iterator,
                                                     int count,
                                                     T value,
                                                     Equality<T> eq)
Finds first/next arbitrary length run of a given value in an iteration using the given equality function. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findRepeated

public static <T> java.util.Iterator<T> findRepeated(java.util.Iterator<? extends T> iterator,
                                                     int count,
                                                     UnaryFunctor<T,java.lang.Boolean> eq)
Finds first/next arbitrary length run of elements in an iteration for which the given function returns TRUE. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values.

Returns:
an iterator based on the given iterator whose next() [if it hasNext()] will return the first of n adjacent instances of value. If no run of values of the requested length exist in the iteration, then the returned iterator's hasNext() will report false.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern)
Finds the given pattern in the input using the equals method.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the given pattern in the input using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<T> comp)
Finds the given pattern in the collection using the given comparator to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the collection using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findSequence

public static <T> java.util.Iterator<T> findSequence(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> fn)
Finds the given pattern in the collection using the given functor to determine equivalence.

Returns:
an iterator whose next() [if it hasNext()] will return the first element of a sequence that matches the pattern. If no such match is found, then the returned iterator's hasNext() will report false. If the pattern is empty, then the iterator will not be advanced.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern)
Finds the point at which the input differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern. If the pattern is empty, no input will be consumed.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern)
Finds the point at which the input differs from the pattern.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the input but is longer, the returned iterator's hasNext() will report false. If the pattern matches the input but is shorter, the returned iterator will point at the next element in the input after the length of the pattern. If the pattern is empty, no input will be consumed.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern. If the pattern is empty, no input will be consumed.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern,
                                                     java.util.Comparator<? super T> comp)
Finds the point at which the input differs from the pattern, using the given comparator to determine the mismatch.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the input but is longer, the returned iterator's hasNext() will report false. If the pattern matches the input but is shorter, the returned iterator will point at the next element in the input after the length of the pattern. If the pattern is empty, no input will be consumed.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     T[] pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern. If the pattern is empty, no input will be consumed.

findMismatch

public static <T> java.util.Iterator<T> findMismatch(java.util.Iterator<? extends T> iterator,
                                                     java.util.Collection<? extends T> pattern,
                                                     BinaryFunctor<T,T,java.lang.Boolean> neq)
Finds the point at which the input differs from the pattern, using the given functor to determine the mismatch. The functor should return TRUE if a given pair of elements does not match.

Returns:
an iterator based whose next() [if it hasNext()] will return the first element which does not match the corresponding element in the pattern. If the pattern matches the array but is longer, the returned iterator's hasNext() will report false. If the pattern matches the array but is shorter, the returned iterator will point at the next element in the array after the length of the pattern. If the pattern is empty, no input will be consumed.

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(T[] values)

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(java.util.Collection<? extends T> values)

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(T[] values,
                                                              java.util.Comparator<? super T> comp)

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(java.util.Collection<? extends T> values,
                                                              java.util.Comparator<? super T> comp)

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(T[] values,
                                                              BinaryFunctor<T,T,java.lang.Boolean> bf)

elementOf

public static <T> UnaryFunctor<T,java.lang.Boolean> elementOf(java.util.Collection<? extends T> values,
                                                              BinaryFunctor<T,T,java.lang.Boolean> bf)


Copyright © 2002-2006 David A. Hall. All Rights Reserved.