Rice Pastry API

org.mpisws.p2p.transport.sourceroute
Class SourceRoute<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.sourceroute.SourceRoute<Identifier>
Direct Known Subclasses:
MultiAddressSourceRoute, WireSourceRoute

public abstract class SourceRoute<Identifier>
extends java.lang.Object

Class which represets a source route to a remote IP address.

Version:
$Id: SourceRoute.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
Alan Mislove

Field Summary
protected  java.util.List<Identifier> path
           
 
Constructor Summary
protected SourceRoute(Identifier address)
           
protected SourceRoute(Identifier local, Identifier remote)
           
protected SourceRoute(java.util.List<Identifier> path)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks equality on source routes
 Identifier getFirstHop()
          Method which returns the first "hop" of this source route
 int getHop(Identifier identifier)
          Returns which hop in the path the identifier is.
 Identifier getHop(int i)
          Returns the hop at the given index
 Identifier getLastHop()
          Method which returns the first "hop" of this source route
 int getNumHops()
          Returns the number of hops in this source route
abstract  int getSerializedLength()
           
 boolean goesThrough(Identifier address)
          Returns whether or not this route goes through the given address
 int hashCode()
          Returns the hashCode of this source route
 boolean isDirect()
          Returns whether or not this route is direct
abstract  void serialize(OutputBuffer buf)
          Raw Serialization
 java.lang.String toString()
          Internal method for computing the toString of an array of InetSocketAddresses
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

path

protected java.util.List<Identifier> path
Constructor Detail

SourceRoute

protected SourceRoute(java.util.List<Identifier> path)
Constructor

Parameters:
nodeId - This node handle's node Id.
address - DESCRIBE THE PARAMETER

SourceRoute

protected SourceRoute(Identifier address)

SourceRoute

protected SourceRoute(Identifier local,
                      Identifier remote)
Method Detail

hashCode

public int hashCode()
Returns the hashCode of this source route

Overrides:
hashCode in class java.lang.Object
Returns:
The hashCode

equals

public boolean equals(java.lang.Object o)
Checks equality on source routes

Overrides:
equals in class java.lang.Object
Parameters:
o - The source route to compare to
Returns:
The equality

toString

public java.lang.String toString()
Internal method for computing the toString of an array of InetSocketAddresses

Overrides:
toString in class java.lang.Object
Parameters:
path - The path
Returns:
THe string

getFirstHop

public Identifier getFirstHop()
Method which returns the first "hop" of this source route

Returns:
The first hop of this source route

getLastHop

public Identifier getLastHop()
Method which returns the first "hop" of this source route

Returns:
The first hop of this source route

getNumHops

public int getNumHops()
Returns the number of hops in this source route

Returns:
The number of hops

getHop

public Identifier getHop(int i)
Returns the hop at the given index

Parameters:
i - The hop index
Returns:
The hop

isDirect

public boolean isDirect()
Returns whether or not this route is direct

Returns:
whether or not this route is direct

goesThrough

public boolean goesThrough(Identifier address)
Returns whether or not this route goes through the given address

Returns:
whether or not this route goes through the given address

getHop

public int getHop(Identifier identifier)
Returns which hop in the path the identifier is.

Parameters:
identifier - the hop
Returns:
-1 if not in the path

serialize

public abstract void serialize(OutputBuffer buf)
                        throws java.io.IOException
Raw Serialization

Throws:
java.io.IOException

getSerializedLength

public abstract int getSerializedLength()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection