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.commonapi
Interface Id

All Superinterfaces:
  java.lang.Comparable, java.io.Serializable

All Known Implementing Classes:
  FragmentKey, GCId, Id, RingId, VersionKey

public interface Id
extends java.lang.Comparable, java.io.Serializable

Version:
  $Id: Id.java,v 1.10 2005/03/11 00:58:02 jeffh Exp $
Author:
  Alan Mislove, Peter Druschel

Nested Class Summary
`static interface` | `Id.Distance` A class for representing and manipulating the distance between two Ids on the circle.

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.
`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
`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` | `toStringFull()` Returns a string representing the full length of this Id.

Methods inherited from interface java.lang.Comparable
`compareTo`

Method Detail

### 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

  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)

  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.

  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

  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.

  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.

  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

  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

  Parameters:
    `array` - DESCRIBE THE PARAMETER
    `offset` - DESCRIBE THE PARAMETER

### getByteArrayLength

    public int getByteArrayLength()

  Returns the length of the byte[] representing this Id

  Returns:
    The length of the byte[] representing this Id

### toStringFull

    public java.lang.String toStringFull()

  Returns a string representing the full length of this Id.

  Returns:
    A string with all of this Id

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.