cz.cuni.amis.pogamut.sposh.engine
Class VariableContext

Package class diagram package VariableContext
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.engine.VariableContext

public final class VariableContext
extends Object

This class is responsible for storing and passing arguments throught the posh plan. Unnamed varibales are named as number (e.g. "0", "1"...), named variables have same name as in plan.

Author:
Honza

Constructor Summary
VariableContext()
           
VariableContext(VariableContext ctx, Arguments callArgs)
          Create new VariableContext that will contain only variables from call arguments.
VariableContext(VariableContext ctx, Arguments callParameters, FormalParameters formalParameters)
          Create new variable context for diving into another function.
 
Method Summary
 String[] getKeys()
          Get keys of all variables in this context.
 Object getValue(String variableName)
          Get value stored in the
 boolean hasVariable(String variableName)
           
 Object put(String parameterName, Object value)
          Put another variable into this context
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableContext

public VariableContext()

VariableContext

public VariableContext(VariableContext ctx,
                       Arguments callArgs)
Create new VariableContext that will contain only variables from call arguments.

Parameters:
callArgs -

VariableContext

public VariableContext(VariableContext ctx,
                       Arguments callParameters,
                       FormalParameters formalParameters)
Create new variable context for diving into another function. New context will contain only variables from formal parameters, and its values will be values passed from call arguments or (if missing) default value from formal parametrs.

Parameters:
ctx -
callParameters -
formalParameters -
Method Detail

put

public Object put(String parameterName,
                  Object value)
Put another variable into this context

Parameters:
parameterName - name of new parameter
value - value of parameter
Returns:
old value for parameterName or null if it is a new parameter.

getKeys

public String[] getKeys()
Get keys of all variables in this context.

Returns:

getValue

public Object getValue(String variableName)
Get value stored in the

Parameters:
variableName -
Returns:
Throws:
IllegalArgumentException - If such variable is not present.

toString

public String toString()
Overrides:
toString in class Object

size

public int size()

hasVariable

public boolean hasVariable(String variableName)


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.