JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.formulae
Class ExpressionVariable

java.lang.Object
  |
  +--com.klg.jclass.util.formulae.ExpressionVariable
All Implemented Interfaces:
Cloneable, Expression

public class ExpressionVariable
extends Object
implements Expression, Cloneable

A variable is a named expression which can have its value changed by name-keyed access to it.


Field Summary
protected  Object context
          The context in which the variable is defined
protected  String name
          The name by which the variable is known and referred to
protected  com.klg.jclass.util.formulae.Expression value
          The value which the variable is currently assigned
protected static HashMap variableMap
          The variable map stores all named variables (disambiguated by context)
 
Method Summary
 Object clone()
          Clone this variable; since variables are unique to a context, we return the variable itself.
static com.klg.jclass.util.formulae.ExpressionVariable createVariable(Object context, String name)
          Create a variable Expression given a context and name
 boolean equals(Object obj)
          Determine if this variable matches another
 com.klg.jclass.util.formulae.Result evaluate()
          As an Expression, the evaluation of this variable is its stored value (or the evaluation of a stored Expression).
 com.klg.jclass.util.formulae.Expression getValue()
          Retrieve the Expression which is stored by this Variable
static com.klg.jclass.util.formulae.ExpressionVariable getVariable(Object context, String name)
          Retrieve a variable Expression given a context and name
 int hashCode()
          Compute the hashcode for this variable based on the context and name
 void setValue(com.klg.jclass.util.formulae.Expression value)
          Set the current value of a variable
static com.klg.jclass.util.formulae.ExpressionVariable setVariable(Object context, String name, com.klg.jclass.util.formulae.Expression value)
          Create or set a variable Expression given a context, name and value
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
The name by which the variable is known and referred to


context

protected Object context
The context in which the variable is defined


value

protected com.klg.jclass.util.formulae.Expression value
The value which the variable is currently assigned


variableMap

protected static HashMap variableMap
The variable map stores all named variables (disambiguated by context)

Method Detail

createVariable

public static com.klg.jclass.util.formulae.ExpressionVariable createVariable(Object context,
                                                                             String name)
Create a variable Expression given a context and name

Parameters:
context - The object in which context the name is unique
name - The name of the variable

setVariable

public static com.klg.jclass.util.formulae.ExpressionVariable setVariable(Object context,
                                                                          String name,
                                                                          com.klg.jclass.util.formulae.Expression value)
Create or set a variable Expression given a context, name and value

Parameters:
context - The object in which context the name is unique
name - The name of the variable
value - The current value of the variable

getVariable

public static com.klg.jclass.util.formulae.ExpressionVariable getVariable(Object context,
                                                                          String name)
Retrieve a variable Expression given a context and name

Parameters:
context - The object in which context the name is unique
name - The name of the variable

evaluate

public com.klg.jclass.util.formulae.Result evaluate()
As an Expression, the evaluation of this variable is its stored value (or the evaluation of a stored Expression).

Specified by:
evaluate in interface Expression
Returns:
The Result of the stored Expression

setValue

public void setValue(com.klg.jclass.util.formulae.Expression value)
Set the current value of a variable

Parameters:
value - The new value the variable will have

getValue

public com.klg.jclass.util.formulae.Expression getValue()
Retrieve the Expression which is stored by this Variable

Returns:
The unevaluated Expression this variable is equal to

hashCode

public int hashCode()
Compute the hashcode for this variable based on the context and name

Overrides:
hashCode in class Object
Returns:
A hash of the context and name values of this variable

equals

public boolean equals(Object obj)
Determine if this variable matches another

Overrides:
equals in class Object
Parameters:
obj - The object to test for equality
Returns:
True if the variables have the same name and context

clone

public Object clone()
Clone this variable; since variables are unique to a context, we return the variable itself.

Specified by:
clone in interface Expression
Overrides:
clone in class Object

Copyright © 2004 Quest Software Inc..
All rights reserved.