de.jstacs.results
Class MeanResultSet

java.lang.Object
  extended by de.jstacs.results.ResultSet
      extended by de.jstacs.results.NumericalResultSet
          extended by de.jstacs.results.MeanResultSet
All Implemented Interfaces:
Storable

public class MeanResultSet
extends NumericalResultSet

Class that computes the mean and the standard error of a series of NumericalResultSets. Each NumericalResultSet in the series must be added using the method addResults(NumericalResultSet...). The means and the standard errors can be obtained by getStatistics() .

Author:
Jan Grau, Jens Keilwagen

Nested Class Summary
static class MeanResultSet.AdditionImpossibleException
          Class for the exception that is thrown if two MeanResultSets should be added that do not match.
static class MeanResultSet.InconsistentResultNumberException
          Class for the exception that is thrown if a NumericalResultSet is added to the MeanResultSet that has a number of results which is not equal to the number of results of the previously added results.
 
Field Summary
 
Fields inherited from class de.jstacs.results.ResultSet
results
 
Constructor Summary
MeanResultSet()
          Constructs a new MeanResultSet with an empty set of NumericalResultSets and no further information.
MeanResultSet(boolean aggregateAll, SimpleResult... infos)
          Constructs a new MeanResultSet with an empty set of NumericalResultSets and allows to collect all values via the switch aggregateAll.
MeanResultSet(SimpleResult... infos)
          Constructs a new MeanResultSet with an empty set of NumericalResultSets.
MeanResultSet(StringBuffer representation)
          The standard constructor for the interface Storable.
 
Method Summary
static MeanResultSet addResults(MeanResultSet r1, MeanResultSet r2)
          Adds two MeanResultSets together.
 void addResults(NumericalResultSet... rs)
          Adds NumericalResultSets to this MeanResultSet.
protected  void fromXML(StringBuffer representation)
          Parses the contents of a ResultSet from its XML representation as returned by ResultSet.toXML().
 double[] getAllValues(int index)
          Returns all values of the result with index index if available otherwise null.
 ResultSet getInfos()
          Returns some information for this MeanResultSet.
 NumericalResultSet getStatistics()
          Returns the means and (if possible the) standard errors of the results in this MeanResultSet as a new NumericalResultSet.
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class de.jstacs.results.NumericalResultSet
getResultAt
 
Methods inherited from class de.jstacs.results.ResultSet
findColumn, getNumberOfResults, getResultForName, getResults, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MeanResultSet

public MeanResultSet(boolean aggregateAll,
                     SimpleResult... infos)
Constructs a new MeanResultSet with an empty set of NumericalResultSets and allows to collect all values via the switch aggregateAll.

Parameters:
infos - some information to this MeanResultSet
aggregateAll - a switch to decide whether all values should be collected

MeanResultSet

public MeanResultSet(SimpleResult... infos)
Constructs a new MeanResultSet with an empty set of NumericalResultSets.

Parameters:
infos - some information to this MeanResultSet

MeanResultSet

public MeanResultSet()
Constructs a new MeanResultSet with an empty set of NumericalResultSets and no further information.


MeanResultSet

public MeanResultSet(StringBuffer representation)
              throws NonParsableException
The standard constructor for the interface Storable. Creates a new MeanResultSet from the corresponding XML representation.

Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the StringBuffer 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
Overrides:
toXML in class ResultSet
Returns:
the XML representation

fromXML

protected void fromXML(StringBuffer representation)
                throws NonParsableException
Description copied from class: ResultSet
Parses the contents of a ResultSet from its XML representation as returned by ResultSet.toXML().

Overrides:
fromXML in class ResultSet
Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the XML code could not be parsed

addResults

public static MeanResultSet addResults(MeanResultSet r1,
                                       MeanResultSet r2)
                                throws MeanResultSet.AdditionImpossibleException
Adds two MeanResultSets together.

Parameters:
r1 - one MeanResultSet
r2 - another MeanResultSet
Returns:
the merged MeanResultSet
Throws:
MeanResultSet.AdditionImpossibleException - if the Results does not match

addResults

public void addResults(NumericalResultSet... rs)
                throws MeanResultSet.InconsistentResultNumberException,
                       SimpleParameter.IllegalValueException,
                       MeanResultSet.AdditionImpossibleException
Adds NumericalResultSets to this MeanResultSet. The NumericalResultSets are handled as one result. So if you call this method with e.g. three arguments this is the same as adding one combing argument and not the same as calling the method three times, each time with one argument.

Parameters:
rs - the NumericalResultSets to be added
Throws:
MeanResultSet.InconsistentResultNumberException - if the number of results differ
SimpleParameter.IllegalValueException - if the new (merged) value could not be set
MeanResultSet.AdditionImpossibleException - if some results are not comparable (name, comment, type)

getStatistics

public NumericalResultSet getStatistics()
Returns the means and (if possible the) standard errors of the results in this MeanResultSet as a new NumericalResultSet.

Returns:
the means and (if possible the) standard errors of the results in this MeanResultSet

getAllValues

public double[] getAllValues(int index)
Returns all values of the result with index index if available otherwise null.

Parameters:
index - the index of the result
Returns:
all values if available otherwise null

getInfos

public ResultSet getInfos()
Returns some information for this MeanResultSet.

Returns:
the information for this MeanResultSet