tom.library.sl
Class Fail
java.lang.Object
tom.library.sl.AbstractStrategy
tom.library.sl.AbstractStrategyCombinator
tom.library.sl.Fail
- All Implemented Interfaces:
- Strategy, Visitable
public class Fail
- extends AbstractStrategyCombinator
x.accept(Fail)
always raises a VisitFailure exception.
Strategy combinator without arguments, that always fails.
Test case documentation:
FailTest
Constructor Summary |
Fail()
Construct Fail combinator with empty failure message. |
Fail(String message)
Construct Fail combinator with a failure message to be passed to the
VisitFailure that it throws. |
Method Summary |
int |
visit(Introspector introspector)
Visit the current subject (found in the environment)
and place its result in the environment. |
|
visitLight(T any,
Introspector introspector)
Visit the subject any in a light way (without environment) |
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 |
Fail
public Fail()
- Construct Fail combinator with empty failure message.
Fail
public Fail(String message)
- Construct Fail combinator with a failure message to be passed to the
VisitFailure that it throws.
visitLight
public <T> T visitLight(T any,
Introspector introspector)
throws VisitFailure
- Description copied from interface:
Strategy
- Visit 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(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