|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.dynamics.OscillatingNetwork
public class OscillatingNetwork
Makes the network size oscillate.
The network size will be the function of time, parameterized by this
parameter. The size function is
avg+sin(time*pi/"period")*ampl
where
avg=("maxsize"+"minsize")/2
and
ampl=("maxsize"-"minsize")/2
.
This function is independent of how many times this class is executed, that
is, whenever it is executed, it takes the current time and sets the network
size accordingly.
Parameter Summary | |
---|---|
init
Config parameter which gives the prefix of node initializers. |
|
maxsize
Nodes are added until the size specified by this parameter is reached. |
|
minsize
Nodes are removed until the size specified by this parameter is reached. |
|
period
Config parameter used to define the length of one period of the oscillation. |
Constructor Summary | |
---|---|
OscillatingNetwork(java.lang.String prefix)
Standard constructor that reads the configuration parameters. |
Method Summary | |
---|---|
protected void |
add(int n)
Adds n nodes to the network. |
boolean |
execute()
Takes the current time and sets the network size according to a periodic function of time. |
protected void |
remove(int n)
Removes n nodes from the network. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parameter Detail |
---|
init
control.0 DynamicNetwork control.0.init.0 RandNI control.0.init.0.k 5 control.0.init.0.protocol somelinkable ...
maxsize
minsize
period
avg+sin(time*pi/"period")*ampl
where
avg=("maxsize"+"minsize")/2
and
ampl=("maxsize"-"minsize")/2
.
Constructor Detail |
---|
public OscillatingNetwork(java.lang.String prefix)
prefix
- the configuration prefix for this classMethod Detail |
---|
protected void add(int n)
n
- the number of nodes to add, must be non-negative.protected void remove(int n)
Network.remove(int)
.
n
- the number of nodes to removepublic boolean execute()
avg+sin(time*pi/"period")*ampl
where
avg=("maxsize"+"minsize")/2
and
ampl=("maxsize"-"minsize")/2
.
Calls add(int)
or remove(int)
depending on whether the size
needs to be increased or decreased to get the desired size.
execute
in interface Control
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |