Package com.singularsys.jep.misc
Class DecoratingVariableTable
java.lang.Object
com.singularsys.jep.VariableTable
com.singularsys.jep.misc.DecoratingVariableTable
- All Implemented Interfaces:
JepComponent,Serializable
- Direct Known Subclasses:
CaseInsensitiveVariableTable,PublishingVariableTable
A VariableTable that can optionally decorate another variable table.
This class is only intended to be used by subclasses
that require the ability to decorate table request.
If the
base table is set all methods delegate to that,
otherwise super class methods in VariableTable are called.- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.VariableTable
table, vf -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNon decorating constructor.protectedNon decorating copy constructorprotectedDecoratingVariableTable(VariableTable tbl, boolean flag) Decorator constructor -
Method Summary
Modifier and TypeMethodDescriptionaddConstant(String name, Object value) Adds a new variable which is marked as a constant.addVariable(String name) Adds a new variable with no value specified.addVariable(String name, Object value) Adds a new variable with specified value.voidclear()Clears all variables from the table.voidClears the values of all non-constant variables.booleancontainsKey(String key) Returns true if the table contains a variable with the given name.booleancontainsVariable(Variable vbl) Returns true if the table contains the given variable.voidCopies all the constants from a variable table into this table.voidCopies all the variables from a variable table into this table Copies all properties of the variable, including isConstant, validValue flags and all hook keys.getBase()Get the base VariableTableReturns a new empty VariableTable.getVariable(String name) Gets an existing variable, returns null if variable is not found.Returns a list of all the variables in the table.voidInitialize the component.booleanisEmpty()Returns true if the table is empty.keySet()Returns the names of all the variables.Remove a variable from the table.Remove a variable with a given name from the table.voidRemove all variables from the table which are not constants.voidintsize()The number of variables in the table.toString()values()A collection of all the variables.
-
Constructor Details
-
DecoratingVariableTable
protected DecoratingVariableTable()Non decorating constructor. -
DecoratingVariableTable
Non decorating copy constructor- Parameters:
tbl- table to copy variables from
-
DecoratingVariableTable
Decorator constructor- Parameters:
tbl- table to decorateflag- unused
-
-
Method Details
-
addVariable
Adds a new variable with no value specified.- Overrides:
addVariablein classVariableTable- Parameters:
name- variable name, will be converted to lower case- Returns:
- the variable
-
addVariable
Adds a new variable with specified value.- Overrides:
addVariablein classVariableTable- Parameters:
name- variable name, will be converted to lower casevalue- initial value- Returns:
- the variable
- Throws:
JepException- if an attempt is made to set the value of a constant variable
-
addConstant
Description copied from class:VariableTableAdds a new variable which is marked as a constant. Its value will also be marked as valid, in particular a null value is valid for a constant.- Overrides:
addConstantin classVariableTable- Parameters:
name- variable namevalue- variable value- Returns:
- the corresponding Variable object
- Throws:
JepException- if an attempt is made to set the value of an existing constant variable
-
getVariable
Gets an existing variable, returns null if variable is not found.- Overrides:
getVariablein classVariableTable- Parameters:
name- variable name, will be converted to lower case- Returns:
- the variable
-
remove
Description copied from class:VariableTableRemove a variable with a given name from the table.- Overrides:
removein classVariableTable- Parameters:
name- name of the variable to remove- Returns:
- the removed variable or null if the variable does not exist in the table.
-
clear
public void clear()Description copied from class:VariableTableClears all variables from the table.- Overrides:
clearin classVariableTable
-
isEmpty
public boolean isEmpty()Description copied from class:VariableTableReturns true if the table is empty.- Overrides:
isEmptyin classVariableTable- Returns:
- true if the table is empty
-
getVariables
Description copied from class:VariableTableReturns a list of all the variables in the table. Just returns a view. Does not do a deep copy so changes to this collection will affect the underlying table.- Overrides:
getVariablesin classVariableTable- Returns:
- a collection of all the variables.
-
remove
Description copied from class:VariableTableRemove a variable from the table.- Overrides:
removein classVariableTable- Parameters:
var- the variable to remove- Returns:
- the removed variable or null if the variable does not exist in the table.
-
containsKey
Description copied from class:VariableTableReturns true if the table contains a variable with the given name.- Overrides:
containsKeyin classVariableTable- Parameters:
key- variable name- Returns:
- true if the table contains the variable
-
containsVariable
Description copied from class:VariableTableReturns true if the table contains the given variable.- Overrides:
containsVariablein classVariableTable- Parameters:
vbl- the variable- Returns:
- true if the variable is in the table
-
removeNonConstants
public void removeNonConstants()Description copied from class:VariableTableRemove all variables from the table which are not constants.- Overrides:
removeNonConstantsin classVariableTable
-
setVariableFactory
- Overrides:
setVariableFactoryin classVariableTable
-
getVariableFactory
- Overrides:
getVariableFactoryin classVariableTable
-
keySet
Description copied from class:VariableTableReturns the names of all the variables.- Overrides:
keySetin classVariableTable- Returns:
- a collection Strings with the variable names.
-
values
Description copied from class:VariableTableA collection of all the variables. Replace withVariableTable.getVariables()- Overrides:
valuesin classVariableTable- Returns:
- a collection of all the variables.
-
size
public int size()Description copied from class:VariableTableThe number of variables in the table.- Overrides:
sizein classVariableTable- Returns:
- the number of variables
-
toString
- Overrides:
toStringin classVariableTable
-
copyConstantsFrom
Description copied from class:VariableTableCopies all the constants from a variable table into this table. Copies all properties of the variable, including isConstant, validValue flags and all hook keys. If there already is a variable with the same name all properties are copied and pre-existing hooks deleted.- Overrides:
copyConstantsFromin classVariableTable- Parameters:
vt- source variable table
-
copyVariablesFrom
Description copied from class:VariableTableCopies all the variables from a variable table into this table Copies all properties of the variable, including isConstant, validValue flags and all hook keys. If there already is a variable with the same name all properties are copied and pre-existing hooks deleted.- Overrides:
copyVariablesFromin classVariableTable- Parameters:
vt- source variable table
-
clearValues
public void clearValues()Description copied from class:VariableTableClears the values of all non-constant variables. This will set theVariable.setValidValue(boolean)to false.- Overrides:
clearValuesin classVariableTable
-
getBase
Get the base VariableTable- Returns:
- either the base table or null
-
getLightWeightInstance
Description copied from class:VariableTableReturns a new empty VariableTable.- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classVariableTable- Returns:
- a new VariableTable
- See Also:
-
init
Description copied from interface:JepComponentInitialize the component. This method 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:
initin interfaceJepComponent- Overrides:
initin classVariableTable- Parameters:
j- the current Jep instance
-