|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.edsim.NextCycleEvent
public class NextCycleEvent
This class is used to wrap a CDProtocol
instance into an event so
that it can be used in the event based simulation engine.
This class is responsible for calling
CDProtocol.nextCycle(peersim.core.Node, int)
and also to schedule the consecutive cycle.
In the configuration of an event driven simulation CDProtocol
s can be
configured using CDScheduler
, which places appropriate instances of
this events in the queue.
Note that reimplementing method nextDelay(long)
of this class allows
for arbitrary scheduling,
including adaptively changing or irregular cycle lengths, etc.
CDScheduler
,
CDProtocol
Constructor Summary | |
---|---|
NextCycleEvent(java.lang.String n)
Reads configuration to initialize the object. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a clone of the object. |
void |
execute()
Executes the nextCycle method of the protocol, and schedules the next call using the delay returned by nextDelay(long) . |
protected long |
nextDelay(long step)
Calculates the delay until the next execution of the protocol. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NextCycleEvent(java.lang.String n)
super(n)
.
Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
return super.clone()
. In general,
always use super.clone()
to obtain the object to be returned
on which you can perform optional deep cloning operations (arrays, etc).
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public final void execute()
nextDelay(long)
.
If the next execution time as defined by the delay is outside of the
valid times as defined by CDScheduler.sch
, then the next event is not scheduled.
Note that this means that this protocol will no longer be scheduled because
the next event after the next event is scheduled by the next event.
protected long nextDelay(long step)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |