Package util
Class VariableManager.CommandInterpreter
java.lang.Object
util.VariableManager.CommandInterpreter
- Enclosing class:
- VariableManager
public class VariableManager.CommandInterpreter
extends java.lang.Object
Objects of this class parse a variable initialization or modifying
command string. For example var x = 2;var y=3; var z =4;
x=9;y=3.123;const k = 3x+z; k=34; var p,q,r=32; const r,s,t=25; z=3.123;
All that is needed to execute the parse is to create an object of the
class with the available constructor. At the end of the object creation,
the parse has been executed and if it is successful, a call to
getAccumulator() will return a java.util.List object filled with the
Variable objects embedded in the command. Also at the end of the object
creation( the call to the constructor of this class) The VARIABLES
attribute of the containing class will have been fed with the Variable
objects embedded in the command parsed here. The feeding could be the
insertion of the Variable objects, if the store doe not already contain
them,or updating Variable objects in the store with the incoming ones if
they have the same name. The behavior of the parser is such that it
interpretes and executes the code on the fly. This means that it will
stop inserting data in the VARIABLES only when it detects error in the
code.
-
Constructor Summary
Constructors Constructor Description CommandInterpreter()CommandInterpreter(java.lang.String command) -
Method Summary
Modifier and Type Method Description java.lang.StringgetCommand()booleanisValid()voidparse()Conducts an holistic parse of the input data.voidsetCommand(java.lang.String command)voidsetValid(boolean valid)
-
Constructor Details
-
CommandInterpreter
public CommandInterpreter() -
CommandInterpreter
public CommandInterpreter(java.lang.String command)- Parameters:
command- The variable creation command string.
-
-
Method Details
-
setCommand
public void setCommand(java.lang.String command) -
getCommand
public java.lang.String getCommand() -
setValid
public void setValid(boolean valid) -
isValid
public boolean isValid() -
parse
public void parse()Conducts an holistic parse of the input data.
-