Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/ubermq/chord/ChordIdentifier.java


1   package com.ubermq.chord;
2   
3   /**
4    * A chord identifier.  Chord identifiers are numeric,
5    * have a natural ordering, and exist in a finite key
6    * space (corresponding to the size of the hashing
7    * function being used).   <P>
8    *
9    * Conceptually, identifiers are placed on an identifier
10   * circle, which provides a graphical representation
11   * of successor and predecessor nodes.<P>
12   *
13   */
14  public interface ChordIdentifier
15      extends Comparable, java.io.Serializable
16  {
17      /**
18       * Returns the normalized representation of this
19       * identifier relative to other identifiers. The
20       * returned value will be in the interval (0,1).
21       *
22       * @return a normalized identifier representation
23       */
24      public double normal();
25  
26      /**
27       * Returns the next chord identifier in the
28       * identifier sequence.
29       *
30       * @return a chord identifier that is the next in the
31       * identifier sequence.
32       */
33      public ChordIdentifier next();
34  
35      /**
36       * Returns the chord identifier that is <code>l</code>
37       * after this one. This may be a negative number to
38       * go backwards.
39       *
40       * @return a chord identifier that is the specified
41       * interval away.
42       */
43      public ChordIdentifier next(long l);
44  
45      /**
46       * Returns the identifier for the <code>i</code>th finger
47       * for this identifier.  A finger is defined by the Chord
48       * set of algorithms as the identifier that succeeds this
49       * identifier by 2<super>i</super>. However, individual
50       * identifiers can use other finger computations, as appropriate.
51       *
52       * @param i the finger index, from 1 to <code>factory().getFingerTableSize()-1</code>.
53       * The finger at index 0 is defined as the immediate successor to this node.
54       * @return the identifier corresponding to the ith finger.
55       * @throws IllegalArgumentException if i is out of the specified range
56       */
57      public ChordIdentifier nextFinger(int i);
58  
59      /**
60       * Provides the factory instance used to create this
61       * identifier, so that new identifiers can be easily
62       * created from existing ones.
63       * @return an identifier factory
64       */
65      public ChordIdentifierFactory factory();
66  }