public class PeriodicRandomSensor
extends java.lang.Object
The generated TStream
has a org.apache.commons.math3.utils.Pair
tuple type where Pair.getFirst()
the reading's msecTimestamp
and Pair.getSecond()
is the sensor value reading.
The sensor reading values are randomly generated via Random
and have the value distributions, as defined by Random
.
Each stream has its own Random
object instance.
Constructor and Description |
---|
PeriodicRandomSensor()
Create a new random periodic sensor factory configured
to use
Random.Random() . |
PeriodicRandomSensor(long seed)
Create a new random periodic sensor factory configured
to use
Random.Random(long) . |
Modifier and Type | Method and Description |
---|---|
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Boolean>> |
newBoolean(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextBoolean() . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,byte[]>> |
newBytes(Topology t,
long periodMsec,
int nBytes)
Create a periodic sensor stream with readings from
Random.nextBytes(byte[]) . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Double>> |
newDouble(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextDouble() . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Float>> |
newFloat(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextFloat() . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Double>> |
newGaussian(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextGaussian() . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Integer>> |
newInteger(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextInt() . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Integer>> |
newInteger(Topology t,
long periodMsec,
int bound)
Create a periodic sensor stream with readings from
Random.nextInt(int) . |
TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Long>> |
newLong(Topology t,
long periodMsec)
Create a periodic sensor stream with readings from
Random.nextLong() . |
void |
setSeed(long seed)
Set the seed to be used by subsequently created sensor streams.
|
public PeriodicRandomSensor()
Random.Random()
.public PeriodicRandomSensor(long seed)
Random.Random(long)
.seed
- seed to use when creating new sensor streams.public void setSeed(long seed)
seed
- the seed valuepublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Double>> newGaussian(Topology t, long periodMsec)
Random.nextGaussian()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Double>> newDouble(Topology t, long periodMsec)
Random.nextDouble()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Float>> newFloat(Topology t, long periodMsec)
Random.nextFloat()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Long>> newLong(Topology t, long periodMsec)
Random.nextLong()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Integer>> newInteger(Topology t, long periodMsec)
Random.nextInt()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Integer>> newInteger(Topology t, long periodMsec, int bound)
Random.nextInt(int)
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingbound
- the upper bound (exclusive). Must be positive.public TStream<org.apache.commons.math3.util.Pair<java.lang.Long,java.lang.Boolean>> newBoolean(Topology t, long periodMsec)
Random.nextBoolean()
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingpublic TStream<org.apache.commons.math3.util.Pair<java.lang.Long,byte[]>> newBytes(Topology t, long periodMsec, int nBytes)
Random.nextBytes(byte[])
.t
- the topology to add the sensor stream toperiodMsec
- how frequently to generate a readingnBytes
- the number of bytes in each reading tupleCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641