Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.p2p.multiring
Class RingId

    java.lang.Object
      rice.p2p.multiring.RingId

All Implemented Interfaces:
  java.lang.Comparable, Id, java.io.Serializable

public class RingId
extends java.lang.Object
implements Id

Version:
  $Id: RingId.java 2302 2005-03-11 00:58:26Z jeffh $
Author:
  Alan Mislove
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class rice.p2p.commonapi.Id
`Id.Distance`

Field Summary
`protected Id` | `id` The id which this ringId represents
`protected Id` | `ringId` The ringId which this ringId represents

Method Summary
`Id` | `addToId(Id.Distance offset)` Returns an Id corresponding to this Id plus a given distance
`static RingId` | `build(Id ringId, Id id)` Constructor.
`static RingId` | `build(java.lang.String s)` Method which splits apart a ringid string and returns the RingID
`boolean` | `clockwise(Id nid)` Checks to see if the Id nid is clockwise or counterclockwise from this, on the ring.
`int` | `compareTo(java.lang.Object o)` Returns this id compared to the target
`Id.Distance` | `distanceFromId(Id nid)` Returns the shorter numerical distance on the ring between a pair of Ids.
`boolean` | `equals(java.lang.Object o)` Returns whether or not this object is equal to the provided one
`int` | `getByteArrayLength()` Returns the length of the byte[] representing this Id
`Id` | `getId()` Returns this ringid's id
`Id` | `getRingId()` Returns this ringid's ring id
`int` | `hashCode()` Returns the hashCode
`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.
`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` | `toString()` Returns a string representing this ring Id.
`java.lang.String` | `toStringFull()` Returns a string representing the full length of this Id.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### id

    protected Id id

  The id which this ringId represents

### ringId

    protected Id ringId

  The ringId which this ringId represents

Method Detail

### getId

    public Id getId()

  Returns this ringid's id

  Returns:
    The id of this ringid

### getRingId

    public Id getRingId()

  Returns this ringid's ring id

  Returns:
    The ring id of this ringid

### isBetween

    public boolean isBetween(Id ccw,
                             Id cw)

  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

### getByteArrayLength

    public int getByteArrayLength()

  Returns the length of the byte[] representing this Id

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

### clockwise

    public boolean clockwise(Id nid)

  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)

  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)

  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)

  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()

  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)

  Stores the byte[] value of this Id in the provided byte array

  Specified by:
    `toByteArray` in interface `Id`
  Parameters:
    `array` - DESCRIBE THE PARAMETER
    `offset` - DESCRIBE THE PARAMETER

### equals

    public boolean equals(java.lang.Object o)

  Returns whether or not this object is equal to the provided one

  Parameters:
    `o` - The object to compare to
  Returns:
    Whether or not this is object is equal

### hashCode

    public int hashCode()

  Returns the hashCode

  Returns:
    hashCode

### toString

    public java.lang.String toString()

  Returns a string representing this ring Id.

  Returns:
    A string with all of this Id

### toStringFull

    public java.lang.String toStringFull()

  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(java.lang.Object o)

  Returns this id compared to the target

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Parameters:
    `o` - DESCRIBE THE PARAMETER
  Returns:
    The comparison

### build

    public static RingId build(Id ringId,
                               Id id)

  Constructor.

  Parameters:
    `ringId` - DESCRIBE THE PARAMETER
    `id` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### build

    public static RingId build(java.lang.String s)

  Method which splits apart a ringid string and returns the RingID

  Parameters:
    `s` - The ring to parse
  Returns:
    The result

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.