algoanim.variables
Class VariableContext

java.lang.Object
  extended by algoanim.variables.VariableContext

public class VariableContext
extends java.lang.Object


Field Summary
protected  VariableContext father
          father and son are references to other contexts
protected  VariableContext son
           
 
Constructor Summary
VariableContext()
          constructor
VariableContext(VariableContext myFather)
          constructor which references an existing context as a father
 
Method Summary
 VariableContext contextClose()
          closes given contact and returns to father context
 VariableContext contextOpen()
          opens a new context (e.g.
 void defineKey(java.lang.String type, java.lang.String key)
          defines a variable for this context
 void defineKey(java.lang.String type, java.lang.String key, java.lang.String value)
           
 void deleteKey(java.lang.String key)
          deletes a key
 VariableContext dropSon()
           
 java.lang.Boolean getBool(java.lang.String key)
           
 VariableContext getContext()
           
 java.lang.Float getFloat(java.lang.String key)
           
 java.lang.Integer getInt(java.lang.String key)
           
 java.lang.String getString(java.lang.String key)
           
 Variable getVariable(java.lang.String key)
          returns the variable for a given key.
 java.util.HashMap<java.lang.String,java.lang.String> listAll()
          gets a list of all current variables specific to this context
 java.util.HashMap<java.lang.String,java.lang.String> listContext()
          gets a list of all current variables specific to this context
 java.util.HashMap<java.lang.String,java.lang.String> listGlobal()
           
static void main(java.lang.String[] args)
           
 void setGlobal(java.lang.String key)
           
 void setRole(java.lang.String key, java.lang.String value)
          sets the value for a given variable.
 void setValue(java.lang.String key, java.lang.String value)
          sets the value for a given variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

father

protected VariableContext father
father and son are references to other contexts


son

protected VariableContext son
Constructor Detail

VariableContext

public VariableContext()
constructor


VariableContext

public VariableContext(VariableContext myFather)
constructor which references an existing context as a father

Parameters:
myFather -
Method Detail

dropSon

public VariableContext dropSon()

defineKey

public void defineKey(java.lang.String type,
                      java.lang.String key)
defines a variable for this context

Parameters:
key - name for the variable to define

defineKey

public void defineKey(java.lang.String type,
                      java.lang.String key,
                      java.lang.String value)

deleteKey

public void deleteKey(java.lang.String key)
deletes a key


getVariable

public Variable getVariable(java.lang.String key)
returns the variable for a given key. if the variable is not found in the actual context, search is continued in fathers context

Parameters:
key - name of the variable
Returns:
variable

getInt

public java.lang.Integer getInt(java.lang.String key)

getFloat

public java.lang.Float getFloat(java.lang.String key)

getBool

public java.lang.Boolean getBool(java.lang.String key)

getString

public java.lang.String getString(java.lang.String key)

listContext

public java.util.HashMap<java.lang.String,java.lang.String> listContext()
gets a list of all current variables specific to this context

Returns:
list of all variables

listGlobal

public java.util.HashMap<java.lang.String,java.lang.String> listGlobal()

listAll

public java.util.HashMap<java.lang.String,java.lang.String> listAll()
gets a list of all current variables specific to this context

Returns:
list of all variables

setValue

public void setValue(java.lang.String key,
                     java.lang.String value)
sets the value for a given variable. if the variable is not found in the actual context, search is continued in fathers context

Parameters:
key - name of the variable
value - the value to be set for the key

setRole

public void setRole(java.lang.String key,
                    java.lang.String value)
sets the value for a given variable. if the variable is not found in the actual context, search is continued in fathers context

Parameters:
key - name of the variable
value - the value to be set for the key

setGlobal

public void setGlobal(java.lang.String key)

contextOpen

public VariableContext contextOpen()
opens a new context (e.g. a function, loop, etc.) and references to it as son

Returns:
the new context

contextClose

public VariableContext contextClose()
closes given contact and returns to father context

Returns:
father conext

getContext

public VariableContext getContext()
Returns:
the actual top-context

main

public static void main(java.lang.String[] args)