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 Link icon

    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 Link icon

    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 Link icon

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

    • ival Link icon

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    • allocate Link icon

      public static AggregateStateImpl<?> allocate()
    • getBooleanResult Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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