org.grinvin.invariants
Class InvariantValue
java.lang.Object
org.grinvin.invariants.InvariantValue
public abstract class InvariantValue
extends java.lang.Object
Wraps the result of an invariant computation and provides a
means to represent this result both as a string and an XML element.
abstract double | asDouble()
|
static InvariantValue | fromElement(Element element) - Convert a JDOM-element to an invariant value of the correct class.
|
String | getComputerVersion()
|
Invariant | getInvariant() - Return the invariant of which this is a value.
|
protected void | load(Element element) - Initialize the components of this value from a JDOM-element.
|
abstract void | loadValue(Element element) - Should be overridden to load the actual value from a JDOM-element.
|
abstract void | saveValue(Element element) - Should be overridden to save the actual value into a JDOM-element.
|
Element | toElement() - Converts this value to a JDOM element.
|
String | toString()
|
abstract String | toText() - Convert this value to a string, so it can be displayed
as part of a GUI.
|
InvariantValue
protected InvariantValue(String type)
Create a new unitialized value of the given type. Used by the loader.
InvariantValue
protected InvariantValue(String type,
InvariantComputer computer)
Create a value of the given type which was computed by the given invariant computer.
asDouble
public abstract double asDouble()
getComputerVersion
public String getComputerVersion()
getInvariant
public Invariant getInvariant()
Return the invariant of which this is a value.
loadValue
public abstract void loadValue(Element element)
throws IOFormatException
Should be overridden to load the actual value from a JDOM-element.
Clients should throw an IOFormatException when element is not
in the correct format.
element
- JDOM element, which is known to be of type
'value'
saveValue
public abstract void saveValue(Element element)
Should be overridden to save the actual value into a JDOM-element.
element
- JDOM element, which is of type 'value'
toElement
public Element toElement()
Converts this value to a JDOM element. Delegates saving of the actual value to
saveValue(Element)
.
toString
public String toString()
toText
public abstract String toText()
Convert this value to a string, so it can be displayed
as part of a GUI.