All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.aggregates.MaxButOneJDK12
java.lang.Object
|
+----JBMSTours.aggregates.MaxButOneJDK12
- public class MaxButOneJDK12
- extends Object
- implements Externalizable, Aggregator, AggregateDefinition
Able to Define and implement the aggregation for MaxButONE in a JDK12
environment. This aggregate returns the runnner up value for the column
(not the max, but the value right
after that).
We implement Externalizable to save space in case we
are written out (Serialization tends to take up a lot
of space).
-
MaxButOneJDK12()
- Niladic constructor
-
accumulate(ResultSet)
- Iteratively accumulates the addend into the aggregator.
-
getAggregator(TypeDescriptor, StringBuffer)
-
-
getResult()
- Produces the result to be returned by the query.
-
getSecondValue()
- Returns the second highest value in the column found so far.
-
getTopValue()
- Returns the highest value in the column found so far.
-
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 our two fields.
-
writeExternal(ObjectOutput)
- Write out our two fields.
MaxButOneJDK12
public MaxButOneJDK12()
- Niladic constructor
getAggregator
public TypeDescriptor getAggregator(TypeDescriptor inputType,
StringBuffer aggregatorClassName)
- 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.
- 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. Used in Group by.
- 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.
In this instance, returns the second highest value in the column.
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
getTopValue
public Object getTopValue()
- Returns the highest value in the column found so far. This method
needs to be public because instances call each other during a
merge.
- Returns:
- topValue
getSecondValue
public Object getSecondValue()
- Returns the second highest value in the column found so far. This method
needs to be public because instances call each other during a
merge.
- Returns:
- secondValue
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Write out our two fields.
- Parameters:
- out - the output stream
- Throws: IOException
- on error
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Read in our two fields.
- Parameters:
- int - the input stream
- Throws: IOException
- on error
- Throws: ClassNotFoundException
- on error
All Packages Class Hierarchy This Package Previous Next Index