tom.library.sl
Class ChoiceUndet
java.lang.Object
tom.library.sl.AbstractStrategy
tom.library.sl.AbstractStrategyCombinator
tom.library.sl.ChoiceUndet
- All Implemented Interfaces:
- Strategy, Visitable
public class ChoiceUndet
- extends AbstractStrategyCombinator
ChoiceUndet(v1,..,vn) = vi
with probability 1/n
Visitor combinator with a list of n arguments,
that select a argument according to the probability 1/n
The strategy fails if the selected strategy fails
Note that any side-effects of vi are not undone when it fails.
Field Summary |
static int |
FIRST
|
static int |
THEN
|
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 |
FIRST
public static final int FIRST
- See Also:
- Constant Field Values
THEN
public static final int THEN
- See Also:
- Constant Field Values
make
public static Strategy make(Strategy first,
Strategy then)
getHead
public Strategy getHead()
getTail
public Strategy getTail()
visitLight
public <T> T visitLight(T subject,
Introspector introspector)
throws VisitFailure
- Description copied from interface:
Strategy
- Visit the subject any in a light way (without environment)
- Parameters:
subject
- 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