Rice Pastry API

rice.persistence.testing
Class MemoryStorageTest.VariableId

java.lang.Object
  extended by rice.persistence.testing.MemoryStorageTest.VariableId
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Id>, Id
Enclosing class:
MemoryStorageTest

public class MemoryStorageTest.VariableId
extends java.lang.Object
implements Id

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface rice.p2p.commonapi.Id
Id.Distance
 
Field Summary
protected  int num
           
static java.lang.String STRING
           
static short TYPE
           
 
Constructor Summary
MemoryStorageTest.VariableId(int num)
           
 
Method Summary
 Id addToId(Id.Distance offset)
          Returns an Id corresponding to this Id plus a given distance
 boolean clockwise(Id nid)
          Checks to see if the Id nid is clockwise or counterclockwise from this, on the ring.
 int compareTo(Id o)
           
 Id.Distance distanceFromId(Id nid)
          Returns the shorter numerical distance on the ring between a pair of Ids.
 int getByteArrayLength()
          Returns the length of the byte[] representing this Id
 short getType()
           
 boolean isBetween(Id ccw, Id cw)
          Checks if this Id is between two given ids ccw (inclusive) and cw (exclusive) on the circle
 Id.Distance longDistanceFromId(Id nid)
          Returns the longer numerical distance on the ring between a pair of Ids.
 void serialize(OutputBuffer buf)
          Serialize
 byte[] toByteArray()
          Returns a (mutable) byte array representing this Id
 void toByteArray(byte[] array, int offset)
          Stores the byte[] value of this Id in the provided byte array
 java.lang.String toStringFull()
          Returns a string representing the full length of this Id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final short TYPE
See Also:
Constant Field Values

num

protected int num

STRING

public static final java.lang.String STRING
See Also:
Constant Field Values
Constructor Detail

MemoryStorageTest.VariableId

public MemoryStorageTest.VariableId(int num)
Method Detail

isBetween

public boolean isBetween(Id ccw,
                         Id cw)
Description copied from interface: Id
Checks if this Id is between two given ids ccw (inclusive) and cw (exclusive) on the circle

Specified by:
isBetween in interface Id
Parameters:
ccw - the counterclockwise id
cw - the clockwise id
Returns:
true if this is between ccw (inclusive) and cw (exclusive), false otherwise

clockwise

public boolean clockwise(Id nid)
Description copied from interface: Id
Checks to see if the Id nid is clockwise or counterclockwise from this, on the ring. An Id is clockwise if it is within the half circle clockwise from this on the ring. An Id is considered counter-clockwise from itself.

Specified by:
clockwise in interface Id
Parameters:
nid - The id to compare to
Returns:
true if clockwise, false otherwise.

addToId

public Id addToId(Id.Distance offset)
Description copied from interface: Id
Returns an Id corresponding to this Id plus a given distance

Specified by:
addToId in interface Id
Parameters:
offset - the distance to add
Returns:
the new Id

distanceFromId

public Id.Distance distanceFromId(Id nid)
Description copied from interface: Id
Returns the shorter numerical distance on the ring between a pair of Ids.

Specified by:
distanceFromId in interface Id
Parameters:
nid - the other node id.
Returns:
the distance between this and nid.

longDistanceFromId

public Id.Distance longDistanceFromId(Id nid)
Description copied from interface: Id
Returns the longer numerical distance on the ring between a pair of Ids.

Specified by:
longDistanceFromId in interface Id
Parameters:
nid - the other node id.
Returns:
the distance between this and nid.

toByteArray

public byte[] toByteArray()
Description copied from interface: Id
Returns a (mutable) byte array representing this Id

Specified by:
toByteArray in interface Id
Returns:
A byte[] representing this Id

toByteArray

public void toByteArray(byte[] array,
                        int offset)
Description copied from interface: Id
Stores the byte[] value of this Id in the provided byte array

Specified by:
toByteArray in interface Id

getByteArrayLength

public int getByteArrayLength()
Description copied from interface: Id
Returns the length of the byte[] representing this Id

Specified by:
getByteArrayLength in interface Id
Returns:
The length of the byte[] representing this Id

toStringFull

public java.lang.String toStringFull()
Description copied from interface: Id
Returns a string representing the full length of this Id.

Specified by:
toStringFull in interface Id
Returns:
A string with all of this Id

compareTo

public int compareTo(Id o)
Specified by:
compareTo in interface java.lang.Comparable<Id>

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
Description copied from interface: Id
Serialize

Specified by:
serialize in interface Id
Throws:
java.io.IOException

getType

public short getType()
Specified by:
getType in interface Id

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection