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