de.jstacs.results
Class SimpleResult

java.lang.Object
  extended by de.jstacs.results.Result
      extended by de.jstacs.results.SimpleResult
All Implemented Interfaces:
Storable, Comparable<SimpleResult>
Direct Known Subclasses:
CategoricalResult, NumericalResult

public abstract class SimpleResult
extends Result
implements Comparable<SimpleResult>

Abstract class for a Result with a value of a primitive data type or String.

Author:
Jan Grau, Jens Keilwagen
See Also:
Result

Field Summary
protected  Comparable result
          The result.
 
Fields inherited from class de.jstacs.results.Result
comment, datatype, name
 
Constructor Summary
protected SimpleResult(StringBuffer rep)
          This is the constructor for Storable.
protected SimpleResult(String name, String comment, DataType datatype)
          The main constructor which takes the main information of a result.
 
Method Summary
 int compareTo(SimpleResult r)
           
 boolean equals(Object arg)
           
protected  void fromXML(StringBuffer representation)
          This method is used in Result.Result(StringBuffer) to extract the information.
 Comparable getResult()
          Returns the value of the Result.
 String toString()
           
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class de.jstacs.results.Result
appendMainInfo, checkDatatype, createResult, extractMainInfo, getComment, getDatatype, getName, isCastableResult, isComparableResult
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

protected Comparable result
The result.

Constructor Detail

SimpleResult

protected SimpleResult(String name,
                       String comment,
                       DataType datatype)
The main constructor which takes the main information of a result.

Parameters:
name - the name of the result
comment - the comment for the result
datatype - the data type of the result

SimpleResult

protected SimpleResult(StringBuffer rep)
                throws NonParsableException
This is the constructor for Storable. Creates a new SimpleResult out of the XML representation as returned by toXML().

Parameters:
rep - the XML representation as StringBuffer
Throws:
NonParsableException - if the representation could not be parsed.
Method Detail

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML representation as StringBuffer of an instance of the implementing class.

Specified by:
toXML in interface Storable
Returns:
the XML representation

fromXML

protected void fromXML(StringBuffer representation)
                throws NonParsableException
Description copied from class: Result
This method is used in Result.Result(StringBuffer) to extract the information. The method can be seen as opposite of Storable.toXML() and should not be made public.

Specified by:
fromXML in class Result
Parameters:
representation - the XML represenation of the Result to be parsed
Throws:
NonParsableException - if the XML representation is not parsable
See Also:
Result.extractMainInfo(StringBuffer)

getResult

public Comparable getResult()
Description copied from class: Result
Returns the value of the Result.

Specified by:
getResult in class Result
Returns:
the value of the Result

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(SimpleResult r)
Specified by:
compareTo in interface Comparable<SimpleResult>

equals

public boolean equals(Object arg)
Overrides:
equals in class Object