de.grogra.xl.lang
Class Filter

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

public final class Filter
extends java.lang.Object

An instance of Filter is used in filter method invocations as specified by the XL programming language. Filter methods use such an instance to store state information which they need to perform the filtering.

Author:
Ole Kniemeyer

Field Summary
 boolean accept
          An invocation of a filter method has to set this field to indicate whether the invocation has passed the filter or not.
 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 filter methods.
 java.lang.Object aval2
          This field may be used freely by filter methods.
 java.lang.Object aval3
          This field may be used freely by filter methods.
 double dval
          This field contains the result if the type is double.
 double dval1
          This field may be used freely by filter methods.
 double dval2
          This field may be used freely by filter methods.
 double dval3
          This field may be used freely by filter methods.
 float fval
          This field contains the result if the type is float.
 float fval1
          This field may be used freely by filter methods.
 float fval2
          This field may be used freely by filter methods.
 float fval3
          This field may be used freely by filter 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 filter methods.
 int ival2
          This field may be used freely by filter methods.
 int ival3
          This field may be used freely by filter methods.
 long lval
          This field contains the result if the type is long.
 long lval1
          This field may be used freely by filter methods.
 long lval2
          This field may be used freely by filter methods.
 long lval3
          This field may be used freely by filter methods.
 
Method Summary
static Filter allocate(java.lang.Class type)
           
 java.lang.Class getType()
          Returns the result type of the filter.
 boolean initialize()
          Returns true the first time it is invoked.
 boolean isFinished()
          Returns true iff setFinished() has been called previously.
 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

accept

public boolean accept
An invocation of a filter method has to set this field to indicate whether the invocation has passed the filter or not. If this field is set to true, the filter method also has to set the val-field corresponding to the result type to the filtered value. Otherwise, the invocation has not passed the filter.


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 filter methods.


aval2

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


aval3

public java.lang.Object aval3
This field may be used freely by filter 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 filter methods.


dval2

public double dval2
This field may be used freely by filter methods.


dval3

public double dval3
This field may be used freely by filter 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 filter methods.


fval2

public float fval2
This field may be used freely by filter methods.


fval3

public float fval3
This field may be used freely by filter 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 filter methods.


ival2

public int ival2
This field may be used freely by filter methods.


ival3

public int ival3
This field may be used freely by filter 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 filter methods.


lval2

public long lval2
This field may be used freely by filter methods.


lval3

public long lval3
This field may be used freely by filter methods.

Method Detail

allocate

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

getType

public java.lang.Class getType()
Returns the result type of the filter. This has to be respected by filter method implementations which compute resulting 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 filter methods to initialize their state.

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

isFinished

public boolean isFinished()
Returns true iff setFinished() has been called previously. This is used to indicate the invoker of the filter method that it must not invoke the filter method any more, even if there are values left for filtering.

Returns:
true iff setFinished() has been called previously

setFinished

public void setFinished()
Sets the finished-flags to true. This may only be invoked by filter methods.

See Also:
isFinished()