SketchAggSensor.message
Class Message

public class 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

sender

protected Sensor sender
The sender of the message

recipients

protected Vector recipients
The recipients of this message

isBroadcast

protected boolean isBroadcast
Is this a broadcast message? Broadcase messages can be heard by all neighbors within hearing range --
See Also:
Topology
RealisticTopology

epoch

protected int epoch
Epoch this message was sent

bytes

protected int bytes
Number of bytes used in this message

Constructor Detail

Message

public Message(Sensor sender,
               int epoch,
               int bytes,
               boolean broadcast)
Create a new message
Parameters:
sender - The sender of the message
epoch - The epoch this message was sent
bytes - The number of bytes of the message

Method Detail

getSender

public Sensor getSender()
Return the sender of the message

addRecipient

public void addRecipient(int recID)
Add the specified sensor id {@link Sensor#getId() Sensor.getId()} as a receipient of the message

isBroadcast

public boolean isBroadcast()
Returns:
Is this message a broadcast message ?

setBroadcast

public void setBroadcast(boolean val)
Parameters:
val - Set the broadcast flag to this value

isRecipient

public boolean isRecipient(int id)
Parameters:
id - The id of the sensor to look for
Returns:
true if the specified sensor id is a recipient

numBytes

public int numBytes()
Returns:
The number of bytes required to encode this message

getEpoch

public int getEpoch()
Returns:
The epoch in which this message was encoded