|
Rice Pastry API | ||||||||||
| 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(LeafSet leafSet,
NodeHandle localNode,
int size,
boolean cw)
Constructor. |
|
| Method Summary | |
NodeHandle |
get(int i)
Gets the ith element in the set. |
NodeHandle |
get(NodeHandle nh)
DESCRIBE THE METHOD |
NodeHandle |
get(NodeId nid)
Finds the NodeHandle associated with the NodeId. |
java.util.Collection |
getCollection()
This is thread safe, in that it won't throw an error if not properly synchronized. |
NodeHandle |
getHandle(Id id)
Finds the NodeHandle associated with the NodeId. |
NodeHandle |
getHandle(int i)
Gets the ith element in the set. |
int |
getIndex(NodeHandle nh)
Gets the Index attribute of the SimilarSet object |
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(NodeHandle nid)
Verifies if the set contains this particular id. |
boolean |
member(NodeId nid)
|
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. |
protected NodeHandle |
remove(int i)
Removes a node id and its handle from the set. |
NodeHandle |
remove(NodeHandle nh)
DESCRIBE THE METHOD |
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(LeafSet leafSet,
NodeHandle localNode,
int size,
boolean cw)
localNode - the local nodesize - the size of the similar set.cw - true if this is the clockwise leafset halfleafSet - DESCRIBE THE PARAMETER| Method Detail |
public NodeHandle get(NodeId nid)
get in interface NodeSetInid - a node id.
public NodeHandle get(NodeHandle nh)
nh - DESCRIBE THE PARAMETER
public NodeHandle get(int i)
get in interface NodeSetIi - an index. i == -1 refers to the local node
public int getIndex(NodeId nid)
getIndex in interface NodeSetInid - the node id.
public int getIndex(NodeHandle nh)
getIndex in interface NodeSetInh - DESCRIBE THE PARAMETER
public NodeHandle getHandle(Id id)
getHandle in interface NodeHandleSetid - a node id.
public NodeHandle getHandle(int i)
getHandle in interface NodeHandleSeti - an index.
public int getIndexHandle(Id id)
throws java.util.NoSuchElementException
getIndexHandle in interface NodeHandleSetid - the id.
java.util.NoSuchElementException - DESCRIBE THE EXCEPTIONpublic java.util.Collection getCollection()
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 boolean member(NodeHandle nid)
member in interface NodeSetInid - a node id.
public boolean member(NodeId nid)
nid - DESCRIBE THE PARAMETER
public NodeHandle remove(NodeId nid)
nid - the node to remove.
public NodeHandle remove(NodeHandle nh)
remove in interface NodeSetInh - DESCRIBE THE PARAMETER
protected NodeHandle remove(int i)
i - the index of the node to remove.
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 boolean memberHandle(Id id)
memberHandle in interface NodeHandleSetid - a node id.
public NodeHandle removeHandle(Id id)
removeHandle in interface NodeHandleSetid - DESCRIBE THE PARAMETER
|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||