|
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 Id from the local Id
Constructor Summary | |
SimilarSet(LeafSet leafSet,
NodeHandle localNode,
int size,
boolean cw)
Constructor. |
|
SimilarSet(LeafSet leafSet,
NodeHandle localNode,
int size,
boolean cw,
NodeHandle[] handles)
Constructor for SimilarSet. |
Method Summary | |
void |
addNodeSetListener(NodeSetListener listener)
Adds a feature to the NodeSetListener attribute of the SimilarSet object |
void |
addObserver(java.util.Observer o)
Deprecated. use addNodeSetListener |
void |
deleteObserver(java.util.Observer o)
Deprecated. use removeNodeSetListener |
NodeHandle |
get(Id nid)
Finds the NodeHandle associated with the Id. |
NodeHandle |
get(int i)
Gets the ith element in the set. |
NodeHandle |
get(NodeHandle nh)
DESCRIBE THE METHOD |
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 Id. |
NodeHandle |
getHandle(int i)
Gets the ith element in the set. |
int |
getIndex(Id nid)
Gets the index of the element with the given node id. |
int |
getIndex(NodeHandle nh)
Gets the Index attribute of the SimilarSet object |
int |
getIndexHandle(Id id)
Gets the index of the element with the given node id. |
boolean |
member(Id nid)
|
boolean |
member(NodeHandle 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)
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. |
NodeHandle |
remove(Id nid)
Removes a node id and its handle from 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 |
removeHandle(Id id)
Removes a node id and its handle from the set. |
void |
removeNodeSetListener(NodeSetListener listener)
DESCRIBE THE METHOD |
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 halfleafSet
- DESCRIBE THE PARAMETERpublic SimilarSet(LeafSet leafSet, NodeHandle localNode, int size, boolean cw, NodeHandle[] handles)
leafSet
- DESCRIBE THE PARAMETERlocalNode
- DESCRIBE THE PARAMETERsize
- DESCRIBE THE PARAMETERcw
- DESCRIBE THE PARAMETERhandles
- DESCRIBE THE PARAMETERMethod Detail |
public NodeHandle get(Id nid)
nid
- a node id.
public NodeHandle get(NodeHandle nh)
nh
- DESCRIBE THE PARAMETER
public NodeHandle get(int i)
i
- an index. i == -1 refers to the local node
public int getIndex(Id nid)
nid
- the node id.
public int getIndex(NodeHandle nh)
nh
- DESCRIBE THE PARAMETER
public NodeHandle getHandle(Id id)
id
- a node id.
public NodeHandle getHandle(int i)
i
- an index.
public int getIndexHandle(Id id) throws java.util.NoSuchElementException
id
- 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)
handle
- the handle to put.
public void addObserver(java.util.Observer o)
o
- The feature to be added to the Observer attributepublic void deleteObserver(java.util.Observer o)
o
- DESCRIBE THE PARAMETERpublic void addNodeSetListener(NodeSetListener listener)
addNodeSetListener
in interface NodeSetEventSource
listener
- The feature to be added to the NodeSetListener attributepublic void removeNodeSetListener(NodeSetListener listener)
removeNodeSetListener
in interface NodeSetEventSource
listener
- DESCRIBE THE PARAMETERpublic void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
o
- The node handlearg
- the event type (PROXIMITY_CHANGE, DECLARED_LIVE, DECLARED_DEAD)public boolean member(NodeHandle nid)
nid
- a node id.
public boolean member(Id nid)
nid
- DESCRIBE THE PARAMETER
public NodeHandle remove(Id nid)
nid
- the node to remove.
public NodeHandle remove(NodeHandle nh)
nh
- DESCRIBE THE PARAMETER
protected NodeHandle remove(int i)
i
- the index of the node to remove.
public int size()
public int mostSimilar(Id nid)
nid
- a node id.
public boolean putHandle(NodeHandle handle)
handle
- the handle to put.
public boolean memberHandle(Id id)
id
- a node id.
public NodeHandle removeHandle(Id id)
id
- DESCRIBE THE PARAMETER
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |