|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.agena.minerva.util.model.VariableList
public class VariableList
This class encapsulates a List of Variables and provides various convenience methods for using the underlying List.
Field Summary |
---|
Fields inherited from interface uk.co.agena.minerva.util.model.Writable |
---|
FIELD_SEPARATOR |
Constructor Summary | |
---|---|
VariableList()
Default Constructor. |
Method Summary | |
---|---|
void |
addVariable(java.lang.String variableName)
Creates a new Variable with the supplied name and adds it to the List of Variables. |
Variable |
addVariable(java.lang.String variableName,
double defaultValue)
Creates a new Variable with the supplied name and default value and adds it to the List of Variables. |
void |
addVariable(java.lang.String variableName,
double value,
double defaultValue)
Creates a new Variable with the supplied name, actual value and default value and adds it to the List of Variables. |
void |
addVariable(Variable v)
Adds the supplied Variable to the list of variables. |
void |
checkVariableName(java.lang.String variableName)
Throws a MinervaVariableException if the variableName is not valid e.g. |
java.lang.Object |
clone()
Clones the VariableList. |
java.util.List |
getAllVariableNames()
Gets the String Names of all the Variables in this VariableList and adds them to a List which can be returned. |
Variable |
getVariable(java.lang.String variableName)
Finds the Variable with the supplied name. |
java.util.List |
getVariables()
|
double |
getVersion()
Returns the version of the class. |
int |
read(java.util.List strings,
int currentLineNumber)
|
void |
removeAllVariables()
Removes all Variables from the List. |
void |
removeVariable(Variable v)
Removes the specified Variable from the list of Variables if it is a member of the List. |
void |
setVariables(java.util.List variables)
|
void |
setVersion(double version)
Sets the version number of the class. |
int |
size()
Returns the number of Variables in the List. |
void |
updateVariable(Variable v,
java.lang.String newName,
double newDefaultValue)
Updates the specified Variable to have the new Name and Default Value that have been specified. |
java.util.List |
write()
Writes the object in question to a List of Strings. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VariableList()
Method Detail |
---|
public double getVersion()
Writable
getVersion
in interface Writable
public void setVersion(double version)
Writable
setVersion
in interface Writable
version
- the version numberpublic java.util.List getVariables()
public void setVariables(java.util.List variables)
public Variable getVariable(java.lang.String variableName) throws MinervaVariableException
variableName
- the name of the Variable being sought
MinervaVariableException
- if no Variable with the supplied name can be foundpublic void checkVariableName(java.lang.String variableName) throws MinervaVariableException
variableName
- The Name we are checking
MinervaVariableException
- If the variableName is invalid or there is a Variable with the specified
name in this VariableList already.public void addVariable(java.lang.String variableName) throws MinervaVariableException
variableName
- the name of the Variable to be created and added
MinervaVariableException
- if a Variable with the same name already exists in the Listpublic Variable addVariable(java.lang.String variableName, double defaultValue) throws MinervaVariableException
variableName
- the name of the Variable to be created and addeddefaultValue
- the defaultValue of the Variable to be created and added
MinervaVariableException
- if a Variable with the same name already exists in the Listpublic void addVariable(java.lang.String variableName, double value, double defaultValue) throws MinervaVariableException
variableName
- the name of the Variable to be created and addedvalue
- the value of the Variable to be created and addeddefaultValue
- the defaultValue of the Variable to be created and added
MinervaVariableException
- if a Variable with the same name already exists in the Listpublic void addVariable(Variable v) throws MinervaVariableException
v
- the Variable to be added
MinervaVariableException
- if a Variable with the same name already exists in the Listpublic void removeAllVariables()
public int size()
public void removeVariable(Variable v) throws MinervaVariableException
v
- The Variable to be removed
MinervaVariableException
- If the specified Variable is not a member of the Listpublic void updateVariable(Variable v, java.lang.String newName, double newDefaultValue) throws MinervaVariableException
v
- The Variable that is to be updatednewName
- The New Name for the VariablenewDefaultValue
- The New Default Value for the Variable
MinervaVariableException
- If the specified Variable is not a member of this List or if a Variable with the
specified newName already exists (two Variables can't have the same name).public java.util.List getAllVariableNames()
public java.util.List write() throws MinervaReadWriteException
Writable
write
in interface Writable
MinervaReadWriteException
- if therepublic int read(java.util.List strings, int currentLineNumber) throws MinervaReadWriteException
read
in interface Writable
MinervaReadWriteException
public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |