| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcore.ConnectivityGrid
public class ConnectivityGrid
Overlay grid of the world where each node is put on a cell depending of its location. This is used in cell-based optimization of connecting the nodes.
The idea in short:
 Instead of checking for every node if some of the other nodes are close
 enough (this approach obviously doesn't scale) we check only nodes that
 are "close enough" to be possibly connected. Being close enough is
 determined by keeping track of the approximate location of the nodes 
 by storing them in overlay grid's cells and updating the cell information
 every time the nodes move. If two nodes are in the same cell or in 
 neighboring cells, they have a chance of being close enough for
 connection. Then only that subset of nodes is checked for possible
 connectivity. 
 
Note: this class does NOT support negative coordinates. Also, it makes sense to normalize the coordinates to start from zero to conserve memory.
| Nested Class Summary | |
|---|---|
|  class | ConnectivityGrid.GridCellA single cell in the cell grid. | 
| Constructor Summary | |
|---|---|
| ConnectivityGrid(int worldSizeX,
                 int worldSizeY,
                 int cellSize)Creates a new overlay connectivity grid | |
| Method Summary | |
|---|---|
|  void | addNodes(java.util.Collection<DTNHost> nodes)Adds nodes to overlay grid | 
|  void | connectAllNearNodes()Connects all nodes, that are in adjacent cells, to each other. | 
|  void | connectToNearNodes(DTNHost node)Connects a node to all nodes that are in the same cell or in adjacent cells. | 
|  java.lang.String | toString()Returns a string representation of the ConnectivityCells object | 
|  void | updateLocation(DTNHost node)Checks and updates (if necessary) node's position in the grid | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public ConnectivityGrid(int worldSizeX,
                        int worldSizeY,
                        int cellSize)
worldSizeX - Width of the world (biggest possible x coordinate)worldSizeY - Height of the world (biggest possible y coordinate)cellSize - Cell's edge's length (must be larger than the largest
        radio coverage's diameter)| Method Detail | 
|---|
public void addNodes(java.util.Collection<DTNHost> nodes)
nodes - Collection of nodes to addpublic void updateLocation(DTNHost node)
node - The node to updatepublic void connectToNearNodes(DTNHost node)
node - Node to connectconnectAllNearNodes()public void connectAllNearNodes()
connectToNearNodes(DTNHost)public java.lang.String toString()
toString in class java.lang.Object| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||