de.grogra.xl.lang
Class Aggregate

java.lang.Object
  extended by de.grogra.xl.lang.Aggregate

public final class Aggregate
extends java.lang.Object

An instance of Aggregate is used in aggregate method invocations as specified by the XL programming language. Aggregate methods use such an instance to collect the information about a sequence of values which they need to compute an aggregate value.

Author:
Ole Kniemeyer

Field Summary
 java.lang.Object aval
          This field contains the result if the type is a reference type.
 java.lang.Object aval1
          This field may be used freely by aggregate methods.
 java.lang.Object aval2
          This field may be used freely by aggregate methods.
 java.lang.Object aval3
          This field may be used freely by aggregate methods.
 java.lang.Object aval4
          This field may be used freely by aggregate methods.
 double dval
          This field contains the result if the type is double.
 double dval1
          This field may be used freely by aggregate methods.
 double dval2
          This field may be used freely by aggregate methods.
 double dval3
          This field may be used freely by aggregate methods.
 double dval4
          This field may be used freely by aggregate methods.
 float fval
          This field contains the result if the type is float.
 float fval1
          This field may be used freely by aggregate methods.
 float fval2
          This field may be used freely by aggregate methods.
 float fval3
          This field may be used freely by aggregate methods.
 float fval4
          This field may be used freely by aggregate methods.
 int ival
          This field contains the result if the type is boolean, byte, short, char, or int.
 int ival1
          This field may be used freely by aggregate methods.
 int ival2
          This field may be used freely by aggregate methods.
 int ival3
          This field may be used freely by aggregate methods.
 int ival4
          This field may be used freely by aggregate methods.
 long lval
          This field contains the result if the type is long.
 long lval1
          This field may be used freely by aggregate methods.
 long lval2
          This field may be used freely by aggregate methods.
 long lval3
          This field may be used freely by aggregate methods.
 long lval4
          This field may be used freely by aggregate methods.
 
Method Summary
static Aggregate allocate(java.lang.Class type)
           
static java.lang.Object aval(Aggregate a)
           
static double dval(Aggregate a)
           
static float fval(Aggregate a)
           
 java.lang.Class getType()
          Returns the result type of the aggregation.
 boolean initialize()
          Returns true the first time it is invoked.
 boolean isFinished()
          Returns true iff setFinished() has been called previously.
static int ival(Aggregate a)
           
static long lval(Aggregate a)
           
 void setFinished()
          Sets the finished-flags to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aval

public java.lang.Object aval
This field contains the result if the type is a reference type. It has to be of the type returned by getType().


aval1

public java.lang.Object aval1
This field may be used freely by aggregate methods.


aval2

public java.lang.Object aval2
This field may be used freely by aggregate methods.


aval3

public java.lang.Object aval3
This field may be used freely by aggregate methods.


aval4

public java.lang.Object aval4
This field may be used freely by aggregate methods.


dval

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


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.


fval

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


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.


ival

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


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.


lval

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


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.

Method Detail

allocate

public static Aggregate allocate(java.lang.Class type)

aval

public static java.lang.Object aval(Aggregate a)

dval

public static double dval(Aggregate a)

fval

public static float fval(Aggregate a)

getType

public java.lang.Class getType()
Returns the result type of the aggregation. This has to be respected by aggregate method implementations which compute aggregate values of reference type.

Returns:
the result type
See Also:
aval

initialize

public boolean initialize()
Returns true the first time it is invoked. This has to be queried in implementations of aggregate methods to initialize their computation.

Returns:
true iff this method is invoked the first time for a specific invocation of an aggregate method

isFinished

public boolean isFinished()
Returns true iff setFinished() has been called previously. This is used for two purposes:
  1. To indicate the aggregate method implementation that no more values are available for aggregation. The aggregate method has to compute the final result and place it in the appropriate field (ival, lval, fval, dval, or aval).
  2. 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 shortcut-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.

Returns:
true iff setFinished() has been called previously

ival

public static int ival(Aggregate a)

lval

public static long lval(Aggregate a)

setFinished

public void setFinished()
Sets the finished-flags to true.

See Also:
isFinished()