tom.library.sl
Class OneId

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

public class OneId
extends AbstractStrategy

T(t1,...,ti,...,tN).accept(OneId(v)) = T(t1,...,ti.accept(v),...,tN) if ti is the first child that is modified.

Basic visitor combinator with one visitor argument, that applies this visitor to exactly one child. If no children are visited successfully, then OneId(v) fails.

Note that side-effects of failing visits to children are not undone.


Field Summary
static int ARG
           
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment, visitors
 
Constructor Summary
OneId(Strategy v)
           
 
Method Summary
 int visit()
          Visits the current subject (found in the environment) and place its result in the environment.
 Visitable visitLight(Visitable any)
          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

ARG

public static final int ARG
See Also:
Constant Field Values
Constructor Detail

OneId

public OneId(Strategy v)
Method Detail

visitLight

public Visitable visitLight(Visitable any)
                     throws VisitFailure
Description copied from interface: Strategy
Visits the subject any in a light way (without environment)

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

visit

public int visit()
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