|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.util.Observable
|
+--rice.pastry.leafset.SimilarSet
A set of nodes, ordered by numerical distance of their nodeId from the local nodeId
| Constructor Summary | |
SimilarSet(rice.pastry.NodeHandle localNode,
int size,
boolean cw)
Constructor. |
|
| Method Summary | |
rice.pastry.NodeHandle |
get(int i)
Gets the ith element in the set. |
rice.pastry.NodeHandle |
get(rice.pastry.NodeId nid)
Finds the NodeHandle associated with the NodeId. |
rice.p2p.commonapi.NodeHandle |
getHandle(rice.p2p.commonapi.Id id)
Finds the NodeHandle associated with the NodeId. |
rice.p2p.commonapi.NodeHandle |
getHandle(int i)
Gets the ith element in the set. |
int |
getIndex(rice.pastry.NodeId nid)
Gets the index of the element with the given node id. |
int |
getIndexHandle(rice.p2p.commonapi.Id id)
Gets the index of the element with the given node id. |
boolean |
member(rice.pastry.NodeId nid)
Verifies if the set contains this particular id. |
boolean |
memberHandle(rice.p2p.commonapi.Id id)
Verifies if the set contains this particular id. |
int |
mostSimilar(rice.pastry.Id nid)
Numerically closest node to a given a node. |
boolean |
put(rice.pastry.NodeHandle handle)
Puts a NodeHandle into the set. |
boolean |
putHandle(rice.p2p.commonapi.NodeHandle handle)
Puts a NodeHandle into the set. |
rice.pastry.NodeHandle |
remove(int i)
Removes a node id and its handle from the set. |
rice.pastry.NodeHandle |
remove(rice.pastry.NodeId nid)
Removes a node id and its handle from the set. |
rice.p2p.commonapi.NodeHandle |
removeHandle(rice.p2p.commonapi.Id id)
Removes a node id and its handle from the set. |
int |
size()
Gets the current size of this set. |
protected void |
swap(int i,
int j)
swap two elements |
boolean |
test(rice.pastry.NodeHandle handle)
Test if a NodeHandle belongs into the set. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Is called by the Observer pattern whenever the liveness or proximity of a registered node handle is changed. |
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SimilarSet(rice.pastry.NodeHandle localNode,
int size,
boolean cw)
localNode - the local nodesize - the size of the similar set.cw - true if this is the clockwise leafset half| Method Detail |
protected void swap(int i,
int j)
i - the index of the first elementj - the indes of the second elementpublic boolean test(rice.pastry.NodeHandle handle)
handle - the handle to test.
public boolean put(rice.pastry.NodeHandle handle)
put in interface NodeSetIhandle - the handle to put.
public void update(java.util.Observable o,
java.lang.Object arg)
update in interface java.util.Observero - The node handlearg - the event type (PROXIMITY_CHANGE, DECLARED_LIVE, DECLARED_DEAD)public rice.pastry.NodeHandle get(rice.pastry.NodeId nid)
get in interface NodeSetInid - a node id.
public rice.pastry.NodeHandle get(int i)
get in interface NodeSetIi - an index. i == -1 refers to the local node
public boolean member(rice.pastry.NodeId nid)
member in interface NodeSetInid - a node id.
public rice.pastry.NodeHandle remove(rice.pastry.NodeId nid)
remove in interface NodeSetInid - the node to remove.
public rice.pastry.NodeHandle remove(int i)
i - the index of the node to remove.
public int getIndex(rice.pastry.NodeId nid)
getIndex in interface NodeSetInid - the node id.
public int size()
size in interface NodeSetIpublic int mostSimilar(rice.pastry.Id nid)
nid - a node id.
public boolean putHandle(rice.p2p.commonapi.NodeHandle handle)
putHandle in interface NodeHandleSethandle - the handle to put.
public rice.p2p.commonapi.NodeHandle getHandle(rice.p2p.commonapi.Id id)
getHandle in interface NodeHandleSetid - a node id.
public rice.p2p.commonapi.NodeHandle getHandle(int i)
getHandle in interface NodeHandleSeti - an index.
public boolean memberHandle(rice.p2p.commonapi.Id id)
memberHandle in interface NodeHandleSetid - a node id.
public rice.p2p.commonapi.NodeHandle removeHandle(rice.p2p.commonapi.Id id)
removeHandle in interface NodeHandleSet
public int getIndexHandle(rice.p2p.commonapi.Id id)
throws java.util.NoSuchElementException
getIndexHandle in interface NodeHandleSetid - the id.
java.util.NoSuchElementException
|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||