Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep
Class VariableTable

    java.lang.Object
      com.singularsys.jep.VariableTable

All Implemented Interfaces:
  JepComponent, java.io.Serializable

Direct Known Subclasses:
  CaseInsensitiveVariableTable, StandardVariableTable

    public class VariableTable

extends java.lang.Object
implements JepComponent

See Also:
  Serialized Form

Field Summary
`protected Jep` | `jep`
`protected java.util.Map<java.lang.String,Variable>` | `table`

Constructor Summary
`VariableTable()`

Method Summary
`Variable` | `addVariable(java.lang.String name)` Adds a new variable with no value specified.
`Variable` | `addVariable(java.lang.String name, java.lang.Object value)` Adds a new variable with specified value.
`Variable` | `addVariable(java.lang.String name, java.lang.Object value, VariableFactory varFac)` Adds a new variable with specified value.
`void` | `clear()` Clears all variables from the table.
`Variable` | `getVariable(java.lang.String name)` Gets an existing variable, returns null if variable is not found.
`void` | `init(Jep j)` Initialize the component.
`boolean` | `isEmpty()`
`java.util.Set<java.lang.String>` | `keySet()`
`int` | `size()`
`java.lang.String` | `toString()`
`java.util.Collection<Variable>` | `values()` A collection of all the variables

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### table

    protected java.util.Map<java.lang.String,Variable> table

### jep

    protected transient Jep jep

Constructor Detail

### VariableTable

    public VariableTable()

Method Detail

### init

    public void init(Jep j)

  Description copied from interface: `JepComponent`
  Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.

  Specified by:
    `init` in interface `JepComponent`
  Parameters:
    `j` - the current Jep instance

### addVariable

    public Variable addVariable(java.lang.String name)

  Adds a new variable with no value specified. If the variable already exists in the table, that variable instance is returned. Otherwise a new `Variable` instance is created with the variable factory.

  Parameters:
    `name` - the variable's name
  Returns:
    the variable

### addVariable

    public Variable addVariable(java.lang.String name,
                                java.lang.Object value)

  Adds a new variable with specified value. If the variable already exists, its value is updated with the new value. If the variable exists and is a constant, the value is not updated and no error is reported. If the variable does not exist, it is created using the variable factory of the jep instance specified with the init(Jep j) method.

  Parameters:
    `name` - the name of the variable
    `value` - the value for the variable to be set to
  Returns:
    the variable added or updated

### addVariable

    public Variable addVariable(java.lang.String name,
                                java.lang.Object value,
                                VariableFactory varFac)

  Adds a new variable with specified value. If the variable already exists, its value is updated with the new value. If the variable exists and is a constant, the value is not updated and no error is reported.

  Parameters:
    `name` - the name of the variable
    `value` - the value for the variable to be set to
    `varFac` - the variable factory to use if a variable needs to be created
  Returns:
    the variable added or updated

### getVariable

    public Variable getVariable(java.lang.String name)

  Gets an existing variable, returns null if variable is not found.

  Parameters:
    `name` -
  Returns:
    the variable

### clear

    public void clear()

  Clears all variables from the table.

### isEmpty

    public boolean isEmpty()

### keySet

    public java.util.Set<java.lang.String> keySet()

### size

    public int size()

### values

    public java.util.Collection<Variable> values()

  A collection of all the variables

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Singular Systems http://www.singularsys.com/jep