urv.olsr.data.neighbour
Class NeighborTable

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<K,java.lang.Integer>
          extended by urv.olsr.data.ExpiringEntryTable<OLSRNode,NeighborTableEntry>
              extended by urv.olsr.data.neighbour.NeighborTable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<OLSRNode,java.lang.Integer>, Loggable, BandwidthUpdatable

public class NeighborTable
extends ExpiringEntryTable<OLSRNode,NeighborTableEntry>
implements Loggable, BandwidthUpdatable

Table which contains information about neighbors of the current node and status with all neighbors. A list of neighbors of neighbors (NoN) is also available for each entry This table contains information about the MPRSelectors of the node Entries will be removed when timeout expires or when receiving anew HELLO_MESSAGE with LinkCode == NOT_NEIGH

Author:
Marcel Arrufat Arias
See Also:
Serialized Form

Constructor Summary
NeighborTable(OLSRNode localNode, NeighborsOfNeighborsSet neighborsOfNeighborsSet)
          Creates a new table (with entries that may expire) for storing all information about neighbors
 
Method Summary
 void addNeighborEntryWithTimestamp(OLSRNode node, NeighborTableEntry entry, int expiringTime)
          Adds a new entry to the table
 HelloMessage createHelloMessage()
          Returns a new hello message from the information stored in the neighbor table
 boolean entryExists(OLSRNode node)
          Checks if the node has an entry inside the Neighbor Table
 OLSRSet getCopyOfNeighbors()
          Returns a copy of a set containing all the neighbors of the node
 OLSRSet getCopyOfSymNeighbors()
          Returns a copy of a set containing all the neighbors of the node
 OLSRNode getLocalNode()
           
 int hashCode()
           
 boolean isNeighborTableChangedFlag()
           
 boolean isRecomputeMprFlag()
           
 boolean isSymmetricNeighbor(OLSRNode node)
          Returns true if the specified node is in the symmetric 1-hop neighborhood of the local node
 void onMPRSetChange(MprSet mprSet2)
          This method is invoked when changes are performed in the tmpMprSet we need to update the link status in the Neighbor Table
 void onTableChange()
           
 void setNeighborTableChangedFlag(boolean neighborTableChanged)
          This Flag is set to true when a new neighbor or 2-hop neighbor is detected
 void setRecomputeMprFlag(boolean recomputeMPR)
           
 java.lang.String toString()
           
 void updateBwOf(OLSRNode originatorNode)
           
 
Methods inherited from class urv.olsr.data.ExpiringEntryTable
addEntryWithTimestamp, decreaseTimeAndProcessEntries, getEntry, getLock, keySet, overwriteEntryWithTimestamp, removeEntry, updateTimestampInEntry
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, isEmpty, keys, put, putAll, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeighborTable

public NeighborTable(OLSRNode localNode,
                     NeighborsOfNeighborsSet neighborsOfNeighborsSet)
Creates a new table (with entries that may expire) for storing all information about neighbors

Parameters:
localNode -
neighborsOfNeighborsSet -
Method Detail

toString

public java.lang.String toString()
Specified by:
toString in interface Loggable
Overrides:
toString in class ExpiringEntryTable<OLSRNode,NeighborTableEntry>

updateBwOf

public void updateBwOf(OLSRNode originatorNode)
Specified by:
updateBwOf in interface BandwidthUpdatable

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map<OLSRNode,java.lang.Integer>
Overrides:
hashCode in class java.util.Hashtable<OLSRNode,java.lang.Integer>

onTableChange

public void onTableChange()
Specified by:
onTableChange in class ExpiringEntryTable<OLSRNode,NeighborTableEntry>

addNeighborEntryWithTimestamp

public void addNeighborEntryWithTimestamp(OLSRNode node,
                                          NeighborTableEntry entry,
                                          int expiringTime)
Adds a new entry to the table

Parameters:
node -
entry -

createHelloMessage

public HelloMessage createHelloMessage()
Returns a new hello message from the information stored in the neighbor table

Returns:
HelloMessage

entryExists

public boolean entryExists(OLSRNode node)
Checks if the node has an entry inside the Neighbor Table

Parameters:
node -

getCopyOfNeighbors

public OLSRSet getCopyOfNeighbors()
Returns a copy of a set containing all the neighbors of the node

Returns:
OLSRSet

getCopyOfSymNeighbors

public OLSRSet getCopyOfSymNeighbors()
Returns a copy of a set containing all the neighbors of the node

Returns:
OLSRSet

isSymmetricNeighbor

public boolean isSymmetricNeighbor(OLSRNode node)
Returns true if the specified node is in the symmetric 1-hop neighborhood of the local node

Parameters:
node -
Returns:
if is a symmetric neighbor

onMPRSetChange

public void onMPRSetChange(MprSet mprSet2)
This method is invoked when changes are performed in the tmpMprSet we need to update the link status in the Neighbor Table

Parameters:
mprSet2 -

getLocalNode

public OLSRNode getLocalNode()
Returns:
Returns the localNode.

isNeighborTableChangedFlag

public boolean isNeighborTableChangedFlag()
Returns:
Returns the neighborTableChangedFlag.

isRecomputeMprFlag

public boolean isRecomputeMprFlag()
Returns:
Returns the recomputeMPR.

setNeighborTableChangedFlag

public void setNeighborTableChangedFlag(boolean neighborTableChanged)
This Flag is set to true when a new neighbor or 2-hop neighbor is detected

Parameters:
neighborTableChangedFlag - The neighborTableChangedFlag to set.

setRecomputeMprFlag

public void setRecomputeMprFlag(boolean recomputeMPR)
Parameters:
recomputeMPR - The recomputeMPR to set.