public class IlvRandomValueSource extends IlvClockValueSource
IlvRandomValueSource is a subclass of
IlvClockValueSource that generates a random value at a specified
time interval.IlvClockValueSource,
Serialized FormRUNNING, STOPPED, SUSPENDED| Constructor and Description |
|---|
IlvRandomValueSource(IlvInputStream in)
Reads the value source from an
IlvInputStream stream. |
IlvRandomValueSource(IlvRandomValueSource source)
Creates a new value source object by copying an existing one.
|
IlvRandomValueSource(String name,
long period,
String valueName,
double min,
double max)
Creates a new value source that generates random values.
|
| Modifier and Type | Method and Description |
|---|---|
IlvGroupElement |
copy()
Returns a copy of the value source.
|
double |
getMax()
Returns the maximum value produced by this source.
|
double |
getMin()
Returns the minimum value produced by this source.
|
String |
getValueName()
Returns the name of the random value produced by this source.
|
String[] |
getValueNames(boolean publicOnly)
Returns the values handled or produced by this source.
|
boolean |
isOutput(String name)
Returns
true if the specified name is equal to
one of the time values produced by this source ("time",
"hours", and so on). |
void |
setMax(double max)
Sets the maximum value produced by this source.
|
void |
setMin(double min)
Sets the minimum value produced by this source.
|
void |
setValueName(String valueName)
Sets the name of the random value produced by this source.
|
protected void |
tick(Vector names,
Vector values)
Adds the name specified by the
valueName parameter passed to
the constructor to the names parameter. |
void |
write(IlvOutputStream out)
Writes the value source to an
IlvOutputStream. |
getInitialTime, getPeriod, getRealTimeMode, getSynchronizationCount, getTimerPeriod, resume, setInitialTime, setPeriod, setRealTimeMode, start, stop, suspend, timerTickedaddPropertyChangeListener, getState, removePropertyChangeListener, set, setStateapplyTransform, 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, unsubscribepublic IlvRandomValueSource(String name, long period, String valueName, double min, double max)
name - the name of the property source.period - the time interval (in milliseconds) between two value generations.valueName - the name of the generated value, which will contain random numbers
between min and max.min - the minimum boundary of the generated random numbers.max - the maximum boundary of the generated random numbers.public IlvRandomValueSource(IlvRandomValueSource source)
source - The behavior object to be copied.public IlvRandomValueSource(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.public void write(IlvOutputStream out) throws IOException
IlvOutputStream.write in interface IlvPersistentObjectwrite in class IlvClockValueSourceout - 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 IlvClockValueSourceIlvGroup.copy(ilog.views.prototypes.IlvGroup)protected void tick(Vector names, Vector values)
valueName parameter passed to
the constructor to the names parameter. Also adds to the
values vector a random value of type double
contained between the min and max parameters
passed to the constructor.tick in class IlvClockValueSourcenames - a vector containing the names of the properties that will be
generated by a call to pushValues.values - a vector containing the values that will be generated by a call to
pushValues.public void setValueName(String valueName)
valueName - the name of new value.public String getValueName()
public void setMin(double min)
min - the new minimum value.public double getMin()
public void setMax(double max)
max - the new maximum value.public double getMax()
public String[] getValueNames(boolean publicOnly) throws IlvValueException
getValueNames in class IlvClockValueSourcepublicOnly - ignored by this class.IlvValueException - if an error occurred while setting a property.public boolean isOutput(String name)
true if the specified name is equal to
one of the time values produced by this source ("time",
"hours", and so on).isOutput in class IlvClockValueSource© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.