net.sf.jga.fn.algorithm
public class Count<T> extends AbstractUnaryFunctor<Iterator<? extends T>,Long> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | Count.Visitor
Interface for classes that may interpret an Count functor. |
Constructor Summary | |
---|---|
Count(T value)
Builds a Count functor that counts instances of a specific value in an
iteration, using the value's equals() method. | |
Count(Equality<T> eq, T value)
Builds a Count functor that counts instances of a specific value in an
iteration, using the given Equality predicate. | |
Count(UnaryFunctor<T,Boolean> eq)
Builds a Count functor that counts instances in an iteration for which
the given predicate is true |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(Count) method, if it
implements the nested Visitor interface. |
Long | fn(Iterator<? extends T> iterator)
Returns the number of elements in the iteration that meet the given
criteria. |
UnaryFunctor<T,Boolean> | getComparisonFn()
Returns the predicate used to determine if an element should be counted. |
String | toString() |
visit(Count)
method, if it
implements the nested Visitor interface.