tom.library.sl
Class AbstractStrategyCombinator

java.lang.Object
  extended by tom.library.sl.AbstractStrategy
      extended by tom.library.sl.AbstractStrategyCombinator
All Implemented Interfaces:
Strategy, Visitable
Direct Known Subclasses:
All, AllSeq, BuiltinBottomUp, BuiltinRepeat, BuiltinRepeatId, BuiltinTopDown, Choice, ChoiceId, ChoiceUndet, DeRef, Fail, Identity, IfThenElse, Mu, MuVar, Not, Omega, OmegaU, One, OneId, Pselect, Sequence, SequenceId, Up

public abstract class AbstractStrategyCombinator
extends AbstractStrategy

Partial implementation of the strategy interface that can be used to implement new strategy combinators (like the All strategy). This class has an attribute of type Strategy array which corresponds to the combinator arguments. These strategy arguments are also considered as children when visiting this combinator. Note that this abstract class is used to define all the sl strategy combinators.


Field Summary
protected  Strategy[] arguments
          Strategy arguments of the combinator that can be used to define visit methods
 
Fields inherited from class tom.library.sl.AbstractStrategy
environment
 
Constructor Summary
AbstractStrategyCombinator()
           
 
Method Summary
 Visitable getChildAt(int i)
          Returns the Visitable at the specified position in arguments
 int getChildCount()
          Returns the length of arguments
 Visitable[] getChildren()
          Returns the list of (non builtin) Visitable children
 Strategy getVisitor(int i)
          Returns the Strategy at the specified position in arguments
 Strategy[] getVisitors()
          Returns arguments
protected  void initSubterm()
          Initializes subterm
protected  void initSubterm(Strategy v1)
          Initializes subterm by using and adding one Strategy
protected  void initSubterm(Strategy[] v)
          Initializes subterm by using an array of Strategy
protected  void initSubterm(Strategy v1, Strategy v2)
          Initializes subterm by using and adding two Strategy
protected  void initSubterm(Strategy v1, Strategy v2, Strategy v3)
          Initializes subterm by using abd adding three Strategy
 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.
 
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
visit, visitLight
 

Field Detail

arguments

protected Strategy[] arguments
Strategy arguments of the combinator that can be used to define visit methods

Constructor Detail

AbstractStrategyCombinator

public AbstractStrategyCombinator()
Method Detail

initSubterm

protected void initSubterm()
Initializes subterm


initSubterm

protected void initSubterm(Strategy v1)
Initializes subterm by using and adding one Strategy

Parameters:
v1 - first Strategy to add to the array

initSubterm

protected void initSubterm(Strategy v1,
                           Strategy v2)
Initializes subterm by using and adding two Strategy

Parameters:
v1 - first Strategy to add to the array
v2 - second Strategy to add to the array

initSubterm

protected void initSubterm(Strategy v1,
                           Strategy v2,
                           Strategy v3)
Initializes subterm by using abd adding three Strategy

Parameters:
v1 - first Strategy to add to the array
v2 - second Strategy to add to the array
v3 - third Strategy to add to the array

initSubterm

protected void initSubterm(Strategy[] v)
Initializes subterm by using an array of Strategy

Parameters:
v - array used to initialize the subterm

getVisitors

public Strategy[] getVisitors()
Returns arguments

Returns:
arguments

getVisitor

public Strategy getVisitor(int i)
Returns the Strategy at the specified position in arguments

Parameters:
i - index of the Strategy to return
Returns:
the Strategy at the specified position in arguments

getChildCount

public int getChildCount()
Returns the length of arguments

Returns:
the length of arguments

getChildAt

public Visitable getChildAt(int i)
Returns the Visitable at the specified position in arguments

Parameters:
i - index of the Visitable to return
Returns:
the Visitable at the specified position in arguments

getChildren

public Visitable[] getChildren()
Returns the list of (non builtin) Visitable children

Returns:
an array of Visitable

setChildAt

public Visitable setChildAt(int i,
                            Visitable child)
Replaces a child at the specified position

Parameters:
i - index of Visitable to set
child - Visitable so set at the specified position
Returns:
an array of Visitable

setChildren

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

Parameters:
children - array of Visitable
Returns:
this Visitable