Rice Pastry API

rice.pastry.direct
Class GeometricNetworkSimulator

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

public abstract class GeometricNetworkSimulator
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  java.util.Vector msgQueue
          DESCRIBE THE FIELD
protected  RandomSource random
          DESCRIBE THE FIELD
protected  java.util.TreeSet taskQueue
          DESCRIBE THE FIELD
 
Constructor Summary
GeometricNetworkSimulator(Environment env)
          Constructor for GeometricNetworkSimulator.
 
Method Summary
 void 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
 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 GeometricNetworkSimulator 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
 boolean simulate()
          DESCRIBE THE METHOD
protected  boolean simulate(long maxTime)
          Delivers 1 message.
 boolean simulateFor(int millis)
          DESCRIBE THE METHOD
 boolean simulateUntil(long targetTime)
          1) process the msgQueue 2) see if there is a) no scheduled messages between now and then
 
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

msgQueue

protected java.util.Vector msgQueue
DESCRIBE THE FIELD


taskQueue

protected java.util.TreeSet taskQueue
DESCRIBE THE FIELD


logger

protected Logger logger
DESCRIBE THE FIELD


random

protected RandomSource random
DESCRIBE THE FIELD

Constructor Detail

GeometricNetworkSimulator

public GeometricNetworkSimulator(Environment env)
Constructor for GeometricNetworkSimulator.

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 GeometricNetworkSimulator 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

deliverMessage

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

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

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

simulate

public boolean simulate()
DESCRIBE THE METHOD

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

simulate

protected boolean simulate(long maxTime)
Delivers 1 message. Will advance the clock if necessary. If there is a message in the queue, deliver that and return true. If there is a message in the taskQueue, update the clock if necessary, deliver that, then return true. If both are empty, return false;

Parameters:
maxTime - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

simulateFor

public boolean simulateFor(int millis)
DESCRIBE THE METHOD

Specified by:
simulateFor in interface NetworkSimulator
Parameters:
millis - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

simulateUntil

public boolean simulateUntil(long targetTime)
1) process the msgQueue 2) see if there is a) no scheduled messages between now and then

Specified by:
simulateUntil in interface NetworkSimulator
Parameters:
targetTime - 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