|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectoogp2p.pastry.LeafSet
A class for representing and manipulating the leaf set. The leafset is not strictly a set: when the ring is small, a node may appear in both the cw and the ccw half of the "set".
| Field Summary | |
private PastryLocation |
baseId
|
private SimilarSet |
ccwSet
|
private SimilarSet |
cwSet
|
private int |
theSize
|
| Constructor Summary | |
LeafSet(PastryLocation localNode,
int size)
Constructor. |
|
| Method Summary | |
int |
ccwSize()
Gets the current counterclockwise size. |
private int |
complement(int inx)
complement - given an index of a node in the leafset, produces the index of the same nodeId in the opposite half of the leafset |
int |
cwSize()
Gets the current clockwise size. |
PastryLocation |
get(int index)
Finds the NodeHandle at a given index. |
PastryLocation |
get(PastryLocation nid)
Finds the NodeHandle associated with the NodeId. |
int |
getIndex(PastryLocation nid)
Gets the index of the element with the given node id. |
java.util.Collection |
getSet()
|
private int |
getUniqueCount()
Returns the number of unique nodes in the leafset |
int |
maxSize()
Gets the maximal size of the leaf set. |
boolean |
member(PastryLocation nid)
Verifies if the set contains this particular id. |
boolean |
merge(LeafSet remotels,
PastryLocation from,
RoutingTable routeTable,
boolean testOnly,
java.util.Set insertedHandles)
Merge a remote leafset into this |
private int |
mod(int x,
int y)
Perform (x mod y). |
int |
mostSimilar(PastryLocation nid)
Numerically closests node to a given a node in the leaf set. |
boolean |
overlaps()
Test if the leafset overlaps |
boolean |
put(PastryLocation handle)
Puts a NodeHandle into the set. |
PastryLocation |
remove(PastryLocation nid)
Removes a node id and its handle from the set. |
int |
size()
Gets the current size of the leaf set. |
boolean |
test(PastryLocation handle)
Test if a put of the given NodeHandle would succeed. |
java.lang.String |
toString()
Returns a string representation of the leaf set |
boolean |
withinRange(PastryLocation pLoc)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private PastryLocation baseId
private SimilarSet cwSet
private SimilarSet ccwSet
private int theSize
| Constructor Detail |
public LeafSet(PastryLocation localNode,
int size)
size - the size of the leaf set.| Method Detail |
public boolean put(PastryLocation handle)
handle - the handle to put.
public boolean test(PastryLocation handle)
handle - the handle to test.
public boolean overlaps()
public PastryLocation get(PastryLocation nid)
nid - a node id.
public int getIndex(PastryLocation nid)
throws java.util.NoSuchElementException
nid - the node id.
java.util.NoSuchElementExceptionpublic PastryLocation get(int index)
index - an index.
public boolean member(PastryLocation nid)
nid - a node id.
public boolean withinRange(PastryLocation pLoc)
public PastryLocation remove(PastryLocation nid)
nid - the node to remove.
public int maxSize()
public int size()
public int cwSize()
public int ccwSize()
private int complement(int inx)
public int mostSimilar(PastryLocation nid)
nid - a node id.
private int getUniqueCount()
private int mod(int x,
int y)
public boolean merge(LeafSet remotels,
PastryLocation from,
RoutingTable routeTable,
boolean testOnly,
java.util.Set insertedHandles)
remotels - the remote leafsetfrom - the node from which we received the leafsetrouteTable - the routing tabletestOnly - if true, do not change the leafsetinsertedHandles - if not null, a Set that contains, upon return of this method, the nodeHandles that would be inserted into this LeafSet if testOnly is true
public java.util.Collection getSet()
public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||