tom.library.sl
Class Environment

java.lang.Object
  extended by tom.library.sl.Environment
All Implemented Interfaces:
java.lang.Cloneable

public final class Environment
extends java.lang.Object
implements java.lang.Cloneable

Object that represents an environment of a strategy the position where the strategy is applied a pointer to subterm the root is stored in the first cell


Field Summary
protected  int current
           
static int FAILURE
           
static int IDENTITY
           
protected  int[] omega
           
protected  int status
           
protected  Visitable[] subterm
           
static int SUCCESS
           
 
Constructor Summary
Environment()
           
 
Method Summary
 java.lang.Object clone()
           
 int depth()
          Get the depth of the position in the tree
 void down(int n)
          add a sub-position n
 boolean equals(java.lang.Object o)
          Tests if two environments are equals
 void followPath(Path path)
           
 void followPathLocal(Path path)
           
 Position getPosition()
          get the current position
 Visitable getRoot()
          get the current root
 int getStatus()
           
 Visitable getSubject()
          get the term that corresponds to the current position
 int hashCode()
           
 void setRoot(Visitable root)
          set the current root
 void setStatus(int s)
           
 void setSubject(Visitable root)
          set the current term
 java.lang.String toString()
          Returns a String object representing the position.
 void up()
          remove the last sub-position Up and down are made public to allow to write compiled strategies by hand This may be a BAD idea
 void upLocal()
          package private remove the last sub-position but does not update the subject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

FAILURE

public static final int FAILURE
See Also:
Constant Field Values

IDENTITY

public static final int IDENTITY
See Also:
Constant Field Values

current

protected int current

omega

protected int[] omega

subterm

protected Visitable[] subterm

status

protected int status
Constructor Detail

Environment

public Environment()
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object o)
Tests if two environments are equals

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getStatus

public int getStatus()

setStatus

public void setStatus(int s)

getRoot

public Visitable getRoot()
get the current root

Returns:
the current root

setRoot

public void setRoot(Visitable root)
set the current root


getSubject

public Visitable getSubject()
get the term that corresponds to the current position

Returns:
the current term

setSubject

public void setSubject(Visitable root)
set the current term


getPosition

public Position getPosition()
get the current position

Returns:
the current position

depth

public int depth()
Get the depth of the position in the tree

Returns:
depth on the position

up

public void up()
remove the last sub-position Up and down are made public to allow to write compiled strategies by hand This may be a BAD idea


upLocal

public void upLocal()
package private remove the last sub-position but does not update the subject


down

public void down(int n)
add a sub-position n

Parameters:
n - sub-position number. 1 is the first possible sub-position

followPath

public void followPath(Path path)

followPathLocal

public void followPathLocal(Path path)

toString

public java.lang.String toString()
Returns a String object representing the position. The string representation consists of a list of elementary positions

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this position