All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.aggregates.StandardDeviation
java.lang.Object
|
+----JBMSTours.aggregates.StandardDeviation
- public class StandardDeviation
- extends Object
- implements Externalizable, Aggregator, AggregateDefinition
This is a poor man's standard deviation. It only works on
input values of type DOUBLE PRECISION. It is implemented
using VisualNumerics statistics package. It is pretty
primitive in how it works -- i just builds up a big
array of doubles and feeds that to visual numerics.
We implement Externalizable to save space in case we
are written out (Serialization tends to take up a lot
of space).
-
StandardDeviation()
- Niladic constructor
-
accumulate(ResultSet)
- Iteratively accumulates the addend into the aggregator.
-
getAggregator(TypeDescriptor, StringBuffer)
-
-
getResult()
- Produces the result to be returned by the query.
-
getVector()
-
-
initialize()
- Initializes the aggregate for processing.
-
merge(Aggregator)
- Merges one aggregator into a another aggregator.
-
newInstance()
- Return a new instance of this class.
-
readExternal(ObjectInput)
- Read in out doubles.
-
writeExternal(ObjectOutput)
- Write out our double vector as an array of doubles,
with an integer size.
StandardDeviation
public StandardDeviation()
- Niladic constructor
getAggregator
public TypeDescriptor getAggregator(TypeDescriptor inputType,
StringBuffer aggregatorClassName) throws SQLException
- Parameters:
- inputType - the input type descriptor
- aggregatorClassName - output parameter, filled in
with the class name that implements COM.cloudscape.aggregates.Aggregator
- Returns:
- the output type descriptor (which may or may not
be the same as the input type -- it is ok to simply
return the input type). Null is returned
if the aggregate cannot process the input type.
- Throws: SQLException
- if a problem finding type descriptor
- See Also:
- TypeDescriptor
initialize
public void initialize()
- Initializes the aggregate for processing.
accumulate
public void accumulate(ResultSet addend) throws Throwable
- Iteratively accumulates the addend into the aggregator.
Called on each member of the set of values that is being
aggregated.
- Parameters:
- addend - the ResultSet addend (current input to
the aggregation)
- Throws: Throwable
- on error
merge
public void merge(Aggregator inputAggregator) throws Throwable
- Merges one aggregator into a another aggregator.
- Parameters:
- inputAggregator - the other Aggregator
(input partial aggregate)
- Throws: Throwable
- on error
getResult
public Object getResult()
- Produces the result to be returned by the query.
The last processing of the aggregate. Feed
the array of doubles into VisualNumerics.
See
COM.cloudscape.aggregates.AggregateDefinition.getResult().
- Returns:
- the result column.
newInstance
public Aggregator newInstance()
- Return a new instance of this class. Identical
to Class.newInstance() but much cheaper because
reflection is costly.
Just implement it to do new myClass().
- Returns:
- Aggregator
getVector
public Vector getVector()
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Write out our double vector as an array of doubles,
with an integer size.
- Parameters:
- out - the output stream
- Throws: IOException
- on error
readExternal
public void readExternal(ObjectInput in) throws IOException
- Read in out doubles. First read in the size and then
reinstantiate our vector and fill it up.
- Parameters:
- int - the input stream
- Throws: IOException
- on error
All Packages Class Hierarchy This Package Previous Next Index