Rice Pastry API

rice.pastry.direct
Class SphereNetwork

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

public class SphereNetwork
extends java.lang.Object
implements NetworkSimulator

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

Version:
$Id: SphereNetwork.java,v 1.11 2003/10/22 03:27:46 amislove Exp $
Author:
Y. Charlie Hu, Rongmei Zhang

Constructor Summary
SphereNetwork()
          Constructor.
 
Method Summary
 void deliverMessage(rice.pastry.messaging.Message msg, rice.pastry.PastryNode node)
          DESCRIBE THE METHOD
 rice.pastry.direct.DirectNodeHandle getClosest(rice.pastry.NodeId nid)
          find the closest NodeId to an input NodeId out of all NodeIds in the network
 rice.pastry.direct.TestRecord getTestRecord()
          get TestRecord
 boolean isAlive(rice.pastry.NodeId nid)
          testing if a NodeId is alive
 int proximity(rice.pastry.NodeId a, rice.pastry.NodeId b)
          computes the proximity between two NodeIds
 void registerNodeId(rice.pastry.direct.DirectNodeHandle nh)
          register a new node
 void setAlive(rice.pastry.NodeId nid, boolean alive)
          set the liveliness of a NodeId
 void setTestRecord(rice.pastry.direct.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

SphereNetwork

public SphereNetwork()
Constructor.

Method Detail

isAlive

public boolean isAlive(rice.pastry.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 rice.pastry.direct.TestRecord getTestRecord()
get TestRecord

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

getClosest

public rice.pastry.direct.DirectNodeHandle getClosest(rice.pastry.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(rice.pastry.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(rice.pastry.direct.TestRecord tr)
set TestRecord

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

registerNodeId

public void registerNodeId(rice.pastry.direct.DirectNodeHandle nh)
register a new node

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

proximity

public int proximity(rice.pastry.NodeId a,
                     rice.pastry.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(rice.pastry.messaging.Message msg,
                           rice.pastry.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 - Rice Pastry.


Imprint-Dataprotection