Package gov.nih.mipav.model.scripting
Class VariableTable
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable
-
- gov.nih.mipav.model.scripting.VariableTable
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map
public class VariableTable extends java.util.Hashtable
A table used to store variables and their values.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
Use serialVersionUID for interoperability.protected static VariableTable
singletonReference
The reference to the only VariableTable which should ever be instantiated.
-
Constructor Summary
Constructors Modifier Constructor Description protected
VariableTable()
Creates a new VariableTable object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VariableTable
getReference()
Returns a reference to the variable table singleton.java.lang.String
interpolate(java.lang.String varName)
Interpolates and returns the value of a given variable.boolean
isVariableSet(java.lang.String varName)
Checks to see if a variable has been added to the variable table.void
removeVariable(java.lang.String varName)
Removes a variable and its value from the variable table.void
storeVariable(java.lang.String varName, java.lang.String value)
Stores a variable name and its value in the variable table.-
Methods inherited from class java.util.Hashtable
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
singletonReference
protected static VariableTable singletonReference
The reference to the only VariableTable which should ever be instantiated.
-
-
Method Detail
-
getReference
public static final VariableTable getReference()
Returns a reference to the variable table singleton.- Returns:
- A reference to the variable table.
-
interpolate
public java.lang.String interpolate(java.lang.String varName)
Interpolates and returns the value of a given variable.- Parameters:
varName
- The name of the variable to interpolate.- Returns:
- The variable's value.
-
isVariableSet
public boolean isVariableSet(java.lang.String varName)
Checks to see if a variable has been added to the variable table.- Parameters:
varName
- The name of the variable to check for.- Returns:
True
if the variable has been added to the table,false
otherwise.
-
removeVariable
public void removeVariable(java.lang.String varName)
Removes a variable and its value from the variable table.- Parameters:
varName
- The name of the variable to remove.
-
storeVariable
public void storeVariable(java.lang.String varName, java.lang.String value)
Stores a variable name and its value in the variable table.- Parameters:
varName
- The name of the variable (e.g., '$save_as_file_name').value
- The variable value.
-
-