|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.HC.HC_Neighborhood
This class encapsulates the HC_Neighborhood and do all functions regarding that
Specifically, it should do the following jobs:
ageNeighborhood : Should be able to age data and remove stale data
empty : Should be able to check if the HC_Neighborhood is empty
register: It should be able to take a PhysicalAddress-LogicalAddress <
pair and return true if it was able to install it/reset its
age and false otherwise
remove : Remove a neighbor if the physical address matches the one in
the HC_Neighborhood entry
searchTear:
Should return the HC_LogicalAddress of the lowest tear, and
HC_Global.MaxAddress if none exists. The tear reported is
Ttimeout + Tmissing time units old
searchLittleTear:
Should return the HC_LogicalAddress of the lowest tear, and
HC_Global.MaxAddress if none exists. This differs from searchTear in
that tears which are only Ttimeout old are reported
getNthNeighbor:
Gets the HC_AddressPair of the Nth neighbor
resetNeighborhood:
Removes all entries from the neighborhood table
Constructor Summary | |
HC_Neighborhood(hypercast.HC.HC_Node hcnode,
hypercast.StatsProcessor sPro)
Constructs HC_Neighborhood objects with an initialization object and a HC_Node object |
Method Summary | |
int |
ageNeighborhood()
Checks the age of all the Neighborhood. |
boolean |
contains(hypercast.I_LogicalAddress laa)
Check if there exists a neighbor with a specified logical address |
boolean |
empty()
Checks if the neighborhood is empty. |
hypercast.HC.HC_AddressPair |
getHRoot()
Gets HRoot's AddressPair |
int |
getHRootSeqNum()
Gets HRoot's sequence number |
hypercast.HC.HC_AddressPair |
getNeighborPair(hypercast.HC.HC_LogicalAddress laddr)
Gets the AddressPair of a neighbor with a logical address |
hypercast.HC.HC_AddressPair[] |
getNeighbors()
Gets all neighbor's AddressPair |
hypercast.HC.HC_AddressPair |
getNthNeighbor(int n)
Gets the AddressPair of the Nth neighbor |
int |
getNumOfNeighbors()
Returns the number of neighbors in neighbor table |
boolean |
register(hypercast.HC.HC_AddressPair addrpair)
Registers the HC_AddressPair to the node's neighborhood table |
boolean |
remove(hypercast.HC.HC_AddressPair addrpair)
Removes a HC_AddressPair from the neighborhood table |
void |
resetNeighborhood()
Resets the neighborhood table |
int |
searchLittleTear()
Searches Little Tear in all the neighborhood |
int |
searchTear()
Searches a Tear in all neighborhood |
void |
setHRootSeqNum(int newseqnum)
Set HRoot sequence number to a new value |
java.lang.String |
toString()
Converts the HC_Neighborhood object to String format |
boolean |
updateHRoot(hypercast.HC.HC_LogicalAddress laddr,
int curseqnum)
Updates HRoot with HRoot HC_LogicalAddress and sequence number |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public HC_Neighborhood(hypercast.HC.HC_Node hcnode, hypercast.StatsProcessor sPro)
Initialize each of the entries in the HC_Neighborhood table to be "unknown", that is, Physical Address is null in each of those HC_AddressPair objects
hcnode
- a HC_Node object with respect to which the neighborhood will be constructed.Method Detail |
public int ageNeighborhood()
public boolean empty()
public int getNumOfNeighbors()
public boolean register(hypercast.HC.HC_AddressPair addrpair)
Algorithm:
1. Calculate the index of the HC_LogicalAddress in the Neighborhood View
(a) If it is not a neighbor return false
2. Check if the index is occupied;
(a) If it is, check if the PhysicalAddress is the same
(i) If it is, reset the age, and return true
(ii) If it is not, return false
(b) If it is not, install the Pair, and return true
addrpair
- a LogicalAddress/PhysicalAddress pair
public boolean updateHRoot(hypercast.HC.HC_LogicalAddress laddr, int curseqnum)
laddr
- a HC_LogicalAddress objectcurseqnum
- current sequence number
public boolean remove(hypercast.HC.HC_AddressPair addrpair)
Algorithm:
Find the Index and check if physical address is the same
(a) If yes, remove and make that point unknown
(b) If no, make it false
addrpair
- a Node Address
public int searchTear()
Algorithm:
The tear found is one where the neighborhood table entry has been missing
Check each neighbor in turn, in increasing logical address order.
Stop when the neighbor's LA exceeds that of the known HRoot.
If a neighbor is found to be absent, report it as a tear.
public int searchLittleTear()
Algorithm:
The tear found is one where the neighborhood table entry has been missing
for Ttimeout time.
Check each neighbor in turn, in increasing logical address order.
Stop when the neighbor's LA exceeds that of the known HRoot.
If a neighbor is found to be absent, report it as a tear.
public hypercast.HC.HC_AddressPair getNthNeighbor(int n)
n
- integer representing the Index of neighbor
public hypercast.HC.HC_AddressPair getNeighborPair(hypercast.HC.HC_LogicalAddress laddr)
laddr
- a Neighbor's HC_LogicalAddress
public boolean contains(hypercast.I_LogicalAddress laa)
laa
- a I_LogicalAddress
public hypercast.HC.HC_AddressPair[] getNeighbors()
public hypercast.HC.HC_AddressPair getHRoot()
public int getHRootSeqNum()
public void setHRootSeqNum(int newseqnum)
newseqnum
- an integer representing the new sequence numberpublic void resetNeighborhood()
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 |