peersim.transport
Class E2ENetwork

java.lang.Object
  extended by peersim.transport.E2ENetwork

public class E2ENetwork
extends java.lang.Object

This static singleton emulates an underlying router network of fixed size, and stores the latency measurements for all pairs of routers.


Method Summary
static int getLatency(int sender, int receiver)
          Returns the latency associated to the specified (sender, receiver) pair.
static int getSize()
          Returns the current size of the underlying network (i.e., the number of routers).
static void reset(int size, boolean symm)
          Resets the network, by creating a triangular (if symm is true) or a rectangular (if symm is false) array of integers.
static void setLatency(int sender, int receiver, int latency)
          Sets the latency associated to the specified (sender, receiver) pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reset

public static void reset(int size,
                         boolean symm)
Resets the network, by creating a triangular (if symm is true) or a rectangular (if symm is false) array of integers. Initially all latencies between any pairs are set to be 0.

Parameters:
size - the number or routers
symm - if latency is symmetric between all pairs of routers

getLatency

public static int getLatency(int sender,
                             int receiver)
Returns the latency associated to the specified (sender, receiver) pair. Routers are indexed from 0.

Parameters:
sender - the index of the sender
receiver - the index of the receiver
Returns:
the latency associated to the specified (sender, receiver) pair.

setLatency

public static void setLatency(int sender,
                              int receiver,
                              int latency)
Sets the latency associated to the specified (sender, receiver) pair. Routers are indexed from 0.

Parameters:
sender - the index of the sender
receiver - the index of the receiver
latency - the latency to be set

getSize

public static int getSize()
Returns the current size of the underlying network (i.e., the number of routers).