public class SimClock
extends java.util.Observable
java.util.Observable
thus representing the 'observable' part in
a 'observer'-design pattern as described in [Gamm95] page 107. This enables
observers to register themselves at the simulation clock to be notified
whenever the simulation time changes. This can be easily used to provide
fully automatic statistical counters. Each time the simulation time changes,
a counter registered at the simulation clock is notofied and can poll the
value it is observing (most likely from a special ValueSupplier
object). This way, no explicit calls for the counter to update its observed
value are needed. Note that on the other hand this might reduce performance
in comparison to explicit update call since the value under observation might
not change each time the simulation time is changed.Observable
Constructor and Description |
---|
SimClock(java.lang.String name)
Constructs a simulation clock with no parameters given.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Returns the clock's name as string.
|
TimeInstant |
getTime()
Returns the actual simulation time.
|
java.lang.String |
toString()
Returns the clock's name as string.
|
public SimClock(java.lang.String name)
name
- String : The name of the simulation clockpublic java.lang.String getName()
NamedObjectImp
.public TimeInstant getTime()
public java.lang.String toString()
NamedObjectImp
.toString
in class java.lang.Object