de.jstacs.results
Class StorableResult

java.lang.Object
  extended by de.jstacs.AnnotatedEntity
      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 AnnotatedEntity.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.AnnotatedEntity
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 appendFurtherInfos(StringBuffer buf)
          This method can be used in the method Storable.toXML() to extract further information (name, comment, datatype).
protected  void extractFurtherInfos(StringBuffer representation)
          This method can be used in the constructor with parameter StringBuffer to extract the further information.
 String getClassName()
          Returns the name of the class of the Storable corresponding to the XML representation stored in this StorableResult.
 Storable getResultInstance()
          Returns the instance of the Storable that is the result of this StorableResult.
 String getValue()
          Returns the value of the AnnotatedEntity.
 String getXMLTag()
          This method returns a tag used as outer tag of the XML description.
 byte isInitialized()
          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()
           
 
Methods inherited from class de.jstacs.results.Result
checkDatatype, createResult, isCastableResult, isComparableResult
 
Methods inherited from class de.jstacs.AnnotatedEntity
getComment, getDatatype, getName, toXML
 
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 AnnotatedEntity.toXML().

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

isInitialized

public byte isInitialized()
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

getValue

public String getValue()
Description copied from class: AnnotatedEntity
Returns the value of the AnnotatedEntity.

Specified by:
getValue in class AnnotatedEntity
Returns:
the value of the AnnotatedEntity

getResultInstance

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

Returns:
the instance

getXMLTag

public String getXMLTag()
Description copied from class: AnnotatedEntity
This method returns a tag used as outer tag of the XML description.

Specified by:
getXMLTag in class AnnotatedEntity
Returns:
a tag used as outer tag of the XML description

appendFurtherInfos

protected void appendFurtherInfos(StringBuffer buf)
Description copied from class: AnnotatedEntity
This method can be used in the method Storable.toXML() to extract further information (name, comment, datatype).

Specified by:
appendFurtherInfos in class AnnotatedEntity
Parameters:
buf - a XML representation of the main information as StringBuffer
See Also:
Storable.toXML()

extractFurtherInfos

protected void extractFurtherInfos(StringBuffer representation)
                            throws NonParsableException
Description copied from class: AnnotatedEntity
This method can be used in the constructor with parameter StringBuffer to extract the further information.

Specified by:
extractFurtherInfos in class AnnotatedEntity
Parameters:
representation - a XML represenation of the main information as StringBuffer
Throws:
NonParsableException - if the XML representation is not parsable
See Also:
AnnotatedEntity.AnnotatedEntity(StringBuffer)

toString

public String toString()
Overrides:
toString in class Object