Module org.bzdev.math
Package org.bzdev.math.rv
Class LongRandomVariableRV<LRV extends LongRandomVariable>
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<LRV>
,RandomVariableRVNOps<Long,
,LRV> RandomVariableRVOps<Long,
LRV>
- Direct Known Subclasses:
BinomialLongRVRV
,FixedLongRVRV
,InterarrivalTimeRVRV
,PoissonLongRVRV
,UniformLongRVRV
public abstract class LongRandomVariableRV<LRV extends LongRandomVariable>
extends RandomVariableRVN<Long,LRV>
Random variable that generates the a sequence of random variables, each
of which generates a sequence of integers (of type Long). The type
parameter LRV is set to the type of random variable that is to be
generated, which will usually be a subclass of LongRandomVariable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Compare two numbers of type T.next()
Get the next value for a random variable.void
setMaximum
(Long min, boolean closed) Set the maximum value for a random variable.void
setMinimum
(Long min, boolean closed) Set the minimum value for a random variable.void
tightenMaximum
(Long x, boolean b) Set the maximum value for a random variable, provided the new value is lower than the previous value.void
tightenMaximumS
(String s, boolean b) Tighten the maximum value for a random variable given a string.void
tightenMinimum
(Long x, boolean b) Set the manimum value for a random variable, provided the new value is higher than the previous value.void
tightenMinimumS
(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, getMinimumRV
Methods inherited from class org.bzdev.math.rv.RandomVariableRV
determineIfOrdered, getCharacteristics, parallelStream, parallelStream, stream, stream
Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getMaximum, getMinimum, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, tightenMaximum, tightenMinimum
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, getMinimum, setMaximum, setMinimum, tightenMaximum, tightenMinimum
-
Constructor Details
-
LongRandomVariableRV
public LongRandomVariableRV()
-
-
Method Details
-
cmp
Description copied from class:RandomVariableRVN
Compare two numbers of type T.- Specified by:
cmp
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - 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:RandomVariable
Tighten 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:
tightenMinimumS
in interfaceRandomVariableOps<LRV extends LongRandomVariable>
- Specified by:
tightenMinimumS
in classRandomVariable<LRV extends LongRandomVariable>
- 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:RandomVariable
Tighten 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:
tightenMaximumS
in interfaceRandomVariableOps<LRV extends LongRandomVariable>
- Specified by:
tightenMaximumS
in classRandomVariable<LRV extends LongRandomVariable>
- 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:RandomVariableRVNOps
Set the manimum value for a random variable, provided the new value is higher than the previous value.- Specified by:
tightenMinimum
in interfaceRandomVariableRVNOps<Long,
LRV extends LongRandomVariable> - Overrides:
tightenMinimum
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - 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:RandomVariableRVNOps
Set the maximum value for a random variable, provided the new value is lower than the previous value.- Specified by:
tightenMaximum
in interfaceRandomVariableRVNOps<Long,
LRV extends LongRandomVariable> - Overrides:
tightenMaximum
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - 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:RandomVariableRVN
Set the minimum value for a random variable. The minimum value will be set for the random variable returned by a call tonext()
- Specified by:
setMinimum
in interfaceRandomVariableRVNOps<Long,
LRV extends LongRandomVariable> - Overrides:
setMinimum
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - 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:RandomVariableRVN
Set the maximum value for a random variable. The maximum value will be set for the random variable returned by a call tonext()
- Specified by:
setMaximum
in interfaceRandomVariableRVNOps<Long,
LRV extends LongRandomVariable> - Overrides:
setMaximum
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - 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:RandomVariableRVN
Get 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:
next
in interfaceRandomVariableOps<LRV extends LongRandomVariable>
- Specified by:
next
in interfaceRandomVariableRVNOps<Long,
LRV extends LongRandomVariable> - Overrides:
next
in classRandomVariableRVN<Long,
LRV extends LongRandomVariable> - Returns:
- the next random variable
-