Rice Pastry API

rice.pastry.direct
Class BasicNetworkSimulator

java.lang.Object
  extended byrice.pastry.direct.BasicNetworkSimulator
All Implemented Interfaces:
NetworkSimulator
Direct Known Subclasses:
EuclideanNetwork, GenericNetwork, SphereNetwork

public abstract class BasicNetworkSimulator
extends java.lang.Object
implements NetworkSimulator

DESCRIBE THE CLASS

Version:
$Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $
Author:
jeffh

Field Summary
protected  Logger logger
          DESCRIBE THE FIELD
protected  SelectorManager manager
          DESCRIBE THE FIELD
protected  int MIN_DELAY
          DESCRIBE THE FIELD
protected  RandomSource random
          DESCRIBE THE FIELD
protected  java.util.TreeSet taskQueue
          DESCRIBE THE FIELD
 
Constructor Summary
BasicNetworkSimulator(Environment env)
          Constructor for BasicNetworkSimulator.
 
Method Summary
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node)
          DESCRIBE THE METHOD
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay)
          DESCRIBE THE METHOD
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay, int period)
          DESCRIBE THE METHOD
 ScheduledMessage deliverMessageFixedRate(Message msg, DirectPastryNode node, int delay, int period)
          DESCRIBE THE METHOD
 void destroy(DirectPastryNode node)
          set the liveliness of a NodeId
 CancellableTask enqueueDelivery(Delivery d)
          DESCRIBE THE METHOD
 DirectNodeHandle getClosest(DirectNodeHandle nh)
          find the closest NodeId to an input NodeId out of all NodeIds in the network
 Environment getEnvironment()
          Gets the Environment attribute of the BasicNetworkSimulator object
 TestRecord getTestRecord()
          get TestRecord
 boolean isAlive(DirectNodeHandle nh)
          testing if a NodeId is alive
 int proximity(DirectNodeHandle a, DirectNodeHandle b)
          computes the proximity between two NodeIds
 void registerNode(DirectPastryNode dpn)
          DESCRIBE THE METHOD
 void removeNode(DirectPastryNode node)
          DESCRIBE THE METHOD
 void setTestRecord(TestRecord tr)
          set TestRecord
 void start()
          DESCRIBE THE METHOD
 void stop()
          DESCRIBE THE METHOD
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rice.pastry.direct.NetworkSimulator
generateNodeRecord
 

Field Detail

taskQueue

protected java.util.TreeSet taskQueue
DESCRIBE THE FIELD


logger

protected Logger logger
DESCRIBE THE FIELD


random

protected RandomSource random
DESCRIBE THE FIELD


MIN_DELAY

protected int MIN_DELAY
DESCRIBE THE FIELD


manager

protected SelectorManager manager
DESCRIBE THE FIELD

Constructor Detail

BasicNetworkSimulator

public BasicNetworkSimulator(Environment env)
Constructor for BasicNetworkSimulator.

Parameters:
env - DESCRIBE THE PARAMETER
Method Detail

getTestRecord

public TestRecord getTestRecord()
get TestRecord

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

isAlive

public boolean isAlive(DirectNodeHandle nh)
testing if a NodeId is alive

Specified by:
isAlive in interface NetworkSimulator
Parameters:
nh - DESCRIBE THE PARAMETER
Returns:
true if nid is alive false otherwise

getClosest

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

Specified by:
getClosest in interface NetworkSimulator
Parameters:
nh - DESCRIBE THE PARAMETER
Returns:
the NodeId closest to the input NodeId in the network

getEnvironment

public Environment getEnvironment()
Gets the Environment attribute of the BasicNetworkSimulator object

Specified by:
getEnvironment in interface NetworkSimulator
Returns:
The Environment value

setTestRecord

public void setTestRecord(TestRecord tr)
set TestRecord

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

start

public void start()
DESCRIBE THE METHOD

Specified by:
start in interface NetworkSimulator

stop

public void stop()
DESCRIBE THE METHOD

Specified by:
stop in interface NetworkSimulator

enqueueDelivery

public CancellableTask enqueueDelivery(Delivery d)
DESCRIBE THE METHOD

Specified by:
enqueueDelivery in interface NetworkSimulator
Parameters:
d - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node)
DESCRIBE THE METHOD

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

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay)
DESCRIBE THE METHOD

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - DESCRIBE THE PARAMETER
node - DESCRIBE THE PARAMETER
delay - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay,
                                       int period)
DESCRIBE THE METHOD

Specified by:
deliverMessage in interface NetworkSimulator
Parameters:
msg - DESCRIBE THE PARAMETER
node - DESCRIBE THE PARAMETER
delay - DESCRIBE THE PARAMETER
period - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessageFixedRate

public ScheduledMessage deliverMessageFixedRate(Message msg,
                                                DirectPastryNode node,
                                                int delay,
                                                int period)
DESCRIBE THE METHOD

Specified by:
deliverMessageFixedRate in interface NetworkSimulator
Parameters:
msg - DESCRIBE THE PARAMETER
node - DESCRIBE THE PARAMETER
delay - DESCRIBE THE PARAMETER
period - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

destroy

public void destroy(DirectPastryNode node)
set the liveliness of a NodeId

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

proximity

public int proximity(DirectNodeHandle a,
                     DirectNodeHandle 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

registerNode

public void registerNode(DirectPastryNode dpn)
DESCRIBE THE METHOD

Specified by:
registerNode in interface NetworkSimulator
Parameters:
dpn - DESCRIBE THE PARAMETER

removeNode

public void removeNode(DirectPastryNode node)
DESCRIBE THE METHOD

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

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection