Venice 0.751beta

nz.org.venice.parser
Class Variable

java.lang.Object
  extended bynz.org.venice.parser.Variable

public class Variable
extends java.lang.Object

A representation of a variable in the Gondola language.


Field Summary
static boolean CONSTANT
          Indicates that the variable is constant and the value cannot be changed.
static boolean VARIABLE
          Indicates that the variable can be changed.
 
Constructor Summary
Variable(java.lang.String name, int type, boolean isConstant, boolean isFunction, double value)
          Create a new variable.
Variable(java.lang.String name, int type, boolean isConstant, double value)
          Create a new variable.
 
Method Summary
 java.lang.Object clone()
           
 java.lang.String getName()
          Return the name of the variable.
 int getType()
          Return the type of the variable.
 double getValue()
          Return the value of the variable.
 boolean isConstant()
          Return whether the variable is a constant.
 boolean isFunction()
          Return whether the variable is a function.
 void setValue(double value)
          Set the value of the variable.
 void setValue(int value)
          Set the value of the variable.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT

public static final boolean CONSTANT
Indicates that the variable is constant and the value cannot be changed.

See Also:
Constant Field Values

VARIABLE

public static final boolean VARIABLE
Indicates that the variable can be changed.

See Also:
Constant Field Values
Constructor Detail

Variable

public Variable(java.lang.String name,
                int type,
                boolean isConstant,
                double value)
Create a new variable.

Parameters:
name - the name of the variable.
type - the type of the variable, one of Expression.BOOLEAN_TYPE, Expression.FLOAT_TYPE or Expression.INTEGER_TYPE.
isConstant - whether the variable is constant. Either @{link CONSTANT} or VARIABLE.
value - the initial value of the variable.

Variable

public Variable(java.lang.String name,
                int type,
                boolean isConstant,
                boolean isFunction,
                double value)
Create a new variable.

Parameters:
name - the name of the variable.
type - the type of the variable, one of Expression.BOOLEAN_TYPE, Expression.FLOAT_TYPE or Expression.INTEGER_TYPE.
isConstant - whether the variable is constant. Either @{link CONSTANT} or VARIABLE.
value - the initial value of the variable.
Method Detail

getName

public java.lang.String getName()
Return the name of the variable.

Returns:
the name of the variable.

getType

public int getType()
Return the type of the variable.

Returns:
the type of the variable.

isConstant

public boolean isConstant()
Return whether the variable is a constant.

Returns:
TRUE iff the variable is a constant.

isFunction

public boolean isFunction()
Return whether the variable is a function.

Returns:
TRUE iff the variable is function constant.

getValue

public double getValue()
Return the value of the variable.

Returns:
the value of the variable.

setValue

public void setValue(double value)
Set the value of the variable. You can legally change the value of constant variables using this method. Constant variables are only constant in the gondola language.

Parameters:
value - the new value.

setValue

public void setValue(int value)
Set the value of the variable. You can legally change the value of constant variables using this method. Constant variables are only constant in the gondola language.

Parameters:
value - the new value.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

Venice 0.751beta