|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinterfaces.ConnectivityOptimizer
interfaces.ConnectivityGrid
public class ConnectivityGrid
Overlay grid of the world where each interface is put on a cell depending of its location. This is used in cell-based optimization of connecting the interfaces.
The idea in short:
Instead of checking for every interface if some of the other interfaces are close
enough (this approach obviously doesn't scale) we check only interfaces that
are "close enough" to be possibly connected. Being close enough is
determined by keeping track of the approximate location of the interfaces
by storing them in overlay grid's cells and updating the cell information
every time the interfaces move. If two interfaces are in the same cell or in
neighboring cells, they have a chance of being close enough for
connection. Then only that subset of interfaces 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.GridCell
A single cell in the cell grid. |
Method Summary | |
---|---|
void |
addInterface(NetworkInterface ni)
Adds a network interface to the overlay grid |
void |
addInterfaces(java.util.Collection<NetworkInterface> interfaces)
Adds interfaces to overlay grid |
static ConnectivityGrid |
ConnectivityGridFactory(int key,
double cellSize)
Returns a connectivity grid object based on a hash value |
java.util.Collection<NetworkInterface> |
getAllInterfaces()
Returns all interfaces that use the same technology and channel |
java.util.Collection<NetworkInterface> |
getNearInterfaces(NetworkInterface netinterf)
Returns all interfaces using the same technology and channel that are in neighboring cells |
void |
removeInterface(NetworkInterface ni)
Removes a network interface from the overlay grid |
static void |
reset()
|
java.lang.String |
toString()
Returns a string representation of the ConnectivityCells object |
void |
updateLocation(NetworkInterface ni)
Checks and updates (if necessary) interface's position in the grid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static void reset()
public static ConnectivityGrid ConnectivityGridFactory(int key, double cellSize)
key
- A hash value that separates different interfaces from each othercellSize
- Cell's edge's length (must be larger than the largest
radio coverage's diameter)
public void addInterface(NetworkInterface ni)
addInterface
in class ConnectivityOptimizer
ni
- The new network interfacepublic void removeInterface(NetworkInterface ni)
ni
- The interface to be removedpublic void addInterfaces(java.util.Collection<NetworkInterface> interfaces)
addInterfaces
in class ConnectivityOptimizer
interfaces
- Collection of interfaces to addpublic void updateLocation(NetworkInterface ni)
updateLocation
in class ConnectivityOptimizer
ni
- The interface to updatepublic java.util.Collection<NetworkInterface> getAllInterfaces()
getAllInterfaces
in class ConnectivityOptimizer
public java.util.Collection<NetworkInterface> getNearInterfaces(NetworkInterface netinterf)
getNearInterfaces
in class ConnectivityOptimizer
netinterf
- network interface that needs to be connected
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 |