Module xl.core

Class AggregateStateImpl<T>

java.lang.Object
de.grogra.xl.util.AggregateStateImpl<T>
All Implemented Interfaces:
AggregateState, BooleanAggregateState, ByteAggregateState, CharAggregateState, DoubleAggregateState, FloatAggregateState, IntAggregateState, LongAggregateState, ObjectAggregateState<T>, ShortAggregateState

Utility class which implements all AggregateState interfaces and provides some general fields for storing state. Instances of this class are pooled so that heap traffic is reduced.
Author:
Ole Kniemeyer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    This field contains the result if the type is a reference type.
    This field may be used freely by aggregate methods.
    This field may be used freely by aggregate methods.
    This field may be used freely by aggregate methods.
    This field may be used freely by aggregate methods.
    double
    This field contains the result if the type is double.
    double
    This field may be used freely by aggregate methods.
    double
    This field may be used freely by aggregate methods.
    double
    This field may be used freely by aggregate methods.
    double
    This field may be used freely by aggregate methods.
    float
    This field contains the result if the type is float.
    float
    This field may be used freely by aggregate methods.
    float
    This field may be used freely by aggregate methods.
    float
    This field may be used freely by aggregate methods.
    float
    This field may be used freely by aggregate methods.
    int
    This field contains the result if the type is boolean, byte, short, char, or int.
    int
    This field may be used freely by aggregate methods.
    int
    This field may be used freely by aggregate methods.
    int
    This field may be used freely by aggregate methods.
    int
    This field may be used freely by aggregate methods.
    long
    This field contains the result if the type is long.
    long
    This field may be used freely by aggregate methods.
    long
    This field may be used freely by aggregate methods.
    long
    This field may be used freely by aggregate methods.
    long
    This field may be used freely by aggregate methods.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    Returns the result of the aggregation.
    byte
    Returns the result of the aggregation.
    char
    Returns the result of the aggregation.
    double
    Returns the result of the aggregation.
    float
    Returns the result of the aggregation.
    int
    Returns the result of the aggregation.
    long
    Returns the result of the aggregation.
    Returns the result of the aggregation.
    short
    Returns the result of the aggregation.
    boolean
    Returns true to indicate the invoker of the aggregate method that the computation of the aggregate value has been completed by the aggregate method, even if there are values left for aggregation.
    void
    Sets the finished-flag to true.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ival

      public int ival
      This field contains the result if the type is boolean, byte, short, char, or int.
    • lval

      public long lval
      This field contains the result if the type is long.
    • fval

      public float fval
      This field contains the result if the type is float.
    • dval

      public double dval
      This field contains the result if the type is double.
    • aval

      public T aval
      This field contains the result if the type is a reference type.
    • ival1

      public int ival1
      This field may be used freely by aggregate methods.
    • ival2

      public int ival2
      This field may be used freely by aggregate methods.
    • ival3

      public int ival3
      This field may be used freely by aggregate methods.
    • ival4

      public int ival4
      This field may be used freely by aggregate methods.
    • lval1

      public long lval1
      This field may be used freely by aggregate methods.
    • lval2

      public long lval2
      This field may be used freely by aggregate methods.
    • lval3

      public long lval3
      This field may be used freely by aggregate methods.
    • lval4

      public long lval4
      This field may be used freely by aggregate methods.
    • fval1

      public float fval1
      This field may be used freely by aggregate methods.
    • fval2

      public float fval2
      This field may be used freely by aggregate methods.
    • fval3

      public float fval3
      This field may be used freely by aggregate methods.
    • fval4

      public float fval4
      This field may be used freely by aggregate methods.
    • dval1

      public double dval1
      This field may be used freely by aggregate methods.
    • dval2

      public double dval2
      This field may be used freely by aggregate methods.
    • dval3

      public double dval3
      This field may be used freely by aggregate methods.
    • dval4

      public double dval4
      This field may be used freely by aggregate methods.
    • aval1

      public Object aval1
      This field may be used freely by aggregate methods.
    • aval2

      public Object aval2
      This field may be used freely by aggregate methods.
    • aval3

      public Object aval3
      This field may be used freely by aggregate methods.
    • aval4

      public Object aval4
      This field may be used freely by aggregate methods.
  • Method Details

    • allocate

      public static AggregateStateImpl<?> allocate()
    • getBooleanResult

      public boolean getBooleanResult()
      Description copied from interface: BooleanAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getBooleanResult in interface BooleanAggregateState
      Returns:
      aggregated value
    • getByteResult

      public byte getByteResult()
      Description copied from interface: ByteAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getByteResult in interface ByteAggregateState
      Returns:
      aggregated value
    • getShortResult

      public short getShortResult()
      Description copied from interface: ShortAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getShortResult in interface ShortAggregateState
      Returns:
      aggregated value
    • getCharResult

      public char getCharResult()
      Description copied from interface: CharAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getCharResult in interface CharAggregateState
      Returns:
      aggregated value
    • getIntResult

      public int getIntResult()
      Description copied from interface: IntAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getIntResult in interface IntAggregateState
      Returns:
      aggregated value
    • getLongResult

      public long getLongResult()
      Description copied from interface: LongAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getLongResult in interface LongAggregateState
      Returns:
      aggregated value
    • getFloatResult

      public float getFloatResult()
      Description copied from interface: FloatAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getFloatResult in interface FloatAggregateState
      Returns:
      aggregated value
    • getDoubleResult

      public double getDoubleResult()
      Description copied from interface: DoubleAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getDoubleResult in interface DoubleAggregateState
      Returns:
      aggregated value
    • getObjectResult

      public T getObjectResult()
      Description copied from interface: ObjectAggregateState
      Returns the result of the aggregation. This is only valid after the aggregate method has been invoked for a last time with its finished argument set to true.
      Specified by:
      getObjectResult in interface ObjectAggregateState<T>
      Returns:
      aggregated value
    • setFinished

      public void setFinished()
      Sets the finished-flag to true. Subsequent invocations of isFinished() will return true.
    • isFinished

      public boolean isFinished()
      Description copied from interface: AggregateState
      Returns true to indicate the invoker of the aggregate method that the computation of the aggregate value has been completed by the aggregate method, even if there are values left for aggregation. E.g., this is the case for a short circuit implementation of the boolean or where the result is known when the first true-value is encountered. The invoker must not invoke the aggregate method again.
      Specified by:
      isFinished in interface AggregateState
      Returns:
      true iff the final aggregated value is already known