Module org.bzdev.math
Package org.bzdev.math.rv
Class IntegerRandomVariableRV<IRV extends IntegerRandomVariable>
- All Implemented Interfaces:
Cloneable,RandomVariableOps<IRV>,RandomVariableRVNOps<Integer,,IRV> RandomVariableRVOps<Integer,IRV>
- Direct Known Subclasses:
BinomialIntegerRVRV,FixedIntegerRVRV,PoissonIntegerRVRV,UniformIntegerRVRV
public abstract class IntegerRandomVariableRV<IRV extends IntegerRandomVariable>
extends RandomVariableRVN<Integer,IRV>
Random variable that generates the a sequence of random variables, each
of which generates a sequence of integers (of type Integer). The type
parameter IRV is set to the type of random variable that is to be
generated, which will usually be a subclass of IntegerRandomVariable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intCompare two numbers of type T.next()Get the next value for a random variable.voidsetMaximum(Integer min, boolean closed) Set the maximum value for a random variable.voidsetMinimum(Integer min, boolean closed) Set the minimum value for a random variable.voidtightenMaximum(Integer x, boolean b) Set the maximum value for a random variable, provided the new value is lower than the previous value.voidtightenMaximumS(String s, boolean b) Tighten the maximum value for a random variable given a string.voidtightenMinimum(Integer x, boolean b) Set the manimum value for a random variable, provided the new value is higher than the previous value.voidtightenMinimumS(String s, boolean b) Tighten the minimum value for a random variable given a string.Methods inherited from class org.bzdev.math.rv.RandomVariableRVN
doNext, getMaximumClosed, getMaximumRV, getMinimumClosed, getMinimumRVMethods inherited from class org.bzdev.math.rv.RandomVariableRV
determineIfOrdered, getCharacteristics, parallelStream, parallelStream, stream, streamMethods inherited from class org.bzdev.math.rv.RandomVariable
clone, getMaximum, getMinimum, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, tightenMaximum, tightenMinimumMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bzdev.math.rv.RandomVariableOps
getMaximum, getMinimum, setMaximum, setMinimum, tightenMaximum, tightenMinimum
-
Constructor Details
-
IntegerRandomVariableRV
public IntegerRandomVariableRV()
-
-
Method Details
-
cmp
Description copied from class:RandomVariableRVNCompare two numbers of type T.- Specified by:
cmpin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Parameters:
x- the first numbery- the second number- Returns:
- a negative value if v1 $lt; v2, 0 if v1 == v2, and a positive value if v1 > v2
-
tightenMinimumS
Description copied from class:RandomVariableTighten the minimum value for a random variable given a string. If there is no minimum value, it will be set. Otherwise the minimum of the allowed range will not decrease. The string argument is a number in a format acceptable to the constructors for Integer, Long, or Double as appropriate.- Specified by:
tightenMinimumSin interfaceRandomVariableOps<IRV extends IntegerRandomVariable>- Specified by:
tightenMinimumSin classRandomVariable<IRV extends IntegerRandomVariable>- Parameters:
s- minimum value.b- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
IllegalArgumentException- an argument is out of range
-
tightenMaximumS
Description copied from class:RandomVariableTighten the maximum value for a random variable given a string. If there is no maximum value, it will be set. Otherwise the maximum of the allowed range will not increase. The string argument is a number in a format acceptable to the constructors for Integer, Long, or Double as appropriate.- Specified by:
tightenMaximumSin interfaceRandomVariableOps<IRV extends IntegerRandomVariable>- Specified by:
tightenMaximumSin classRandomVariable<IRV extends IntegerRandomVariable>- Parameters:
s- maximum value.b- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
IllegalArgumentException- an argument is out of range
-
tightenMinimum
Description copied from interface:RandomVariableRVNOpsSet the manimum value for a random variable, provided the new value is higher than the previous value.- Specified by:
tightenMinimumin interfaceRandomVariableRVNOps<Integer,IRV extends IntegerRandomVariable> - Overrides:
tightenMinimumin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Parameters:
x- minimum value.b- true if the minimum value is part of the range; false if it is a lower bound on the range
-
tightenMaximum
Description copied from interface:RandomVariableRVNOpsSet the maximum value for a random variable, provided the new value is lower than the previous value.- Specified by:
tightenMaximumin interfaceRandomVariableRVNOps<Integer,IRV extends IntegerRandomVariable> - Overrides:
tightenMaximumin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Parameters:
x- maximum value.b- true if the minimum value is part of the range; false if it is a lower bound on the range
-
setMinimum
Description copied from class:RandomVariableRVNSet the minimum value for a random variable. The minimum value will be set for the random variable returned by a call tonext()- Specified by:
setMinimumin interfaceRandomVariableRVNOps<Integer,IRV extends IntegerRandomVariable> - Overrides:
setMinimumin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Parameters:
min- minimum value.closed- true if the minimum value is part of the range; false if it is a lower bound on the range
-
setMaximum
Description copied from class:RandomVariableRVNSet the maximum value for a random variable. The maximum value will be set for the random variable returned by a call tonext()- Specified by:
setMaximumin interfaceRandomVariableRVNOps<Integer,IRV extends IntegerRandomVariable> - Overrides:
setMaximumin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Parameters:
min- maximum value.closed- true if the minimum value is part of the range; false if it is a lower bound on the range
-
next
Description copied from class:RandomVariableRVNGet the next value for a random variable. The next value is actually computed by callingRandomVariableRVN.doNext(), which subclasses must implement and which should either create a new random variable or clone an existing one. Direct subclasses will in general have to include the method definition "public RV next() {return super.next();}" with RV replaced with the type or type parameter appearing in the RV slot above in order to prevent issues with type-erasures. This is handled by the classesIntegerRandomVariableRV,LongRandomVariableRV, andDoubleRandomVariableRV- Specified by:
nextin interfaceRandomVariableOps<IRV extends IntegerRandomVariable>- Specified by:
nextin interfaceRandomVariableRVNOps<Integer,IRV extends IntegerRandomVariable> - Overrides:
nextin classRandomVariableRVN<Integer,IRV extends IntegerRandomVariable> - Returns:
- the next random variable
-