com.sentilla.platform.tmote
Class CollectionProtocol.NeighborTable

java.lang.Object
  extended by com.sentilla.platform.tmote.CollectionProtocol.NeighborTable
Enclosing class:
CollectionProtocol

public class CollectionProtocol.NeighborTable
extends Object

Data structure containing the known neighbors of a mote. Used by the CollectionProtocol for storing neighbors and information on routing messages to a host server.

See Also:
CollectionProtocol

Nested Class Summary
 class CollectionProtocol.NeighborTable.Iterator
          Iterator class for the NeighborTable.
 
Constructor Summary
CollectionProtocol.NeighborTable(int maxSize)
          Creates a NeighborTable with a max size of maxSize.
 
Method Summary
 void add(CollectionProtocol.RTable t)
          Add an entry to the table.
 void clear()
          Remove all entries from the neighbor table.
 boolean contains(long id)
          Returns true if the table contains the MAC address id.
 CollectionProtocol.RTable first()
           
 CollectionProtocol.RTable get(long id)
          Get the RTable object contained in the table with MAC address id.
 boolean isEmpty()
          Return true if the table is empty.
 CollectionProtocol.NeighborTable.Iterator iterator()
          Returns an iterator for the neighbor table.
 int size()
          Returns the size of the table.
 void update(long nodeID, byte hops, short cost, int hostSeq)
          Update the table entry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionProtocol.NeighborTable

public CollectionProtocol.NeighborTable(int maxSize)
Creates a NeighborTable with a max size of maxSize.

Parameters:
maxSize - maximum size of the table
Method Detail

first

public CollectionProtocol.RTable first()

add

public void add(CollectionProtocol.RTable t)
Add an entry to the table. Note that this method does not guard against mutliple table entries.

Parameters:
t - RTable object to add to the table

update

public void update(long nodeID,
                   byte hops,
                   short cost,
                   int hostSeq)
Update the table entry.

Parameters:
nodeID - the truncated mote MAC address
hops - the number of hops to the host
cost - the cost of the route through this neighbor
hostSeq - the sequence id that the host transmitted

get

public CollectionProtocol.RTable get(long id)
Get the RTable object contained in the table with MAC address id.

Parameters:
id - MAC address of the neighbor
Returns:
RTable object with MAC address id, null otherwise

contains

public boolean contains(long id)
Returns true if the table contains the MAC address id.

Parameters:
id - MAC address of the neighbor
Returns:
true if the table contains a neighbor with address id, false otherwise

clear

public void clear()
Remove all entries from the neighbor table.


isEmpty

public boolean isEmpty()
Return true if the table is empty.

Returns:
true if the table is empty, false otherwise

size

public int size()
Returns the size of the table.

Returns:
the integer size of the table.

iterator

public CollectionProtocol.NeighborTable.Iterator iterator()
Returns an iterator for the neighbor table. Provides some multi-threading protection.

Returns:
a new iterator for the neighbor table.


Copyright © 2007 Sentilla Corporation. All Rights Reserved.