net.sf.jga.fn.algorithm
Class ForEach<T,R>

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

Deprecated. This functionality is moved into Summarize

public class ForEach<T,R>
extends UnaryFunctor<java.util.Iterator<? extends T>,R>

Applies a UnaryFunctor to each element in an iteration, and returns the final result. Each element in the iteration is passed to the functor in turn. The result of the final call to the functor is returned. If the iteration was empty, then the result of this function is null.

Copyright © 2003-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface ForEach.Visitor
          Deprecated. Interface for classes that may interpret an ForEach functor.
 
Constructor Summary
ForEach(UnaryFunctor<T,R> fn)
          Deprecated. Builds a ForEach functor that will use the given functor to process elements in an iteration.
 
Method Summary
 void accept(Visitor v)
          Deprecated. Calls the Visitor's visit(ForEach) method, if it implements the nested Visitor interface.
 R fn(java.util.Iterator<? extends T> iterator)
          Deprecated. Apply the functor to each element in the iteration and return the final result.
 UnaryFunctor<T,R> getFunction()
          Deprecated. Returns the functor used to process elements in an iteration.
 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

ForEach

public ForEach(UnaryFunctor<T,R> fn)
Deprecated. 
Builds a ForEach functor that will use the given functor to process elements in an iteration.

Throws:
java.lang.IllegalArgumentException - if the functor is null
Method Detail

getFunction

public UnaryFunctor<T,R> getFunction()
Deprecated. 
Returns the functor used to process elements in an iteration.


fn

public R fn(java.util.Iterator<? extends T> iterator)
Deprecated. 
Apply the functor to each element in the iteration and return the final result.

Specified by:
fn in class UnaryFunctor<java.util.Iterator<? extends T>,R>
Returns:
the result of the last execution of the functor, or null if the functor is not executed.

accept

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

Specified by:
accept in interface Visitable
Overrides:
accept in class Functor<R>

toString

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


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