Rice Pastry API

rice.p2p.commonapi
Interface IdFactory

All Known Implementing Classes:
FragmentKeyFactory, GCIdFactory, MultiringIdFactory, PastryIdFactory, VersionKeyFactory

public interface IdFactory

Version:
$Id: IdFactory.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Alan Mislove, Peter Druschel

Method Summary
 Id buildId(byte[] material)
          Builds a protocol-specific Id given the source data.
 Id buildId(int[] material)
          Builds a protocol-specific Id given the source data.
 Id buildId(java.lang.String string)
          Builds a protocol-specific Id by using the hash of the given string as source data.
 Id.Distance buildIdDistance(byte[] material)
          Builds a protocol-specific Id.Distance given the source data.
 Id buildIdFromToString(char[] chars, int offset, int length)
          Builds an Id by converting the given toString() output back to an Id.
 Id buildIdFromToString(java.lang.String string)
          Builds an Id by converting the given toString() output back to an Id.
 IdRange buildIdRange(Id cw, Id ccw)
          Creates an IdRange given the CW and CCW ids.
 IdRange buildIdRangeFromPrefix(java.lang.String string)
          Builds an IdRange based on a prefix.
 IdSet buildIdSet()
          Creates an empty IdSet.
 IdSet buildIdSet(java.util.SortedMap map)
          Creates an empty IdSet.
 NodeHandleSet buildNodeHandleSet()
          Creates an empty NodeHandleSet.
 Id buildRandomId(java.util.Random rng)
          Builds a random protocol-specific Id.
 Id buildRandomId(RandomSource rng)
           
 int getIdToStringLength()
          Returns the length a Id.toString should be.
 

Method Detail

buildId

Id buildId(byte[] material)
Builds a protocol-specific Id given the source data.

Parameters:
material - The material to use
Returns:
The built Id.

buildId

Id buildId(int[] material)
Builds a protocol-specific Id given the source data.

Parameters:
material - The material to use
Returns:
The built Id.

buildId

Id buildId(java.lang.String string)
Builds a protocol-specific Id by using the hash of the given string as source data.

Parameters:
string - The string to use as source data
Returns:
The built Id.

buildRandomId

Id buildRandomId(java.util.Random rng)
Builds a random protocol-specific Id.

Parameters:
rng - A random number generator
Returns:
The built Id.

buildRandomId

Id buildRandomId(RandomSource rng)

buildIdFromToString

Id buildIdFromToString(java.lang.String string)
Builds an Id by converting the given toString() output back to an Id. Should not normally be used.

Parameters:
string - The toString() representation of an Id
Returns:
The built Id.

buildIdFromToString

Id buildIdFromToString(char[] chars,
                       int offset,
                       int length)
Builds an Id by converting the given toString() output back to an Id. Should not normally be used.

Parameters:
chars - The character array
offset - The offset to start reading at
length - The length to read
Returns:
The built Id.

buildIdRangeFromPrefix

IdRange buildIdRangeFromPrefix(java.lang.String string)
Builds an IdRange based on a prefix. Any id which has this prefix should be inside this IdRange, and any id which does not share this prefix should be outside it.

Parameters:
string - The toString() representation of an Id
Returns:
The built Id.

getIdToStringLength

int getIdToStringLength()
Returns the length a Id.toString should be.

Returns:
The correct length;

buildIdDistance

Id.Distance buildIdDistance(byte[] material)
Builds a protocol-specific Id.Distance given the source data.

Parameters:
material - The material to use
Returns:
The built Id.Distance.

buildIdRange

IdRange buildIdRange(Id cw,
                     Id ccw)
Creates an IdRange given the CW and CCW ids.

Parameters:
cw - The clockwise Id
ccw - The counterclockwise Id
Returns:
An IdRange with the appropriate delimiters.

buildIdSet

IdSet buildIdSet()
Creates an empty IdSet.

Returns:
an empty IdSet

buildIdSet

IdSet buildIdSet(java.util.SortedMap map)
Creates an empty IdSet.

Returns:
an empty IdSet

buildNodeHandleSet

NodeHandleSet buildNodeHandleSet()
Creates an empty NodeHandleSet.

Returns:
an empty NodeHandleSet

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection