Rice Pastry API

rice.pastry.direct
Class EuclideanNetwork

java.lang.Object
  extended byrice.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.21 2005/06/09 16:22:01 jeffh Exp $
Author:
Andrew Ladd, Rongmei Zhang

Constructor Summary
EuclideanNetwork(Environment env)
          Constructor.
 
Method Summary
 void deliverMessage(Message msg, PastryNode node)
          DESCRIBE THE METHOD
 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()
          DESCRIBE THE METHOD
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EuclideanNetwork

public EuclideanNetwork(Environment env)
Constructor.

Parameters:
env - DESCRIBE THE PARAMETER
Method Detail

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

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

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

setTestRecord

public void setTestRecord(TestRecord tr)
set TestRecord

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

registerNodeId

public void registerNodeId(DirectNodeHandle nh)
register a new node

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

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)
DESCRIBE THE METHOD

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - DESCRIBE THE PARAMETER
node - DESCRIBE THE PARAMETER

simulate

public boolean simulate()
DESCRIBE THE METHOD

Specified by:
simulate in interface NetworkSimulator
Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection