p2p.simulator.message
Class LookupResponse

java.lang.Object
  extended by p2p.simulator.message.MessageBody
      extended by p2p.simulator.message.LookupResponse
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DeleteResponse, InsertResponse

public class LookupResponse
extends MessageBody

This class creates a special lookup response message body. This special message is used to extract statistics regarding the protocol's lookup algorithm.

See Also:
Serialized Form

Constructor Summary
LookupResponse(long key, boolean exist, Message msg)
          Creates the body message of a lookup response message.
 
Method Summary
 int getHops()
          Returns the number of peers that the lookup request message visited.
 int getType()
          Returns the message's type.
 java.lang.String toString()
           
 
Methods inherited from class p2p.simulator.message.MessageBody
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LookupResponse

public LookupResponse(long key,
                      boolean exist,
                      Message msg)
Creates the body message of a lookup response message.

Parameters:
key - The key of the lookup request.
exist - If the key is found is true, otherwise false.
msg - The initial lookup request message.
Method Detail

getHops

public int getHops()
Returns the number of peers that the lookup request message visited.

Returns:
The number of hops.

getType

public int getType()
Returns the message's type.

Specified by:
getType in class MessageBody
Returns:
The type of the message

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object