|
ePOST 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
public class 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 | |
|---|---|
void |
addNodeSetListener(NodeSetListener listener)
|
void |
addObserver(java.util.Observer o)
Deprecated. use addNodeSetListener |
void |
deleteObserver(java.util.Observer o)
Deprecated. use removeNodeSetListener |
NodeHandle |
get(int i)
Gets the ith element in the set. |
NodeHandle |
get(NodeHandle nh)
|
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)
|
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)
Impl that doesn't produce garbage 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)
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. |
void |
removeNodeSetListener(NodeSetListener listener)
|
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 |
|---|
clearChanged, countObservers, 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 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 addObserver(java.util.Observer o)
addObserver in class java.util.Observablepublic void deleteObserver(java.util.Observer o)
deleteObserver in class java.util.Observablepublic void addNodeSetListener(NodeSetListener listener)
addNodeSetListener in interface NodeSetEventSourcepublic void removeNodeSetListener(NodeSetListener listener)
removeNodeSetListener in interface NodeSetEventSource
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(NodeHandle nh)
public NodeHandle get(int i)
get in interface NodeSetIi - an index. i == -1 refers to the local node
public boolean member(NodeHandle nid)
member in interface NodeSetInid - a node id.
public boolean member(NodeId nid)
public NodeHandle remove(NodeId nid)
nid - the node to remove.
public NodeHandle remove(NodeHandle nh)
NodeSetI
remove in interface NodeSetIprotected 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 getIndex(NodeHandle nh)
getIndex in interface NodeSetIpublic int size()
size in interface NodeHandleSetsize 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 NodeHandleSetnid - the node to remove.
public int getIndexHandle(Id id)
throws java.util.NoSuchElementException
getIndexHandle in interface NodeHandleSetid - the id.
java.util.NoSuchElementExceptionpublic java.util.Collection getCollection()
|
ePOST API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||