peersim.cdsim
Class CDState

java.lang.Object
  extended by peersim.core.CommonState
      extended by peersim.cdsim.CDState

public class CDState
extends CommonState

This is the common state of a cycle driven simulation that all objects see. It contains additional information, specific to the cycle driven model, in addition to the info in CommonState.


Parameter Summary
 
Parameters inherited from class peersim.core.CommonState
random, random.seed
 
Field Summary
 
Fields inherited from class peersim.core.CommonState
PHASE_UNKNOWN, POST_SIMULATION, r
 
Method Summary
static int getCycle()
          Returns the current cycle.
static java.lang.Integer getCycleObj()
          Returns current cycle as an Integer object.
static int getCycleT()
          Returns the current time within the current cycle.
static boolean isCD()
          Returns true if and only if there is a cycle driven simulation going on.
static void setCycle(int t)
          Sets current cycle.
static void setCycleT(int t)
           
 
Methods inherited from class peersim.core.CommonState
getEndTime, getIntTime, getNode, getPhase, getPid, getTime, initializeRandom, setEndTime, setNode, setPhase, setPid, setTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isCD

public static boolean isCD()
Returns true if and only if there is a cycle driven simulation going on.


getCycle

public static int getCycle()
Returns the current cycle. Note that CommonState.getTime() returns the same value.

Throws:
java.lang.UnsupportedOperationException - if no cycle-driven state is available

setCycle

public static void setCycle(int t)
Sets current cycle. Resets also cycle time to 0. It also calls CommonState.setTime(long) with the given parameter, to make sure CommonState.getTime() is indeed independent of the simulation model.


getCycleObj

public static java.lang.Integer getCycleObj()
Returns current cycle as an Integer object.

Throws:
java.lang.UnsupportedOperationException - if no cycle-driven state is available

getCycleT

public static int getCycleT()
Returns the current time within the current cycle. Note that the time returned by getCycle() is the cycle id in this case. In other words, it returns the number of nodes that have already been visited in a given cycle.

Throws:
java.lang.UnsupportedOperationException - if no cycle-driven state is available

setCycleT

public static void setCycleT(int t)