tom.library.sl
Class AbstractStrategyBasic

java.lang.Object
  extended by tom.library.sl.AbstractStrategy
      extended by tom.library.sl.AbstractStrategyBasic
All Implemented Interfaces:
Strategy, Visitable
Direct Known Subclasses:
CFGViewer.AllCfg, CFGViewer.Assign, CFGViewer.BuildLabelMap, CFGViewer.IsMarked, CFGViewer.Mark, CFGViewer.OneCfg, CFGViewer.PrintDotLink, CFGViewer.PrintDotNode, CFGViewer.UnMark, ToolBox.BuildDescriptor, Viewer.RemoveMu

public abstract class AbstractStrategyBasic
extends AbstractStrategy

Partial implementation of the strategy interface that can be used to implement new basic transformations (like a rewrite rule system). This class has an attribute of type Strategy which corresponds to the default strategy if the transformation system cannot be applied. Note that this abstract class is used to compile the %strategy Tom instruction.


Field Summary
protected  Strategy any
          Default strategy
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment
 
Constructor Summary
AbstractStrategyBasic(Strategy v)
           
 
Method Summary
 Visitable getChildAt(int i)
          Returns the child at the specified position
 int getChildCount()
          Returns the number of children of the current Visitable
 Visitable[] getChildren()
          Returns the list of (non builtin) Visitable children
 Visitable setChildAt(int i, Visitable child)
          Replaces a child at the specified position
 Visitable setChildren(Visitable[] children)
          Replaces all children of any visitable at once, and returns this visitable.
 int visit(Introspector introspector)
          Visit the current subject (found in the environment) and place its result in the environment.
 
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
 
Methods inherited from interface tom.library.sl.Strategy
visitLight
 

Field Detail

any

protected Strategy any
Default strategy

Constructor Detail

AbstractStrategyBasic

public AbstractStrategyBasic(Strategy v)
Method Detail

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

getChildCount

public int getChildCount()
Description copied from interface: Visitable
Returns the number of children of the current Visitable

Returns:
the number of children

getChildAt

public Visitable getChildAt(int i)
Description copied from interface: Visitable
Returns the child at the specified position

Parameters:
i - index of the element to return
Returns:
the child at the specified position in the list

setChildAt

public Visitable setChildAt(int i,
                            Visitable child)
Description copied from interface: Visitable
Replaces a child at the specified position

Parameters:
i - index of the element to return
child - element to set up
Returns:
the current Visitable

getChildren

public Visitable[] getChildren()
Description copied from interface: Visitable
Returns the list of (non builtin) Visitable children

Returns:
an array of Visitable children

setChildren

public Visitable setChildren(Visitable[] children)
Description copied from interface: Visitable
Replaces all children of any visitable at once, and returns this visitable.

Parameters:
children - array of children to set up
Returns:
the current Visitable