de.uniba.wiai.lspi.chord.service.impl
Class References

java.lang.Object
  extended by de.uniba.wiai.lspi.chord.service.impl.References

public final class References
extends java.lang.Object

Stores all remote references of nodes the local node is connected to and provides methods for querying and manipulating these references. Makes use of one finger table, one successor list, and one predecessor reference.

Version:
1.0.5
Author:
Karsten Loesing

Constructor Summary
References(Floor floor, ID locID, URL locURL, int numberOfEntriesInSuccessorList, Entries entries)
          Creates an References object which contains no references.
 
Method Summary
 java.util.List<Node> getFirstFingerTableEntries(int i)
          Determines the first i entries in the finger table.
 URL getPredecessorURL()
           
 Node getSuccessor()
          Determines this node's direct successor and returns it.
 URL getSuccessorURL()
           
 java.lang.String toString()
          Returns a formatted string of the IDs of all references stored on this node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

References

public References(Floor floor,
                  ID locID,
                  URL locURL,
                  int numberOfEntriesInSuccessorList,
                  Entries entries)
Creates an References object which contains no references.

Parameters:
locID - ID of local node. Must not be null.
numberOfEntriesInSuccessorList - Length of successor list to be created. Must be greater or equal 1!
entries - Reference on this nodes' entries which is passed to creation of the successor list. Must not be null.
Throws:
java.lang.IllegalArgumentException - If any parameters is null or if number of entries in successor list is less than 1.
Method Detail

getSuccessor

public final Node getSuccessor()
Determines this node's direct successor and returns it. If no successor is known, null is returned.

Returns:
The local node's direct successor, or null if no successor is known.

toString

public java.lang.String toString()
Returns a formatted string of the IDs of all references stored on this node. This includes references in the finger table and successor list as well as the predecessor.

Overrides:
toString in class java.lang.Object
Returns:
Formatted string of references.

getPredecessorURL

public final URL getPredecessorURL()

getSuccessorURL

public final URL getSuccessorURL()

getFirstFingerTableEntries

public java.util.List<Node> getFirstFingerTableEntries(int i)
Determines the first i entries in the finger table.

Parameters:
i -
Returns:
The first (i+1) entries of finger table. If there are fewer then i+1 entries only these are returned.