The Meta-Environment API

toolbus.environment
Class Environment

java.lang.Object
  extended by toolbus.environment.Environment

public class Environment
extends java.lang.Object

Environments maintain a relation between variables and their values.


Field Summary
private  Bindings bindings
           
private  TBTermFactory tbfactory
           
 
Constructor Summary
Environment(TBTermFactory tbfactory)
           
 
Method Summary
 void assignVar(TBTermVar v, aterm.ATerm val)
          assignVar assigns a value to a variable.
 Environment copy()
           
 Binding getBinding(TBTermVar var)
          getValue fetches the value of a variable.
 java.util.List<Binding> getBindingsAsList()
           
 TBTermFactory getTBTermFactory()
           
 aterm.ATerm getValue(TBTermVar v)
          getValue fetches the value of a variable.
 aterm.ATerm getVarType(TBTermVar var)
           
 void introduceBinding(TBTermVar formalVar, aterm.ATerm actual)
           
 void introduceBinding(TBTermVar formalVar, aterm.ATerm actual, boolean isFormal)
          introduceBinding adds a new variable for the case of formal/actual correspondence in process calls.
 void introduceBindings(aterm.ATermList formals, aterm.ATermList actual, boolean isFormal)
          introduceBindings adds new (formal.actual) bindings
 void introduceVars(aterm.ATermList vs)
          introduceVars adds a list of variables to the environment.
 boolean isDeclaredAsStringVar(TBTermVar var)
           
 void removeBindings(aterm.ATermList formals)
          removeBindings deletes variables introduced by introduceVars and introduceBindings.
 aterm.ATerm replaceFormal(TBTermVar v)
           
 void setAssignable(TBTermVar var)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tbfactory

private final TBTermFactory tbfactory

bindings

private Bindings bindings
Constructor Detail

Environment

public Environment(TBTermFactory tbfactory)
Method Detail

copy

public Environment copy()

getTBTermFactory

public TBTermFactory getTBTermFactory()

size

public int size()

introduceVars

public void introduceVars(aterm.ATermList vs)
                   throws ToolBusInternalError
introduceVars adds a list of variables to the environment. They are initialized to Undefined.

Parameters:
vs - list of variables.
Throws:
ToolBusInternalError

introduceBinding

public void introduceBinding(TBTermVar formalVar,
                             aterm.ATerm actual,
                             boolean isFormal)
                      throws ToolBusException
introduceBinding adds a new variable for the case of formal/actual correspondence in process calls. Special care is taken for result variables.

Parameters:
formalVar - A formal parameter.
actual - An actual value.
isFormal - Indicate if the variable is a formal.
Throws:
ToolBusException

introduceBinding

public void introduceBinding(TBTermVar formalVar,
                             aterm.ATerm actual)
                      throws ToolBusException
Throws:
ToolBusException

introduceBindings

public void introduceBindings(aterm.ATermList formals,
                              aterm.ATermList actual,
                              boolean isFormal)
                       throws ToolBusException
introduceBindings adds new (formal.actual) bindings

Parameters:
formals - list of formal parameters.
actual - list of actual parameters.
isFormal - Indicate if the variables are formals.
Throws:
ToolBusException

removeBindings

public void removeBindings(aterm.ATermList formals)
removeBindings deletes variables introduced by introduceVars and introduceBindings.

Parameters:
formals - variables to be removed.

assignVar

public void assignVar(TBTermVar v,
                      aterm.ATerm val)
assignVar assigns a value to a variable.

Parameters:
v - variable
val - value to be assigned to variable

getVarType

public aterm.ATerm getVarType(TBTermVar var)
                       throws ToolBusError
Throws:
ToolBusError

getBinding

public Binding getBinding(TBTermVar var)
getValue fetches the value of a variable.

Parameters:
var - variable whole value is needed.

getBindingsAsList

public java.util.List<Binding> getBindingsAsList()

isDeclaredAsStringVar

public boolean isDeclaredAsStringVar(TBTermVar var)

getValue

public aterm.ATerm getValue(TBTermVar v)
getValue fetches the value of a variable.

Parameters:
v - variable whose value is needed.

setAssignable

public void setAssignable(TBTermVar var)

replaceFormal

public aterm.ATerm replaceFormal(TBTermVar v)
                          throws ToolBusException
Throws:
ToolBusException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

The Meta-Environment API