SketchAggSensor.topology
Class Topology
- public class Topology
- implements ClockListener
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
Topology
public Topology(int width,
int height,
int radius)
- Constructor -- intiailize an empty topology of the specified size.
- Parameters:
width
- The width of the topology, in integer units
height
- The height of the topology
addSensor
public void addSensor(SensorInterface s,
int x,
int y)
- Add a sensor to the topology at the specified location The (internally stored) location of the sensor is also updated
- Parameters:
s
- The sensor to add
x
- The x location of the sensor
y
- The y location of the sensor
getSensorsAt
public Vector getSensorsAt(int x,
int y)
- Returns:
- Vector containing the sensors at (x,y) (see {@link Sensor Sensor})
radiateMessage
public void radiateMessage(Message m,
int x,
int y)
- Radiate a message out from the specified point on the topology. Message radiate 1 unit in all directions. Messages are not echoed to their sender . Handles reentrancy -- so sensors that send messages while a message is being delivered will have their messages enqueued.
- Parameters:
m
- The message to send
x
- The x coordinate of the origin of the message
y
- The y coordinate of the origin of the message
neighbors
public Enumeration neighbors(int x,
int y)
- Return an enumeration of neighbors (type {@link Sensor Sensor}) Allows extensions which create funky connectivities
validLoc
public boolean validLoc(int x,
int y)
- Returns:
- true iff the specified coordinates are a valid location within the topology
width
public int width()
- Returns:
- The width, in sensors of the topology
height
public int height()
- Returns:
- The height, in sensors of the topology
sensors
public Enumeration sensors()
- Returns:
- An enumeration of all sensors in this topology
sentCount
public int sentCount()
- Returns:
- A count of the total number of messages sent in this topology
sentBytes
public int sentBytes()
- Returns:
- A count of the total number of bytes sent in this topology
readCount
public int readCount()
- Returns:
- A count of the total number of messages heard by all sensors in this topology
killSensors
public void killSensors(int x,
int y)
- Disable the sensors at the specified location. Disabled sensors neither send for forward aggregate messages
deactivateSensors
public void deactivateSensors(int x,
int y)
- Deactivate the sensors at the specified location. Deactivated sensors forward aggregate values, but don't include their own readings.
getReading
public int getReading(int x,
int y)
- Return the sensor reading at the current location...