tom.library.sl
Class Sequence

java.lang.Object
  extended by tom.library.sl.AbstractStrategy
      extended by tom.library.sl.AbstractStrategyCombinator
          extended by tom.library.sl.Sequence
All Implemented Interfaces:
Strategy, Visitable

public class Sequence
extends AbstractStrategyCombinator

Sequence(v1,v2)[t] = v2[v1[t]] if v1 succeeds

fails otherwise

Strategy combinator with two arguments, that applies these arguments one after the other (sequential composition).


Field Summary
static int FIRST
           
static int THEN
           
 
Fields inherited from class tom.library.sl.AbstractStrategyCombinator
arguments
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment
 
Method Summary
static Strategy make(Strategy first, Strategy then)
           
 int visit(Introspector introspector)
          Visit the current subject (found in the environment) and place its result in the environment.
<T> T
visitLight(T visitable, Introspector introspector)
          Visit the subject any in a light way (without environment)
 
Methods inherited from class tom.library.sl.AbstractStrategyCombinator
getChildAt, getChildCount, getChildren, getVisitor, getVisitors, initSubterm, initSubterm, initSubterm, initSubterm, initSubterm, setChildAt, setChildren
 
Methods inherited from class tom.library.sl.AbstractStrategy
getAncestor, getEnvironment, getPosition, getRoot, getSubject, init, init, setEnvironment, setRoot, setSubject, visit, visit, visit, visit, visitLight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST

public static final int FIRST
See Also:
Constant Field Values

THEN

public static final int THEN
See Also:
Constant Field Values
Method Detail

make

public static Strategy make(Strategy first,
                            Strategy then)

visitLight

public <T> T visitLight(T visitable,
                        Introspector introspector)
             throws VisitFailure
Description copied from interface: Strategy
Visit the subject any in a light way (without environment)

Parameters:
visitable - the subject to visit.
Throws:
VisitFailure - in case of failure.

visit

public int visit(Introspector introspector)
Description copied from interface: Strategy
Visit the current subject (found in the environment) and place its result in the environment. Sets the environment flag to Environment.FAILURE in case of failure

Parameters:
introspector - the introspector