Rice Pastry API

rice.pastry.direct
Class EuclideanNetwork

java.lang.Object
  |
  +--rice.pastry.direct.EuclideanNetwork
All Implemented Interfaces:
NetworkSimulator

public class EuclideanNetwork
extends java.lang.Object
implements NetworkSimulator

Euclidean network topology and idealized node life. Emulates a network of nodes that are randomly placed in a plane. Proximity is based on euclidean distance in the plane.

Version:
$Id: EuclideanNetwork.java,v 1.13 2002/07/27 23:24:52 animesh Exp $
Author:
Andrew Ladd, Rongmei Zhang

Constructor Summary
EuclideanNetwork()
          Constructor.
 
Method Summary
 void deliverMessage(Message msg, PastryNode node)
          Deliver message.
 DirectNodeHandle getClosest(NodeId nid)
          find the closest NodeId to an input NodeId out of all NodeIds in the network
 TestRecord getTestRecord()
          get TestRecord
 boolean isAlive(NodeId nid)
          testing if a NodeId is alive
 int proximity(NodeId a, NodeId b)
          computes the proximity between two NodeIds
 void registerNodeId(DirectNodeHandle nh)
          register a new node
 void setAlive(NodeId nid, boolean alive)
          set the liveliness of a NodeId
 void setTestRecord(TestRecord tr)
          set TestRecord
 boolean simulate()
          Simulate one message delivery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EuclideanNetwork

public EuclideanNetwork()
Constructor.

Method Detail

registerNodeId

public void registerNodeId(DirectNodeHandle nh)
register a new node

Specified by:
registerNodeId in interface NetworkSimulator
Parameters:
nh - the DirectNodeHandle being registered

isAlive

public boolean isAlive(NodeId nid)
testing if a NodeId is alive

Specified by:
isAlive in interface NetworkSimulator
Parameters:
nid - the NodeId being tested
Returns:
true if nid is alive false otherwise

setAlive

public void setAlive(NodeId nid,
                     boolean alive)
set the liveliness of a NodeId

Specified by:
setAlive in interface NetworkSimulator
Parameters:
nid - the NodeId being set
alive - the value being set

proximity

public int proximity(NodeId a,
                     NodeId b)
computes the proximity between two NodeIds

Specified by:
proximity in interface NetworkSimulator
Parameters:
a - the first NodeId
b - the second NodeId
Returns:
the proximity between the two input NodeIds

deliverMessage

public void deliverMessage(Message msg,
                           PastryNode node)
Description copied from interface: NetworkSimulator
Deliver message.

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.

simulate

public boolean simulate()
Description copied from interface: NetworkSimulator
Simulate one message delivery.

Specified by:
simulate in interface NetworkSimulator
Returns:
true if a message was delivered, false otherwise.

setTestRecord

public void setTestRecord(TestRecord tr)
set TestRecord

Specified by:
setTestRecord in interface NetworkSimulator
Parameters:
tr - input TestRecord

getTestRecord

public TestRecord getTestRecord()
get TestRecord

Specified by:
getTestRecord in interface NetworkSimulator
Returns:
the returned TestRecord

getClosest

public DirectNodeHandle getClosest(NodeId nid)
find the closest NodeId to an input NodeId out of all NodeIds in the network

Specified by:
getClosest in interface NetworkSimulator
Parameters:
nid - the input NodeId
Returns:
the NodeId closest to the input NodeId in the network

Rice Pastry API

Copyright © 2001 - Rice Pastry