|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.prototypes.IlvGroupElement
ilog.views.prototypes.IlvValueSource
ilog.views.prototypes.IlvClockValueSource
public class IlvClockValueSource
The class IlvClockValueSource is used to generate values at a
specified time interval.
This class produces its own values which are:
time - the initial time. The number of milliseconds that has elapsed
since the source was started is added to this time.
hours - the number of hours in time.
minutes - the number of minutes (modulo 60)
in time.
seconds - the number of seconds (modulo 60)
in time.
totalMinutes - the total number of minutes in
time.
totalSeconds - the total number of seconds in
time.
milliseconds - time modulo 1000.
Note: By default, the clock value sources are not in
"real time" mode, so the time values may not be accurate with respect to
real time. To get more realistic times, you can call
setRealTimeMode(true).
IlvValueSource,
IlvRandomValueSource,
Serialized Form| Field Summary |
|---|
| Fields inherited from class ilog.views.prototypes.IlvValueSource |
|---|
RUNNING, STOPPED, SUSPENDED |
| Constructor Summary | |
|---|---|
IlvClockValueSource(IlvClockValueSource source)
Creates a new value source object by copying an existing one. |
|
IlvClockValueSource(IlvInputStream in)
Reads the value source from an IlvInputStream stream. |
|
IlvClockValueSource(String name,
long period,
long initialTime)
Creates a new clock value source. |
|
| Method Summary | |
|---|---|
IlvGroupElement |
copy()
Returns a copy of the value source. |
long |
getInitialTime()
Returns the initial time of the clock value source. |
long |
getPeriod()
Returns the period of the clock value source. |
static boolean |
getRealTimeMode()
Returns the "real time" mode of all the clock value sources and animation behaviors. |
int |
getSynchronizationCount()
This method returns 0: clocks are not synchronized. |
long |
getTimerPeriod()
Returns getPeriod(). |
String[] |
getValueNames(boolean publicOnly)
Returns the values handled or produced by the clock value source. |
boolean |
isOutput(String name)
Returns true if the specified name
is equal to one of the time values produced by this clock value source
("time", "hours", and so on). |
protected void |
resume()
Restarts the clock. |
void |
setInitialTime(long initialTime)
Sets the initial time of the clock value source to a new value. |
void |
setPeriod(long period)
Sets the period of the clock value source to a new value. |
static void |
setRealTimeMode(boolean realTime)
Sets the "real time" mode of all the clock value sources and animation behaviors. |
protected void |
start()
Starts the clock. |
protected void |
stop()
Interrupts the clock. |
protected void |
suspend()
Suspends the clock. |
protected void |
tick(Vector names,
Vector values)
Called every time a set of time values is generated. |
void |
timerTicked()
This method generates the time values at time intervals specified by the period parameter passed to the constructor. |
void |
write(IlvOutputStream out)
Writes the value source to an IlvOutputStream. |
| Methods inherited from class ilog.views.prototypes.IlvValueSource |
|---|
addPropertyChangeListener, getState, removePropertyChangeListener, set, setState |
| Methods inherited from class ilog.views.prototypes.IlvGroupElement |
|---|
applyTransform, applyTransform, boundingBox, boundingBox, get, get, get, getBoolean, getDouble, getFloat, getInt, getLong, getName, getParent, getRelativePath, getString, getSubscribers, getSubscriptionValues, move, pushValue, pushValues, set, set, set, set, set, set, set, setName, subscribe, traverse, unsubscribe |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvClockValueSource(String name,
long period,
long initialTime)
name - the name of the clock value source.period - the time interval at which values
are generated. The time interval is expressed in milliseconds.initialTime - the initial time used as a
basis to generate the time values. The initial time is expressed in milliseconds.public IlvClockValueSource(IlvClockValueSource source)
source - The behavior object to be copied.
public IlvClockValueSource(IlvInputStream in)
throws IlvReadFileException
IlvInputStream stream.
This constructor must be called by the
input constructors of subclasses.
in - The input stream.
IlvReadFileException - if the stream format is not correct.| Method Detail |
|---|
public void write(IlvOutputStream out)
throws IOException
IlvOutputStream.
write in interface IlvPersistentObjectwrite in class IlvValueSourceout - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.IlvGroup.write(ilog.views.io.IlvOutputStream)public IlvGroupElement copy()
copy in class IlvValueSourceIlvGroup.copy(ilog.views.prototypes.IlvGroup)protected void start()
start in class IlvValueSourceprotected void stop()
stop in class IlvValueSourceprotected void suspend()
suspend in class IlvValueSourceprotected void resume()
resume in class IlvValueSource
protected void tick(Vector names,
Vector values)
names - a vector containing the names of the properties that will
be generated by a call to pushValues. Subclasses can add
new values to this vector.values - a vector containing the values that will
be generated by a call to pushValues. Subclasses can add
new values to this vector.public void setPeriod(long period)
period - the new period in milliseconds.public long getPeriod()
public void setInitialTime(long initialTime)
initialTime - the new initial time in milliseconds.public long getInitialTime()
public String[] getValueNames(boolean publicOnly)
throws IlvValueException
getValueNames in class IlvGroupElementpublicOnly - ignored by this class.
IlvValueException - if an error occurred while reading a property.public boolean isOutput(String name)
true if the specified name
is equal to one of the time values produced by this clock value source
("time", "hours", and so on).
isOutput in class IlvGroupElementpublic long getTimerPeriod()
getPeriod().
public void timerTicked()
period parameter passed to the constructor.
public int getSynchronizationCount()
public static void setRealTimeMode(boolean realTime)
If realTime is true, the clock value
sources will (try to) tick in real time, that is, a source with a period
of one second will really tick every second, regardless of
the time spent pushing the time values. Of course, real time
clocks are limited by the speed of your CPU.
If realTime is false, the sources
will simply wait for the specified period between two ticks,
so the actual times will be late with respect to real time.
Using many and/or fast real time clocks can lead to applications running continuously and thus consuming a lot of CPU.
Note that the real time mode also affects all the animation behaviors (subclasses of IlvAnimationBehavior), which are controlled by the same thread as the clock value sources.
By default, the real time mode is set to false.
IlvAnimationBehaviorpublic static boolean getRealTimeMode()
setRealTimeMode(boolean)
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||