|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttom.library.sl.AbstractStrategy
public abstract class AbstractStrategy
Partial implementation of the strategy interface that implements
most of the visit
methods. This class is extended by
the two abstract classes AbstractStrategyBasic
and
AbstractStrategyCombinator
that can be used to
implement respectively new basic transformations (like a rewrite
rule system) and new strategy combinators (like the
All
strategy).
It is not advised to implement directly this abstract class.
Field Summary | |
---|---|
protected Environment |
environment
Environment of the strategy application |
Constructor Summary | |
---|---|
AbstractStrategy()
|
Method Summary | ||
---|---|---|
Object |
getAncestor()
Get the current ancestor |
|
Environment |
getEnvironment()
Get a reference to the current environment. |
|
Position |
getPosition()
Get the current position |
|
Object |
getRoot()
Get the current root. |
|
Object |
getSubject()
Get the current subject |
|
void |
init(Introspector introspector)
Initialize the Strategy |
|
static void |
init(Strategy s,
Environment env)
Initialize the Strategy by providing the environment and the strategy |
|
void |
setEnvironment(Environment env)
Set up a new environment. |
|
void |
setRoot(Object any)
Set up the current root. |
|
void |
setSubject(Object any)
Set up the current subject |
|
|
visit(Environment envt)
Executes the strategy in the given environment (on its current subject). |
|
Object |
visit(Environment envt,
Introspector i)
Executes the strategy in the given environment (on its current subject). |
|
|
visit(T any)
Visits the subject any by providing the environment |
|
|
visit(T any,
Introspector i)
Visits the subject any by providing the introspector |
|
|
visitLight(T any)
Visits the subject any in a light way (without environment) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface tom.library.sl.Strategy |
---|
visit, visitLight |
Methods inherited from interface tom.library.sl.Visitable |
---|
getChildAt, getChildCount, getChildren, setChildAt, setChildren |
Field Detail |
---|
protected Environment environment
Constructor Detail |
---|
public AbstractStrategy()
Method Detail |
---|
public <T extends Visitable> T visit(Environment envt) throws VisitFailure
visit
in interface Strategy
envt
- the environment where execute the strategy.
VisitFailure
- if visit failspublic <T extends Visitable> T visit(T any) throws VisitFailure
visit
in interface Strategy
any
- the subject to visit.
VisitFailure
- if visit failspublic Object visit(Environment envt, Introspector i) throws VisitFailure
visit
in interface Strategy
envt
- the environment where execute the strategy.i
- the introspector
VisitFailure
- if visit failspublic <T extends Visitable> T visitLight(T any) throws VisitFailure
visitLight
in interface Strategy
any
- the subject to visit
VisitFailure
- if visitLight failspublic <T> T visit(T any, Introspector i) throws VisitFailure
visit
in interface Strategy
any
- the subject to visit.i
- the introspector
VisitFailure
- if visit failspublic Environment getEnvironment()
getEnvironment
in interface Strategy
RuntimeException
- if the environment is not initializedpublic void setEnvironment(Environment env)
setEnvironment
in interface Strategy
env
- the environment to set up.public Object getRoot()
public void setRoot(Object any)
any
- the current rootpublic Object getSubject()
public void setSubject(Object any)
any
- the subject to set uppublic Position getPosition()
public Object getAncestor()
public void init(Introspector introspector)
public static void init(Strategy s, Environment env)
s
- the strategyenv
- the environment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |