|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.core.CommonState
public class CommonState
This is the common state of the simulation all objects see. Static singleton. One of its purposes is simplification of parameter structures and increasing efficiency by putting state information here instead of passing parameters.
The set methods should not be used by applications, they are for system components. Use them only if you know exactly what you are doing, e.g. if you are so advanced that you can write your own simulation engine. Ideally, they should not be visible, but due to the lack of more flexibility in java access rights, we are forced to make them public.
Parameter Summary | |
---|---|
random
Configuration parameter used to define which random generator class should be used. |
|
random.seed
Configuration parameter used to initialize the random seed. |
Field Summary | |
---|---|
static int |
PHASE_UNKNOWN
Constant that can be used as a value of simulation phase. |
static int |
POST_SIMULATION
Constant that can be used as a value of simulation phase. |
static ExtendedRandom |
r
This source of randomness should be used by all components. |
Constructor Summary | |
---|---|
protected |
CommonState()
Does nothing. |
Method Summary | |
---|---|
static long |
getEndTime()
Returns endtime. |
static int |
getIntTime()
Returns current time in integer format. |
static Node |
getNode()
Returns the current node. |
static int |
getPhase()
Returns the simulation phase. |
static int |
getPid()
Returns the current protocol identifier. |
static long |
getTime()
Returns current time. |
static void |
initializeRandom(long seed)
|
static void |
setEndTime(long t)
Sets the endtime. |
static void |
setNode(Node n)
Sets the current node |
static void |
setPhase(int p)
|
static void |
setPid(int p)
Sets the current protocol identifier. |
static void |
setTime(long t)
Sets the current time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parameter Detail |
---|
random
ExtendedRandom
is used. User-specified random generators
must extend class ExtendedRandom
.
random.seed
Field Detail |
---|
public static final int POST_SIMULATION
getPhase()
,
Constant Field Valuespublic static final int PHASE_UNKNOWN
getPhase()
,
Constant Field Valuespublic static ExtendedRandom r
Constructor Detail |
---|
protected CommonState()
Method Detail |
---|
public static long getTime()
public static int getIntTime()
setEndTime(long)
by the simulation engine. It uses the endtime for
the optimal mapping to get the maximal precision.
In particular, in the cycle
based model, time is the same as cycle which can be safely cast into
integer, so no precision is lost.
public static void setTime(long t)
public static long getEndTime()
getTime()
ever returns. If it's negative, it
means the endtime is not known.
public static void setEndTime(long t)
public static int getPhase()
PHASE_UNKNOWN
phase is unknownPOST_SIMULATION
the simulation is completed
public static void setPhase(int p)
public static int getPid()
getNode()
.
public static void setPid(int p)
public static Node getNode()
public static void setNode(Node n)
public static void initializeRandom(long seed)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |