Module org.bzdev.math
Package org.bzdev.math.rv
Class RandomVariableRV<T,RV extends RandomVariable<T>>
java.lang.Object
org.bzdev.math.rv.RandomVariable<RV>
org.bzdev.math.rv.RandomVariableRV<T,RV>
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<RV>
,RandomVariableRVOps<T,
RV>
- Direct Known Subclasses:
BooleanRandomVariableRV
,RandomVariableRVN
public abstract class RandomVariableRV<T,RV extends RandomVariable<T>>
extends RandomVariable<RV>
implements RandomVariableRVOps<T,RV>
Random variable that generates another random variable.
This class provides a superclass for random variables that generate
a random variable of some particular type. The random variable RV that
an instance of this class generates is a random variable that
generates values of type T. The use of two type parameters, T and RV,
allows both to be used - some subclasses require protected methods
that are cognizant of the type T (for example, a protected method
named "cmp" used by
RandomVariableRVN
.
The class does nothing other than providing a type constraint.
The interface RandomVariableRVOps
corresponds to this class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
determineIfOrdered
(RandomVariable... args) Determine if this random variable's streams must be ordered.protected int
Spliterator characteristics.Get an infinite parallel stream of random variables.parallelStream
(long size) Get a fixed-length parallel stream of random variables.stream()
Get an infinite stream of random variables.stream
(long size) Get a fixed-length stream of random variables.Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, next, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumS
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.math.rv.RandomVariableOps
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, next, setMaximum, setMinimum, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumS
-
Constructor Details
-
RandomVariableRV
public RandomVariableRV()
-
-
Method Details
-
determineIfOrdered
Determine if this random variable's streams must be ordered. Subclasses typically use random variables to generate a sequence of random variables, and If any of the random variables used are ordered, this random variable must also be ordered.A subclass's constructor should call this method if any of its arguments is a random variable unless that subclass overrides
RandomVariable.getCharacteristics()
.- Parameters:
args
- the random variables to check- See Also:
-
getCharacteristics
protected int getCharacteristics()Description copied from class:RandomVariable
Spliterator characteristics. The characteristics returned should not includeSpliterator.SIZED
orSpliterator.SUBSIZED
. The default value isSpliterator.IMMUTABLE
|Spliterator.NONNULL
. If the characteristics includeSpliterator.ORDERED
,Spliterator.trySplit()
will return null. The characteristics includeSpliterator.ORDERED
for the random variables in this package that return a deterministic sequence of values.- Overrides:
getCharacteristics
in classRandomVariable<RV extends RandomVariable<T>>
- Returns:
- the characteristics
-
stream
Get a fixed-length stream of random variables.- Parameters:
size
- the number of random values to provide- Returns:
- the stream
-
parallelStream
Get a fixed-length parallel stream of random variables.- Parameters:
size
- the number of random values to provide- Returns:
- the stream
-
stream
Get an infinite stream of random variables.- Returns:
- the stream
-
parallelStream
Get an infinite parallel stream of random variables.- Returns:
- the stream
-