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.glacier
Class VersionKey

    java.lang.Object
      rice.p2p.glacier.VersionKey

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

    public class VersionKey

extends java.lang.Object
implements Id, java.io.Serializable, java.lang.Comparable

DESCRIBE THE CLASS

Version:
  $Id: VersionKey.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
  ahae
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface rice.p2p.commonapi.Id
`Id.Distance`

Field Summary
`protected Id` | `id` DESCRIBE THE FIELD
`static short` | `TYPE`
`protected long` | `version` DESCRIBE THE FIELD

Constructor Summary
`VersionKey(Id id, long version)` Constructor for VersionKey.
`VersionKey(InputBuffer buf, Endpoint endpoint)`

Method Summary
`Id` | `addToId(Id.Distance offset)` Returns an Id corresponding to this Id plus a given distance
`static VersionKey` | `build(java.lang.String s)`
`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)` DESCRIBE THE METHOD
`Id.Distance` | `distanceFromId(Id nid)` Returns the shorter numerical distance on the ring between a pair of Ids.
`boolean` | `equals(java.lang.Object peer)` DESCRIBE THE METHOD
`int` | `getByteArrayLength()` Returns the length of the byte[] representing this Id
`Id` | `getId()` Gets the Id attribute of the VersionKey object
`short` | `getType()`
`long` | `getVersion()` Gets the Version attribute of the VersionKey object
`int` | `hashCode()` DESCRIBE THE METHOD
`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()` DESCRIBE THE METHOD
`void` | `toByteArray(byte[] result, int offset)` Stores the byte[] value of this Id in the provided byte array
`java.lang.String` | `toString()` DESCRIBE THE METHOD
`java.lang.String` | `toStringFull()` DESCRIBE THE METHOD

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

Field Detail

### TYPE

    public static final short TYPE

See Also:
  Constant Field Values

### id

    protected Id id

  DESCRIBE THE FIELD

### version

    protected long version

  DESCRIBE THE FIELD

Constructor Detail

### VersionKey

    public VersionKey(Id id,
                      long version)

  Constructor for VersionKey.

  Parameters:
    `id` - DESCRIBE THE PARAMETER
    `version` - DESCRIBE THE PARAMETER

### VersionKey

    public VersionKey(InputBuffer buf,
                      Endpoint endpoint)
               throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getVersion

    public long getVersion()

  Gets the Version attribute of the VersionKey object

  Returns:
    The Version value

### getId

    public Id getId()

  Gets the Id attribute of the VersionKey object

  Returns:
    The Id value

### equals

    public boolean equals(java.lang.Object peer)

  DESCRIBE THE METHOD

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `peer` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### toString

    public java.lang.String toString()

  DESCRIBE THE METHOD

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    DESCRIBE THE RETURN VALUE

### toStringFull

    public java.lang.String toStringFull()

  DESCRIBE THE METHOD

  Specified by:
    `toStringFull` in interface `Id`
  Returns:
    DESCRIBE THE RETURN VALUE

### compareTo

    public int compareTo(java.lang.Object o)

  DESCRIBE THE METHOD

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

### hashCode

    public int hashCode()

  DESCRIBE THE METHOD

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    DESCRIBE THE RETURN VALUE

### toByteArray

    public byte[] toByteArray()

  DESCRIBE THE METHOD

  Specified by:
    `toByteArray` in interface `Id`
  Returns:
    DESCRIBE THE RETURN VALUE

### toByteArray

    public void toByteArray(byte[] result,
                            int offset)

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

  Specified by:
    `toByteArray` in interface `Id`

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

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

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

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

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

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

### build

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

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

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.