|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectau.edu.usyd.corona.middleLayer.Clustering
class Clustering
This class implements the HEED clustering protocol as described in http://www.cs.purdue.edu/homes/fahmy/papers/tmc04.pdf. It also stores information about this nodes cluster head/cluster children.
| Field Summary | |
|---|---|
(package private) static int |
DEFAULT_INTER_CLUSTER_POWER_LEVEL
|
(package private) static int |
DEFAULT_INTRA_CLUSTER_POWER_LEVEL
|
| Constructor Summary | |
|---|---|
Clustering()
|
|
| Method Summary | |
|---|---|
(package private) void |
addChild(long node)
Add a child node |
(package private) void |
clearChildren()
Remove all cluster children |
void |
doStep2(RoutingAction action)
Run one iteration of step 2 of the clustering algorithm |
(package private) void |
doStep3(RoutingAction action)
|
(package private) java.lang.Long[] |
getChildren()
Return an array of children of this cluster head |
(package private) long |
getClusterHead()
Return this nodes cluster head |
(package private) int |
getCost()
Get the cost of this node to determine which cluster head to join |
(package private) int |
getInterClusterPowerLevel()
Return the power level for inter-cluster communications |
(package private) int |
getIntraClusterPowerLevel()
Return the power level to be used for intra-cluster communications |
(package private) int |
getNumberChildren()
Return the number of children this cluster head has |
(package private) boolean |
hasChild(java.lang.Long node)
Return whether this cluster head has a child with the given ID |
(package private) boolean |
hasChildren()
Return whether this node has any cluster children |
(package private) boolean |
isClusterHead()
True if this node is a cluster head, otherwise false |
(package private) void |
receiveCHFinal(RoutingAction action)
Receive a final cluster head message from a cluster head. |
(package private) void |
receiveCHTentative(RoutingAction action)
Receive a tentative cluster head message from a tentative cluster head. |
(package private) void |
removeChild(long node)
Remove a cluster child |
(package private) void |
removeCost(long node)
Remove the cost of a node, registered in the costs table |
(package private) void |
removeHead(long node)
Remove a potential cluster head |
(package private) void |
resetState()
Remove all cluster heads and children. |
(package private) void |
runHEED()
Run the HEED clustering algorithm on this node. |
(package private) void |
sendClusterHeadMessage(byte type)
Broadcast a cluster head message |
(package private) void |
sendClusterHeadMessage(byte type,
long node)
Send a cluster head message to a particular node |
(package private) void |
setInterClusterPowerLevel(int powerLevel)
|
(package private) void |
setIntraClusterPowerLevel(int powerLevel)
|
(package private) void |
updateCost(long node,
int cost)
Update the cost of a node |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final int DEFAULT_INTRA_CLUSTER_POWER_LEVEL
static final int DEFAULT_INTER_CLUSTER_POWER_LEVEL
| Constructor Detail |
|---|
public Clustering()
| Method Detail |
|---|
void resetState()
void receiveCHFinal(RoutingAction action)
action - The routing messagevoid receiveCHTentative(RoutingAction action)
action - The routing messagevoid runHEED()
public void doStep2(RoutingAction action)
action - A routing message with the HEED values from the previous
iteration of the algorithmvoid doStep3(RoutingAction action)
void sendClusterHeadMessage(byte type)
type - Tentative of Final cluster head
void sendClusterHeadMessage(byte type,
long node)
type - Tentative of Final cluster headnode - The node to send toint getCost()
long getClusterHead()
int getNumberChildren()
java.lang.Long[] getChildren()
boolean isClusterHead()
boolean hasChild(java.lang.Long node)
node - the node id of a potential cluster child
void setIntraClusterPowerLevel(int powerLevel)
powerLevel - the intracluster power levelvoid setInterClusterPowerLevel(int powerLevel)
powerLevel - the intercluster power levelint getIntraClusterPowerLevel()
int getInterClusterPowerLevel()
void removeHead(long node)
node - The cluster head to removevoid removeChild(long node)
node - The cluster child to remove
void updateCost(long node,
int cost)
node - The node to updatecost - The cost of the nodevoid addChild(long node)
node - The ID of the node to add as a childvoid clearChildren()
boolean hasChildren()
void removeCost(long node)
node - The cost of the node to remove
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||