edu.neu.ccs.demeterf.compose
Class CompTraversal

java.lang.Object
  extended by edu.neu.ccs.demeterf.compose.CompTraversal

public class CompTraversal
extends java.lang.Object

Traverses an Object structure using Functors: combined Function Classes that know what to do. The constructors take any number of Functors or unwrapped function objects. During traversal, the first function object is treated normally, possibly with a traversal argument. All others receive the previous Functor's result as a final combine argument.

See Compose for an example.


Constructor Summary
CompTraversal(FC... fs)
          Create a Traversal that goes Everywhere using any number of function objects
CompTraversal(FC[] fs, Control c)
          Create a Traversal with traversal control using any number of function objects
CompTraversal(Functor... fs)
          Create a Traversal that goes Everywhere using any number of Functors
CompTraversal(Functor[] fs, Control c)
          Create a Traversal with traversal control, using any number of Functors
 
Method Summary
 java.lang.Object[] traverse(java.lang.Object o)
          Do the Traversal...
 java.lang.Object[] traverse(java.lang.Object o, java.lang.Object a)
          Do the Traversal...
<T> T
traverseLast(java.lang.Object o)
          Do the Traversal...
<T> T
traverseLast(java.lang.Object o, java.lang.Object arg)
          Do the Traversal...
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompTraversal

public CompTraversal(Functor... fs)
Create a Traversal that goes Everywhere using any number of Functors


CompTraversal

public CompTraversal(Functor[] fs,
                     Control c)
Create a Traversal with traversal control, using any number of Functors


CompTraversal

public CompTraversal(FC... fs)
Create a Traversal that goes Everywhere using any number of function objects


CompTraversal

public CompTraversal(FC[] fs,
                     Control c)
Create a Traversal with traversal control using any number of function objects

Method Detail

traverseLast

public <T> T traverseLast(java.lang.Object o)
Do the Traversal... No arguments, but only return the last result


traverseLast

public <T> T traverseLast(java.lang.Object o,
                          java.lang.Object arg)
Do the Traversal... With an argument, but only return the last result


traverse

public java.lang.Object[] traverse(java.lang.Object o)
Do the Traversal... No arguments, return all the results


traverse

public java.lang.Object[] traverse(java.lang.Object o,
                                   java.lang.Object a)
Do the Traversal... With an argument, return all the results