|
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.LeafSet
public class LeafSet
A class for representing and manipulating the leaf set. The leafset is not strictly a set: when the ring is small, a node may appear in both the cw and the ccw half of the "set".
Constructor Summary | |
---|---|
LeafSet(NodeHandle localNode,
int size,
boolean observe)
|
|
LeafSet(NodeHandle localNode,
int size,
boolean observe,
NodeHandle[] cwTable,
NodeHandle[] ccwTable)
|
|
LeafSet(NodeHandle localNode,
int size,
RoutingTable rt)
Constructor. |
Method Summary | |
---|---|
void |
addNodeSetListener(NodeSetListener listener)
Add observer method. |
void |
addObserver(java.util.Observer o)
Deprecated. use addNodeSetListener |
java.util.List |
asList()
If overlaps() a NodeHandle may show up twice. |
static LeafSet |
build(InputBuffer buf,
NodeHandleFactory nhf)
So that small LeafSets (who have overlapping nodes) don't waste bandwidth, leafset first defines the NodeHandles to be loaded into an array, then specifies their locations. |
int |
ccwSize()
Gets the current counterclockwise size. |
LeafSet |
copy()
|
int |
cwSize()
Gets the current clockwise size. |
void |
deleteNodeSetListener(NodeSetListener listener)
Delete observer method. |
void |
deleteObserver(java.util.Observer o)
Deprecated. use deleteNodeSetListener |
void |
destroy()
|
boolean |
directTest(NodeHandle handle)
|
NodeHandle |
get(int index)
Finds the NodeHandle at a given index. |
int |
getIndex(NodeHandle nh)
|
int |
getUniqueCount()
Returns the number of unique nodes in the leafset |
boolean |
isComplete()
|
protected boolean |
isProperlyRemoved(NodeHandle handle)
|
int |
maxSize()
Gets the maximal size of the leaf set. |
boolean |
member(Id nid)
Verifies if the set contains this particular id. |
boolean |
member(NodeHandle nid)
Verifies if the set contains this particular handle. |
boolean |
merge(LeafSet remotels,
NodeHandle from,
RoutingTable routeTable,
boolean testOnly,
java.util.Set insertedHandles)
Merge a remote leafset into this |
int |
mostSimilar(Id nid)
Numerically closests node to a given a node in the leaf set. |
NodeSet |
neighborSet(int max)
compute an ordered set of nodes that are neighbors of this local node, in order of numerical closeness to the local node |
boolean |
overlaps()
Test if the leafset overlaps |
boolean |
put(NodeHandle handle)
Puts a NodeHandle into the set. |
boolean |
put(NodeHandle handle,
boolean suppressNotification)
|
IdRange |
range(NodeHandle n,
int r)
range computes the range of keys for which node n is a i-root, 0<=i<=r a node is the r-root for a key of the node becomes the numerically closest node to the key when i-roots for the key fail, O<=i |
IdRange |
range(NodeHandle n,
int r,
boolean cw)
range computes the ranges of keys for which node n is a r-root a node is the r-root for a key of the node becomes the numerically closest node to the key when i-roots for the key fail, O<=i |
void |
remove(NodeHandle nh)
Removes a node id and its handle from the set. |
NodeSet |
replicaSet(Id key,
int max)
compute an ordered set of nodes, in order of numerical closeness to a given key |
void |
serialize(OutputBuffer buf)
So that small LeafSets (who have overlapping nodes) don't waste bandwidth, leafset first defines the NodeHandles to be loaded into an array, then specifies their locations. |
int |
size()
Gets the current size of the leaf set. |
boolean |
test(NodeHandle handle)
Test if a put of the given NodeHandle would succeed. |
protected boolean |
testOtherSet(SimilarSet set,
NodeHandle handle)
|
java.lang.String |
toString()
Returns a string representation of the leaf set |
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, wait, wait, wait |
Constructor Detail |
---|
public LeafSet(NodeHandle localNode, int size, RoutingTable rt)
localHandle
- the local nodesize
- the size of the leaf set.rt
- (to fall back on for more entries on delete operations)public LeafSet(NodeHandle localNode, int size, boolean observe)
public LeafSet(NodeHandle localNode, int size, boolean observe, NodeHandle[] cwTable, NodeHandle[] ccwTable)
Method Detail |
---|
public boolean put(NodeHandle handle)
handle
- the handle to put.
public boolean put(NodeHandle handle, boolean suppressNotification)
public boolean test(NodeHandle handle)
handle
- the handle to test.
public boolean overlaps()
public boolean isComplete()
public int getIndex(NodeHandle nh) throws java.util.NoSuchElementException
java.util.NoSuchElementException
public NodeHandle get(int index)
index
- an index.
public boolean member(NodeHandle nid)
nid
- a NodeHandle.
public boolean member(Id nid)
nid
- a node id.
public void remove(NodeHandle nh)
nid
- the node to remove.public int maxSize()
public int size()
public int cwSize()
public int ccwSize()
public int mostSimilar(Id nid)
nid
- a node id.
public NodeSet neighborSet(int max)
max
- the maximal size of the set requested
public NodeSet replicaSet(Id key, int max)
key
- the keymax
- the maximal size of the set requested
public int getUniqueCount()
public IdRange range(NodeHandle n, int r)
n
- the nodehandler
-
public IdRange range(NodeHandle n, int r, boolean cw)
n
- the nodehandler
- cw
- if true returns the clockwise range, else the counterclockwise range
public boolean merge(LeafSet remotels, NodeHandle from, RoutingTable routeTable, boolean testOnly, java.util.Set insertedHandles)
remotels
- the remote leafsetfrom
- the node from which we received the leafsetrouteTable
- the routing tablesecurity
- the security managertestOnly
- if true, do not change the leafsetinsertedHandles
- if not null, a Set that contains, upon return of this method, the nodeHandles that would be inserted into this LeafSet if testOnly is true
public void addObserver(java.util.Observer o)
addObserver
in class java.util.Observable
o
- the observer to add.public void deleteObserver(java.util.Observer o)
deleteObserver
in class java.util.Observable
o
- the observer to delete.public void addNodeSetListener(NodeSetListener listener)
o
- the observer to add.public void deleteNodeSetListener(NodeSetListener listener)
o
- the observer to delete.public java.lang.String toString()
toString
in class java.lang.Object
protected boolean isProperlyRemoved(NodeHandle handle)
protected boolean testOtherSet(SimilarSet set, NodeHandle handle)
public boolean directTest(NodeHandle handle)
public LeafSet copy()
public static LeafSet build(InputBuffer buf, NodeHandleFactory nhf) throws java.io.IOException
java.io.IOException
public void serialize(OutputBuffer buf) throws java.io.IOException
java.io.IOException
public java.util.List asList()
public void destroy()
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |