|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
rice.pastry.leafset.SimilarSet
A set of nodes, ordered by numerical distance of their nodeId from the local nodeId
| Constructor Summary | |
SimilarSet(NodeHandle localNode,
int size,
boolean cw)
Constructor. |
|
| Method Summary | |
NodeHandle |
get(int i)
Gets the ith element in the set. |
NodeHandle |
get(NodeId nid)
Finds the NodeHandle associated with the NodeId. |
NodeHandle |
getHandle(Id id)
Finds the NodeHandle associated with the NodeId. |
NodeHandle |
getHandle(int i)
Gets the ith element in the set. |
int |
getIndex(NodeId nid)
Gets the index of the element with the given node id. |
int |
getIndexHandle(Id id)
Gets the index of the element with the given node id. |
boolean |
member(NodeId nid)
Verifies if the set contains this particular id. |
boolean |
memberHandle(Id id)
Verifies if the set contains this particular id. |
int |
mostSimilar(Id nid)
Numerically closest node to a given a node. |
boolean |
put(NodeHandle handle)
Puts a NodeHandle into the set. |
boolean |
putHandle(NodeHandle handle)
Puts a NodeHandle into the set. |
NodeHandle |
remove(int i)
Removes a node id and its handle from the set. |
NodeHandle |
remove(NodeId nid)
Removes a node id and its handle from the set. |
NodeHandle |
removeHandle(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(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(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(NodeHandle handle)
handle - the handle to test.
public boolean put(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 NodeHandle get(NodeId nid)
get in interface NodeSetInid - a node id.
public NodeHandle get(int i)
get in interface NodeSetIi - an index. i == -1 refers to the local node
public boolean member(NodeId nid)
member in interface NodeSetInid - a node id.
public NodeHandle remove(NodeId nid)
remove in interface NodeSetInid - the node to remove.
public NodeHandle remove(int i)
i - the index of the node to remove.
public int getIndex(NodeId nid)
getIndex in interface NodeSetInid - the node id.
public int size()
size in interface NodeSetIpublic int mostSimilar(Id nid)
nid - a node id.
public boolean putHandle(NodeHandle handle)
putHandle in interface NodeHandleSethandle - the handle to put.
public NodeHandle getHandle(Id id)
getHandle in interface NodeHandleSetid - a node id.
public NodeHandle getHandle(int i)
getHandle in interface NodeHandleSeti - an index.
public boolean memberHandle(Id id)
memberHandle in interface NodeHandleSetid - a node id.
public NodeHandle removeHandle(Id id)
removeHandle in interface NodeHandleSet
public int getIndexHandle(Id id)
throws java.util.NoSuchElementException
getIndexHandle in interface NodeHandleSetid - the id.
java.util.NoSuchElementException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||