de.jstacs.results
Class StorableResult

java.lang.Object
  extended by de.jstacs.results.Result
      extended by de.jstacs.results.StorableResult
All Implemented Interfaces:
Storable

public class StorableResult
extends Result

Class for Results that are Storables. The method toXML() is used to save the StorableResult together with the result to an XML representation, or in the method toString().

Author:
Jan Grau
See Also:
Storable

Field Summary
static byte FALSE
          The model/classifier has not been trained.
static byte NA
          The Storable cannot be trained anyway.
static byte TRUE
          The model/classifier has been trained.
 
Fields inherited from class de.jstacs.results.Result
comment, datatype, name
 
Constructor Summary
StorableResult(StringBuffer buf)
          The standard constructor for the interface Storable.
StorableResult(String name, String comment, Storable object)
          Creates a result for an XML representation of an object.
 
Method Summary
protected  void fromXML(StringBuffer representation)
          This method is used in Result.Result(StringBuffer) to extract the information.
 String getClassName()
          Returns the name of the class of the Storable corresponding to the XML representation stored in this StorableResult.
 String getResult()
          Returns the value of the Result.
 Storable getResultInstance()
          Returns the instance of the Storable that is the result of this StorableResult.
 byte isTrained()
          Returns TRUE if the model or classifier was trained when obtaining its XML representation stored in this StorableResult, FALSE if it was not, and NA if the object could not be trained anyway.
 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NA

public static final byte NA
The Storable cannot be trained anyway.

See Also:
Constant Field Values

FALSE

public static final byte FALSE
The model/classifier has not been trained.

See Also:
Constant Field Values

TRUE

public static final byte TRUE
The model/classifier has been trained.

See Also:
Constant Field Values
Constructor Detail

StorableResult

public StorableResult(String name,
                      String comment,
                      Storable object)
Creates a result for an XML representation of an object.

Parameters:
name - the name of the result
comment - a comment on the result
object - the Storable that is the result

StorableResult

public StorableResult(StringBuffer buf)
               throws NonParsableException
The standard constructor for the interface Storable. Constructs a new StorableResult from its XML representation as returned by toXML().

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

isTrained

public byte isTrained()
Returns TRUE if the model or classifier was trained when obtaining its XML representation stored in this StorableResult, FALSE if it was not, and NA if the object could not be trained anyway.

Returns:
if the model or classifier was trained or not

getClassName

public String getClassName()
Returns the name of the class of the Storable corresponding to the XML representation stored in this StorableResult.

Returns:
the name of the class

getResult

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

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

getResultInstance

public Storable getResultInstance()
Returns the instance of the Storable that is the result of this StorableResult.

Returns:
the instance

toXML

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

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)

toString

public String toString()
Overrides:
toString in class Object