tom.library.sl
Class SequenceId

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

public class SequenceId
extends AbstractStrategy

x.fire(SequenceId (v1,v2)) = x.fire(v1) ; x.fire(v2) if x.fire(v1)!=x

Basic visitor combinator with two visitor arguments, that applies these visitors one after the other (sequential composition), if the first one is not the identity.


Field Summary
static int FIRST
           
static int THEN
           
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment, visitors
 
Constructor Summary
SequenceId(Strategy first, Strategy then)
           
 
Method Summary
 int visit()
          Visits the current subject (found in the environment) and place its result in the environment.
 Visitable visitLight(Visitable visitable)
          Visits the subject any in a light way (without environment)
 
Methods inherited from class tom.library.sl.AbstractStrategy
accept, getChildAt, getChildCount, getChildren, getEnvironment, getRoot, getSubject, init, init, initSubterm, initSubterm, initSubterm, initSubterm, initSubterm, setChildAt, setChildren, setEnvironment, setRoot, setSubject, visit, visit
 
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
Constructor Detail

SequenceId

public SequenceId(Strategy first,
                  Strategy then)
Method Detail

visitLight

public Visitable visitLight(Visitable visitable)
                     throws VisitFailure
Description copied from interface: Strategy
Visits 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()
Description copied from interface: Strategy
Visits 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