|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.results.Result
public abstract class Result
The abstract class for any result. Each result should be immutable.
In analogy to the Parameter classes, the Result classes provide the possibility
to return the results of a computation together with some annotation in a standardized way.
| Field Summary | |
|---|---|
protected String |
comment
The comment for the result. |
protected DataType |
datatype
The data type of the result. |
protected String |
name
The name of the result |
| Constructor Summary | |
|---|---|
protected |
Result(StringBuffer rep)
The constructor for the Storable interface. |
protected |
Result(String name,
String comment,
DataType datatype)
The main constructor which takes the main information of a result. |
| Method Summary | |
|---|---|
protected void |
appendMainInfo(StringBuffer buf)
This method can be used in the toXML-method to append the main information (name, comment, datatype). |
static boolean |
checkDatatype(DataType datatype,
Object value)
This method provides the possibility to check the compliance of some result value
with one of the pre-defined DataTypes before creating a new Result and possibly running into an Exception. |
static Result |
createResult(String name,
String comment,
DataType datatype,
Object value)
Factory method to create a new Result. |
protected void |
extractMainInfo(StringBuffer buf)
This method can be used in the fromXML-method to extract the main information (name, comment, datatype). |
protected abstract void |
fromXML(StringBuffer rep)
This method is used in Result(StringBuffer) to extract the information. |
String |
getComment()
Returns the comment on the result. |
DataType |
getDatatype()
Returns the datatype of the result. |
String |
getName()
Returns the name of the result. |
abstract Object |
getResult()
Returns the value of the result. |
boolean |
isCastableResult(Result test)
Returns true if the datatype of test can be casted to that of this instance and both have the same name and
comment for the result. |
boolean |
isComparableResult(Result test)
Returns true if test and the current object have the same datatype, name and
comment for the result. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.jstacs.Storable |
|---|
toXML |
| Field Detail |
|---|
protected String name
protected String comment
protected DataType datatype
| Constructor Detail |
|---|
protected Result(String name,
String comment,
DataType datatype)
name - the name of the resultcomment - the comment for the resultdatatype - the data type of the result
protected Result(StringBuffer rep)
throws NonParsableException
rep - the xml representation
NonParsableException - if the xml representation is not parsableStorable| Method Detail |
|---|
protected abstract void fromXML(StringBuffer rep)
throws NonParsableException
Result(StringBuffer) to extract the information.
The method can be seen as opposite of Storable.toXML() and should not be made public.
rep - a xml represenation
NonParsableException - if the xml representation is not parsableextractMainInfo(StringBuffer)protected void appendMainInfo(StringBuffer buf)
buf - a xml representationStorable.toXML()
protected void extractMainInfo(StringBuffer buf)
throws NonParsableException
buf - a xml represenation
NonParsableException - if the xml representation is not parsablefromXML(StringBuffer)public final DataType getDatatype()
public abstract Object getResult()
public final String getName()
public final String getComment()
public boolean isComparableResult(Result test)
true if test and the current object have the same datatype, name and
comment for the result.
getResult() returns an instance of Comparable.
test - the result to be tested
true if test and the current object have the same datatype, name and
comment for the resultpublic boolean isCastableResult(Result test)
true if the datatype of test can be casted to that of this instance and both have the same name and
comment for the result.
getResult() returns an instance of Comparable.
test - the result to be tested
true if test and the current object have a castable data type, name and
comment for the result
public static boolean checkDatatype(DataType datatype,
Object value)
value
with one of the pre-defined DataTypes before creating a new Result and possibly running into an Exception.
datatype - the data type, value should comply tovalue - the value
value can be stored in a Result of DataType datatype
public static Result createResult(String name,
String comment,
DataType datatype,
Object value)
throws SimpleParameter.IllegalValueException
Result.
name - the name of the Result as chosen by the usercomment - the comment on the Result as chosen by the userdatatype - the data type of valuevalue - the value of the Result
Result instance
SimpleParameter.IllegalValueException - is thrown if datatype is DataType.HTML, DataType.LIST or another DataType not implemented, yet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||