net.sf.jga.fn.algorithm
Class Count<T>

java.lang.Object
  extended by net.sf.jga.fn.Functor<R>
      extended by net.sf.jga.fn.UnaryFunctor<java.util.Iterator<? extends T>,java.lang.Long>
          extended by net.sf.jga.fn.algorithm.Count<T>
All Implemented Interfaces:
java.io.Serializable, Visitable

Deprecated. This functionality is moved into Summarize

public class Count<T>
extends UnaryFunctor<java.util.Iterator<? extends T>,java.lang.Long>

Counts values in an iteration.

Copyright © 2003-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface Count.Visitor
          Deprecated. Interface for classes that may interpret an Count functor.
 
Constructor Summary
Count(Equality<T> eq, T value)
          Deprecated. Builds a Count functor that counts instances of a specific value in an iteration, using the given Equality predicate.
Count(T value)
          Deprecated. 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)
          Deprecated. Builds a Count functor that counts instances in an iteration for which the given predicate is true
 
Method Summary
 void accept(Visitor v)
          Deprecated. Calls the Visitor's visit(Count) method, if it implements the nested Visitor interface.
 java.lang.Long fn(java.util.Iterator<? extends T> iterator)
          Deprecated. Returns the number of elements in the iteration that meet the given criteria.
 UnaryFunctor<T,java.lang.Boolean> getComparisonFn()
          Deprecated. Returns the predicate used to determine if an element should be counted.
 java.lang.String toString()
          Deprecated.  
 
Methods inherited from class net.sf.jga.fn.UnaryFunctor
bind, bind0th, bindNth, compose, compose, compose, composeNth, composeNth, eval, generate, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Count

public Count(T value)
Deprecated. 
Builds a Count functor that counts instances of a specific value in an iteration, using the value's equals() method.


Count

public Count(Equality<T> eq,
             T value)
Deprecated. 
Builds a Count functor that counts instances of a specific value in an iteration, using the given Equality predicate.


Count

public Count(UnaryFunctor<T,java.lang.Boolean> eq)
Deprecated. 
Builds a Count functor that counts instances in an iteration for which the given predicate is true

Method Detail

getComparisonFn

public UnaryFunctor<T,java.lang.Boolean> getComparisonFn()
Deprecated. 
Returns the predicate used to determine if an element should be counted.


fn

public java.lang.Long fn(java.util.Iterator<? extends T> iterator)
Deprecated. 
Returns the number of elements in the iteration that meet the given criteria.

Specified by:
fn in class UnaryFunctor<java.util.Iterator<? extends T>,java.lang.Long>

accept

public void accept(Visitor v)
Deprecated. 
Calls the Visitor's visit(Count) method, if it implements the nested Visitor interface.

Specified by:
accept in interface Visitable
Overrides:
accept in class Functor<java.lang.Long>

toString

public java.lang.String toString()
Deprecated. 
Overrides:
toString in class java.lang.Object


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