avrora.sim.radio.freespace
Class LocalAirImpl

java.lang.Object
  extended byavrora.sim.radio.freespace.LocalAirImpl
All Implemented Interfaces:
LocalAir

public class LocalAirImpl
extends java.lang.Object
implements LocalAir

Implementation of Local Air


Nested Class Summary
protected  class LocalAirImpl.Deliver
          handles the final delivery to the radio
 
Nested classes inherited from class avrora.sim.radio.freespace.LocalAir
LocalAir.PowerRadioPacket
 
Field Summary
 
Fields inherited from interface avrora.sim.radio.freespace.LocalAir
bytePeriod, sampleTime
 
Constructor Summary
LocalAirImpl(Radio r, Position pos)
          new local air
 
Method Summary
 void addNeighbor(LocalAir r)
          add neighbor
 void addPacket(Radio.RadioPacket p, double pow, Radio sender)
          receive a packet
protected  long computeNextDelivery(long globalTime)
          find the right packet to deliver
 java.util.Iterator getNeighbors()
          tell me, who is around
 Position getPosition()
          get node position
 Radio getRadio()
           
 void removeNeighbor(LocalAir r)
          remove a node
 int sampleRSSI(long cycles)
          compute signal strength bases on @see avrora.sim.radio.SimpleAir#sampleRSSI(long) by Daniel Lee
 void scheduleDelivery(long globalTime, Simulator sim)
          schedule a packet for delivery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalAirImpl

public LocalAirImpl(Radio r,
                    Position pos)
new local air

Parameters:
r - radio
pos - position
Method Detail

getPosition

public Position getPosition()
get node position

Specified by:
getPosition in interface LocalAir
Returns:
node position
See Also:
LocalAir.getPosition()

getRadio

public Radio getRadio()
Specified by:
getRadio in interface LocalAir

addNeighbor

public void addNeighbor(LocalAir r)
add neighbor

Specified by:
addNeighbor in interface LocalAir
Parameters:
r - node radio
See Also:
LocalAir.addNeighbor(avrora.sim.radio.freespace.LocalAir)

removeNeighbor

public void removeNeighbor(LocalAir r)
remove a node

Specified by:
removeNeighbor in interface LocalAir
Parameters:
r - node radio
See Also:
LocalAir.removeNeighbor(avrora.sim.radio.freespace.LocalAir)

getNeighbors

public java.util.Iterator getNeighbors()
tell me, who is around

Specified by:
getNeighbors in interface LocalAir
Returns:
node list iterator
See Also:
LocalAir.getNeighbors()

addPacket

public void addPacket(Radio.RadioPacket p,
                      double pow,
                      Radio sender)
receive a packet

Specified by:
addPacket in interface LocalAir
Parameters:
p - packet
pow - transission power
See Also:
LocalAir.addPacket(avrora.sim.radio.Radio.RadioPacket, double, avrora.sim.radio.Radio)

sampleRSSI

public int sampleRSSI(long cycles)
compute signal strength bases on @see avrora.sim.radio.SimpleAir#sampleRSSI(long) by Daniel Lee

Specified by:
sampleRSSI in interface LocalAir
Parameters:
cycles - time
Returns:
signal strength
See Also:
LocalAir.sampleRSSI(long)

scheduleDelivery

public void scheduleDelivery(long globalTime,
                             Simulator sim)
schedule a packet for delivery

Specified by:
scheduleDelivery in interface LocalAir
Parameters:
globalTime - delivery time
sim - the simulator
See Also:
LocalAir.scheduleDelivery(long, avrora.sim.Simulator)

computeNextDelivery

protected long computeNextDelivery(long globalTime)
find the right packet to deliver

Parameters:
globalTime - current time
Returns:
time to deliver