tom.library.sl
Class One

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

public class One
extends AbstractStrategyCombinator

Basic strategy combinator with one strategy argument s, that applies this strategy s to exactly one child. If for all children the strategy s fails, One(s) fails. Applying One combinator to a constant always fails.

One(s)[f(t1,...,ti,...,tn)]=f(t1,...,ti',...,,tn) if s[t1], ..., s[ti-1] fail and s[ti]=ti'

fails if s[t1],...,s[tn] fail.

One(s)[c] fails if c is a constant


Field Summary
static int ARG
           
 
Fields inherited from class tom.library.sl.AbstractStrategyCombinator
arguments
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment
 
Constructor Summary
One(Strategy v)
           
 
Method Summary
 int visit(Introspector introspector)
          Visits the current subject (found in the environment) and place its result in the environment.
<T> T
visitLight(T any, Introspector introspector)
          Deprecated. use fire() instead
 
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

ARG

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

One

public One(Strategy v)
Method Detail

visitLight

@Deprecated
public <T> T visitLight(T any,
                                   Introspector introspector)
             throws VisitFailure
Deprecated. use fire() instead

Method herited from the apply() method of mutraveler library

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

visit

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

Parameters:
introspector - the introspector