tom.library.sl
Class All
java.lang.Object
tom.library.sl.AbstractStrategy
tom.library.sl.All
- All Implemented Interfaces:
- Strategy, Visitable
public class All
- extends AbstractStrategy
Basic strategy combinator with one strategy argument s
, that
applies this strategy s
to all children. If there exists one
child for which the strategy s
fails, All(s)
fails. Applying All
combinator to a constant always
succeeds and behaves like the Identity()
strategy. *
All(s)[f(t1,...,tn)]=f(t1',...,tn')
if s[t1]=t1', ..., s[tn]=tn'
fails if there exists i
such that s[ti]
fails.
All(s)[c]=c
is c
is a constant
Note that this All is parallel in the sense that s is applied to every child
before changing the current subject.
If you are interested in a sequential behaviour, AllSeq
Field Summary |
static int |
ARG
|
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 without managing any 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 |
ARG
public static final int ARG
- See Also:
- Constant Field Values
All
public All(Strategy v)
visitLight
public final Visitable visitLight(Visitable any)
throws VisitFailure
- Visits the subject any without managing any 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