SketchAggSensor.message
Class AggMessage

public class AggMessage
extends Message

Title: Aggregation Query in Sensor Network with Sketches

Description: This code is for the simulation of sensor network with sketches algorithms. It applies with aggregation queries.

Copyright: Computer Science Department, Boston University,Copyright (c) 2003

Company: Boston University

Version:
1.0
Author:
Feifei Li
Field Detail

guessAgg

public Object guessAgg
The guess (hypothesis) aggregate asssociated with this message, if any.

groupBy

public Grouping groupBy
The groupBy predicate associated with this message

having

public Predicate having
Having predicate, currently unsupported.

Constructor Detail

AggMessage

public AggMessage(Sensor sender,
                  int epoch,
                  Vector aggs,
                  int level,
                  Vector parents,
                  Grouping groupBy,
                  Predicate having,
                  int bytes)
Constructor
Parameters:
sender - The sensor that is sending the message
epoch - The epoch in which the message was sent (see {@link Clock#getEpoch(int) Clock.getEpoch})
aggs - A vector of partial state records representing the aggregates from this child and its children partitioned by group.
level - The level of the sender
parent - The parent of the sender
groupBy - The grouping applied to aggs
having - The having predicate (not currently supported)
bytes - The number of bytes required for this message (hack used for state measurement)

AggMessage

public AggMessage(Sensor sender,
                  int epoch,
                  Object agg,
                  int level,
                  Vector parents,
                  int bytes)
Constructor for non-grouped aggregates
Parameters:
sender - The sensor that is sending the message
epoch - The epoch in which the message was sent (see {@link Clock#getEpoch(int) Clock.getEpoch()} )
agg - A partial state records representing the aggregates from this child and its children.
level - The level of the sender
parent - The parent of the sender
bytes - The number of bytes required for this message (hack used for state measurement)

Method Detail

getAggregate

public Object getAggregate()
Returns:
the value of the aggregate in this message. Value can be decoded by calling {@link Aggregator#getValue(Object) Aggregator.getValue()} If the aggregate is grouped, return the value of the first group.

getAggregate

public Object getAggregate(int group)
Parameters:
group - The group whose value should be fetched.
Returns:
The value of the specified group. Value can be decoded by calling {@link Aggregator#getValue(Object) Aggregator.getValue()}.
Throws:
NoSuchElementException - If the group is invalid.

getAggregates

public Vector getAggregates()
Returns:
A reference to the vector of aggregates in this AggMessage

getLevel

public int getLevel()
Returns:
The level of the sender of this agg message

getParent

public Vector getParent()
Returns:
The parent of the sender of this agg message

getInfo

public ParentInfo getInfo()
Returns:
A ParentInfo object representing the attributes of this sensor that can be used in parent selection