|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.fn.Functor<R> net.sf.jga.fn.UnaryFunctor<java.util.Iterator<? extends T>,R> net.sf.jga.fn.algorithm.ForEach<T,R>
Summarize
public class ForEach<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
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 |
---|
public ForEach(UnaryFunctor<T,R> fn)
java.lang.IllegalArgumentException
- if the functor is nullMethod Detail |
---|
public UnaryFunctor<T,R> getFunction()
public R fn(java.util.Iterator<? extends T> iterator)
fn
in class UnaryFunctor<java.util.Iterator<? extends T>,R>
public void accept(Visitor v)
visit(ForEach)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<R>
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 |