Rice Pastry API

rice.p2p.multiring
Class MultiringIdRange

java.lang.Object
  extended by rice.p2p.multiring.MultiringIdRange
All Implemented Interfaces:
java.io.Serializable, IdRange

public class MultiringIdRange
extends java.lang.Object
implements IdRange

Version:
$Id: MultiringIdRange.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Alan Mislove, Peter Druschel
See Also:
Serialized Form

Field Summary
protected  IdRange range
          The actual IdRange
protected  Id ringId
          The ringId of the nodes in the range
 
Constructor Summary
protected MultiringIdRange(Id ringId, IdRange range)
          Constructor
  MultiringIdRange(InputBuffer buf, Endpoint endpoint)
           
 
Method Summary
 boolean containsId(Id key)
          test if a given key lies within this range
 IdRange diffRange(IdRange diff)
          diffs the given range with this range
 boolean equals(java.lang.Object o)
          Determines equality
 Id getCCWId()
          get counterclockwise edge of range
 IdRange getComplementRange()
          get the complement of this range
 Id getCWId()
          get clockwise edge of range
protected  IdRange getRange()
          Returns the internal range
 int hashCode()
          Returns the hashCode
 IdRange intersectRange(IdRange intersect)
          intersects the given range with this range
 boolean isEmpty()
          returns whether or not this range is empty
 IdRange mergeRange(IdRange merge)
          merges the given range with this range
 void serialize(OutputBuffer buf)
           
 java.lang.String toString()
          Prints out the string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

range

protected IdRange range
The actual IdRange


ringId

protected Id ringId
The ringId of the nodes in the range

Constructor Detail

MultiringIdRange

protected MultiringIdRange(Id ringId,
                           IdRange range)
Constructor


MultiringIdRange

public MultiringIdRange(InputBuffer buf,
                        Endpoint endpoint)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getRange

protected IdRange getRange()
Returns the internal range

Returns:
The internal range

containsId

public boolean containsId(Id key)
test if a given key lies within this range

Specified by:
containsId in interface IdRange
Parameters:
key - the key
Returns:
true if the key lies within this range, false otherwise

getCCWId

public Id getCCWId()
get counterclockwise edge of range

Specified by:
getCCWId in interface IdRange
Returns:
the id at the counterclockwise edge of the range (inclusive)

getCWId

public Id getCWId()
get clockwise edge of range

Specified by:
getCWId in interface IdRange
Returns:
the id at the clockwise edge of the range (exclusive)

getComplementRange

public IdRange getComplementRange()
get the complement of this range

Specified by:
getComplementRange in interface IdRange
Returns:
This range's complement

mergeRange

public IdRange mergeRange(IdRange merge)
merges the given range with this range

Specified by:
mergeRange in interface IdRange
Returns:
The merge

diffRange

public IdRange diffRange(IdRange diff)
diffs the given range with this range

Specified by:
diffRange in interface IdRange
Returns:
The merge

intersectRange

public IdRange intersectRange(IdRange intersect)
intersects the given range with this range

Specified by:
intersectRange in interface IdRange
Returns:
The merge

isEmpty

public boolean isEmpty()
returns whether or not this range is empty

Specified by:
isEmpty in interface IdRange
Returns:
Whether or not this range is empty

equals

public boolean equals(java.lang.Object o)
Determines equality

Overrides:
equals in class java.lang.Object
Parameters:
other - To compare to
Returns:
Equals

hashCode

public int hashCode()
Returns the hashCode

Overrides:
hashCode in class java.lang.Object
Returns:
hashCode

toString

public java.lang.String toString()
Prints out the string

Overrides:
toString in class java.lang.Object
Returns:
A string

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
Specified by:
serialize in interface IdRange
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection