net.tinyos.tinydb
Class AggExpr

java.lang.Object
  |
  +--net.tinyos.tinydb.AggExpr
All Implemented Interfaces:
QueryExpr

public class AggExpr
extends java.lang.Object
implements QueryExpr

Class to represent an aggregation expression. Aggregates are of the form: [aggf(fielda),groupby(fieldb)] Aggf is an aggregation function from AggOp, and groupby may be NO_GROUPING, indicating an ungrouped aggregate


Field Summary
static short NO_GROUPING
           
 
Constructor Summary
AggExpr(short field, net.tinyos.tinydb.AggOp op)
          Create an aggregate expression and set the groupBy field later.
AggExpr(short field, net.tinyos.tinydb.AggOp op, short groupBy)
          Create an aggregate expression applying the specified operation to field, grouping by field groupBy.
AggExpr(short field, java.lang.String fieldOp, short fieldConst, net.tinyos.tinydb.AggOp op)
           
AggExpr(short field, java.lang.String fieldOp, short fieldConst, net.tinyos.tinydb.AggOp op, short groupBy)
          Create an aggregate expression that applies a simple arithmetic expression to the field before applying the aggregate operator
 
Method Summary
 net.tinyos.tinydb.AggOp getAgg()
           
 byte getAggOpCode()
           
 short getField()
          Return the id of the field this expression applies to
 short getFieldConst()
          fieldConst is the constant in the arithmetic operation specified by fieldOp
 short getFieldOp()
          fieldOp is a constant representing a simple arithmetic operator that will be performed on the value of the attribute before the aggregate is computed.
 short getGroupField()
           
 short getGroupFieldConst()
          groupFieldConst is a constant value that is used inthe arithmetic operation specified by groupFieldOp
 short getGroupFieldOp()
          groupFieldOp is a constant representing a simple arithmetic operator that will be performed on the value of the group by attribute before the groups are defined.
 boolean isAgg()
          Return true if this expression is an aggregator
 boolean isTemporalAgg()
           
 void setFieldConst(short fieldConst)
           
 void setFieldOp(java.lang.String fieldOpStr)
           
 void setGroupField(short groupBy)
           
 void setGroupFieldConst(short groupFieldConst)
           
 void setGroupFieldOp(java.lang.String groupFieldOpStr)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_GROUPING

public static final short NO_GROUPING
See Also:
Constant Field Values
Constructor Detail

AggExpr

public AggExpr(short field,
               net.tinyos.tinydb.AggOp op,
               short groupBy)
Create an aggregate expression applying the specified operation to field, grouping by field groupBy.

Parameters:
field - The field to aggregate
op - The operator to aggregate with
groupBy - The field to group by, or NO_GROUPING

AggExpr

public AggExpr(short field,
               java.lang.String fieldOp,
               short fieldConst,
               net.tinyos.tinydb.AggOp op,
               short groupBy)
Create an aggregate expression that applies a simple arithmetic expression to the field before applying the aggregate operator


AggExpr

public AggExpr(short field,
               net.tinyos.tinydb.AggOp op)
Create an aggregate expression and set the groupBy field later. Added by Kyle


AggExpr

public AggExpr(short field,
               java.lang.String fieldOp,
               short fieldConst,
               net.tinyos.tinydb.AggOp op)
Method Detail

isAgg

public boolean isAgg()
Description copied from interface: QueryExpr
Return true if this expression is an aggregator

Specified by:
isAgg in interface QueryExpr

isTemporalAgg

public boolean isTemporalAgg()

getField

public short getField()
Description copied from interface: QueryExpr
Return the id of the field this expression applies to

Specified by:
getField in interface QueryExpr

getGroupField

public short getGroupField()

setGroupField

public void setGroupField(short groupBy)

getAggOpCode

public byte getAggOpCode()

getAgg

public net.tinyos.tinydb.AggOp getAgg()

getGroupFieldOp

public short getGroupFieldOp()
groupFieldOp is a constant representing a simple arithmetic operator that will be performed on the value of the group by attribute before the groups are defined.


setGroupFieldOp

public void setGroupFieldOp(java.lang.String groupFieldOpStr)

getGroupFieldConst

public short getGroupFieldConst()
groupFieldConst is a constant value that is used inthe arithmetic operation specified by groupFieldOp


setGroupFieldConst

public void setGroupFieldConst(short groupFieldConst)

getFieldOp

public short getFieldOp()
fieldOp is a constant representing a simple arithmetic operator that will be performed on the value of the attribute before the aggregate is computed.

Specified by:
getFieldOp in interface QueryExpr

setFieldOp

public void setFieldOp(java.lang.String fieldOpStr)

getFieldConst

public short getFieldConst()
fieldConst is the constant in the arithmetic operation specified by fieldOp

Specified by:
getFieldConst in interface QueryExpr

setFieldConst

public void setFieldConst(short fieldConst)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object