jmathlib.core.interpreter
Class ContextList

java.lang.Object
  extended by jmathlib.core.interpreter.ContextList

public class ContextList
extends java.lang.Object

Stores a list of contexts. A context is a set of variables pluss some code. When a function is called a new context is added to the list. When the function is removed, the context is destroyed.


Constructor Summary
ContextList()
          Create an empty context to act as the global context This constructor should only be called ONCE, because it also creates the GLOBAL context
 
Method Summary
 Context createContext(VariableList _variables)
          Used to create a new context and put it on the stack when executing a function
 Context getCurrentContext()
           
 VariableList getGlobalVariables()
           
 Variable getVariable(java.lang.String name)
           
 VariableList getVariables()
           
 boolean isGlobalContext()
           
 Context popContext()
          return to the calling context of the function
 void pushContext(Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextList

public ContextList()
Create an empty context to act as the global context This constructor should only be called ONCE, because it also creates the GLOBAL context

Method Detail

pushContext

public void pushContext(Context context)
Parameters:
context -

createContext

public Context createContext(VariableList _variables)
Used to create a new context and put it on the stack when executing a function

Parameters:
_variables - = the variable list of the function, null if it's a script file

popContext

public Context popContext()
return to the calling context of the function


getVariables

public VariableList getVariables()
Returns:
the variable list of the current context

getGlobalVariables

public VariableList getGlobalVariables()
Returns:
the variable list of the global context

getVariable

public Variable getVariable(java.lang.String name)
Parameters:
name -
Returns:

isGlobalContext

public boolean isGlobalContext()
Returns:
true if the current context is the global one

getCurrentContext

public Context getCurrentContext()
Returns: