gec.gctparser
Class Variable

java.lang.Object
  extended by gec.gctparser.Variable

public class Variable
extends java.lang.Object

Container for a variable. Also parses a variable.

Author:
bburch Variables are of the form: variableName : variableType := initialValue ; The initial value is optional.

Field Summary
 java.lang.String initialValue
           
static int INPUTVARIABLE
           
static int INTERNALVARIABLE
           
 java.lang.String name
           
static int OUTPUTVARIABLE
           
 java.lang.String type
           
 boolean valid
           
 int variableType
           
 
Constructor Summary
Variable()
          Null constructor.
 
Method Summary
 boolean parseVariable(java.lang.String token)
          Parse the variable text a token at a time.
 void setVariableType(int vtype)
          Set the variable type.
 java.lang.String toString()
          Format the information about the variable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name

type

public java.lang.String type

initialValue

public java.lang.String initialValue

valid

public boolean valid

variableType

public int variableType

INPUTVARIABLE

public static final int INPUTVARIABLE
See Also:
Constant Field Values

OUTPUTVARIABLE

public static final int OUTPUTVARIABLE
See Also:
Constant Field Values

INTERNALVARIABLE

public static final int INTERNALVARIABLE
See Also:
Constant Field Values
Constructor Detail

Variable

public Variable()
Null constructor. Initializes the parser state.

Method Detail

parseVariable

public boolean parseVariable(java.lang.String token)
Parse the variable text a token at a time. Requires keeping a state of the parser between tokens.

Parameters:
token - String - the word to parse
Returns:
boolean - true if variable complete.

setVariableType

public void setVariableType(int vtype)
Set the variable type. The calling program knows what type it is.

Parameters:
vtype - int - one of INPUTVARIABLE, OUTPUTVARIABLE, or INTERNALVARIABLE

toString

public java.lang.String toString()
Format the information about the variable. Overrides the default toString.

Overrides:
toString in class java.lang.Object
Returns:
String - the formatted string