uk.co.agena.minerva.util.model
Class Variable

java.lang.Object
  extended by uk.co.agena.minerva.util.model.Variable
All Implemented Interfaces:
java.lang.Cloneable, Writable

public class Variable
extends java.lang.Object
implements java.lang.Cloneable, Writable

This class encapsulates any data that consists, fundamentally, of a name, a numerical value and a default numerical value.


Field Summary
static double version
           
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
Variable()
          Default constructor.
Variable(java.lang.String name)
          Creates a Variable with a name and an initial default value and actual value of 0.
Variable(java.lang.String name, double defaultValue)
          Creates a Variable with a name and an initial default value.
Variable(java.lang.String name, double value, double defaultValue)
          Creates a fully specified Variable.
 
Method Summary
 java.lang.Object clone()
          Makes a copy of this Variable object.
 double getDefaultValue()
           
 java.lang.String getName()
           
 double getValue()
           
 double getVersion()
          Returns the version of the class.
 boolean isValueSet()
           
 int read(java.util.List strings, int currentLineNumber)
           
 void setDefaultValue(double defaultValue)
           
 void setName(java.lang.String name)
           
 void setValue(double value)
           
 void setValueSet(boolean valueSet)
           
 void setVersion(double version)
          Sets the version number of the class.
 java.lang.String toString()
          Creates a String representation of the Variable.
 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, wait, wait, wait
 

Field Detail

version

public static double version
Constructor Detail

Variable

public Variable()
Default constructor.


Variable

public Variable(java.lang.String name,
                double value,
                double defaultValue)
Creates a fully specified Variable.

Parameters:
name -
value -
defaultValue -

Variable

public Variable(java.lang.String name,
                double defaultValue)
Creates a Variable with a name and an initial default value. This default value is also used to initialise the actual value.

Parameters:
name -
defaultValue -

Variable

public Variable(java.lang.String name)
Creates a Variable with a name and an initial default value and actual value of 0.

Parameters:
name -
Method Detail

getVersion

public double getVersion()
Description copied from interface: Writable
Returns the version of the class. Used to ensure backward compatibility.

Specified by:
getVersion in interface Writable
Returns:
the version number

setVersion

public void setVersion(double version)
Description copied from interface: Writable
Sets the version number of the class. Used to ensure backward compatibility.

Specified by:
setVersion in interface Writable
Parameters:
version - the version number

getDefaultValue

public double getDefaultValue()

setDefaultValue

public void setDefaultValue(double defaultValue)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getValue

public double getValue()

setValue

public void setValue(double value)

isValueSet

public boolean isValueSet()

setValueSet

public void setValueSet(boolean valueSet)

toString

public java.lang.String toString()
Creates a String representation of the Variable. This representation is in the following format: [name] = [value] (defaultValue)

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Makes a copy of this Variable object.

Overrides:
clone in class java.lang.Object
Returns:
a copy of this Variable object

write

public java.util.List write()
                     throws MinervaReadWriteException
Description copied from interface: Writable
Writes the object in question to a List of Strings.

Specified by:
write in interface Writable
Returns:
the List to which the Strings have been written
Throws:
MinervaReadWriteException - if there

read

public int read(java.util.List strings,
                int currentLineNumber)
         throws MinervaReadWriteException
Specified by:
read in interface Writable
Throws:
MinervaReadWriteException


Copyright © 2006 Agena Ltd. All Rights Reserved.