edu.iu.iv.search.p2p.chord
Class ChordSearch

java.lang.Object
  |
  +--edu.iu.iv.search.p2p.chord.ChordSearch

public class ChordSearch
extends java.lang.Object

Implements the Chord Search Algorithm on Chord p2p network

Author:
Hardik Sheth (hsheth@indiana.edu)

Constructor Summary
ChordSearch(edu.uci.ics.jung.graph.Graph graph)
          Constructor for ChordSearch algorithm.
 
Method Summary
 java.lang.String getFailReason()
          Get the reason because of which modelig failed
 int getSearchCost()
          This methods returns the search cost (number of messages to perform search) for the network
 boolean searchNetwork(int fromId, int toId)
          This method performs search on the graph, given the source and target nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChordSearch

public ChordSearch(edu.uci.ics.jung.graph.Graph graph)
Constructor for ChordSearch algorithm. Initialize the network by passing Graph object on which search will be performed.

Parameters:
graph - - Graph object representing the CHORD network on which the search is to be performed.
Method Detail

searchNetwork

public boolean searchNetwork(int fromId,
                             int toId)
This method performs search on the graph, given the source and target nodes.

Parameters:
fromId - - Id of the source node
toId - - Id of the target node
Returns:
true if the search succeeds, false otherwise

getSearchCost

public int getSearchCost()
This methods returns the search cost (number of messages to perform search) for the network

Returns:
Search cost

getFailReason

public java.lang.String getFailReason()
Get the reason because of which modelig failed

Returns:
reason