SketchAggSensor.agg
Interface Aggregator

public interface Aggregator

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
Method Detail

combine

public Object combine(Sensor sensor,
                      Object agg)
Combine the specified sensor reading and the aggregation object
Parameters:
sensor - The sensor whose reading is to be added to the aggregate object
agg - The aggregation object (may be modified and returned)
Returns:
The new aggregate object (may be a reference to agg)
Throws:
InvalidAggregateException - if agg is not the appropriate aggregate type

combine

public Object combine(Object agg1,
                      Object agg2)
Combine two aggregates
Parameters:
agg1 - The first aggregate object (may be modified and returned)
agg2 - The second aggregate object
Returns:
The new aggregate object (may be a reference to agg1)
Throws:
InvalidAggregateException - if agg1 or agg2 is not an appropriate aggregate type

emptyAgg

public Object emptyAgg(Sensor s)
Parameters:
s - The sensor that produced the aggregate value
Returns:
an aggregate object with no entries

getValue

public int getValue(Object agg)
Returns:
the integer aggregate value of an aggregate object

getValueObj

public Object getValueObj(Object agg)
Returns:
the non-integer aggregate value of an aggregate object

getCount

public int getCount(Object agg)
Returns:
the number of sensor contributing to this aggregate, or -1 if unknown

numBytes

public int numBytes(Object agg)
Returns:
the number of bytes this aggregate represents

divide

public void divide(Object agg,
                   int divisor)
Split this aggregate up into divisor parts, so that it can be sent to multiple parents. Modifies agg. May not be supported by all aggregates.
Parameters:
agg - The aggregate to divide -- modified!
Throws:
InvalidAggregateException - if unsupported, or if agg is not an appropriate aggregate type.

cloneAgg

public Object cloneAgg(Object agg)
Returns:
a copy of agg

makeGuess

public Object makeGuess()
Returns:
A "hypothesis" aggregate value that will be used to suppress the aggregate values of sensors above or below this threshold. A hack, since the aggregation function doesn't have access to any other aggregation values when it makes this decision.