|
|||||||||
| 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>,TransformIterator<T,T>>
net.sf.jga.fn.algorithm.ReplaceAll<T>
public class ReplaceAll<T>
Replaces all instances in an iteration that pass the given test with the given value.
To Serialize a ReplaceAll, the generic parameter T must be serializable.
Copyright © 2003 David A. Hall
| Nested Class Summary | |
|---|---|
static interface |
ReplaceAll.Visitor
Interface for classes that may interpret an ReplaceAll functor. |
| Constructor Summary | |
|---|---|
ReplaceAll(UnaryFunctor<T,java.lang.Boolean> test,
T value)
Builds an ReplaceAll functor that will apply the given test to elements in an iteration, and replace those elements that pass with the given value. |
|
| Method Summary | |
|---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(ReplaceAll) method, if it
implements the nested Visitor interface. |
TransformIterator<T,T> |
fn(java.util.Iterator<? extends T> iterator)
Apply the functor to each element in the iteration and return an iterator over the results |
UnaryFunctor<T,T> |
getFunction()
Returns the functor used to process elements in an iteration. |
T |
getValue()
Returns the replacement value |
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 ReplaceAll(UnaryFunctor<T,java.lang.Boolean> test,
T value)
java.lang.IllegalArgumentException - if the test is null| Method Detail |
|---|
public UnaryFunctor<T,T> getFunction()
public T getValue()
public TransformIterator<T,T> fn(java.util.Iterator<? extends T> iterator)
fn in class UnaryFunctor<java.util.Iterator<? extends T>,TransformIterator<T,T>>public void accept(Visitor v)
visit(ReplaceAll) method, if it
implements the nested Visitor interface.
accept in interface Visitableaccept in class UnaryFunctor<java.util.Iterator<? extends T>,TransformIterator<T,T>>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 | ||||||||