java.lang.Object
org.bzdev.math.rv.RandomVariable<Double>
org.bzdev.math.rv.DoubleRandomVariable
org.bzdev.math.rv.FixedDoubleRV
- All Implemented Interfaces:
Cloneable,RandomVariableOps<Double>
Random variable that always generates the same double-precision value.
Useful when passing a constant to a method that expects a
random variable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetValue()Get the value of this random variable, which is a constant.next()Get the next value for a random variable.voidsetMaximum(Double max, boolean closed) Set the maximum value for a random variable.voidsetMinimum(Double min, boolean closed) Set the minimum value for a random variable.voidtightenMaximum(Double max, boolean closed) Tighten the maximum value for a random variable.voidtightenMinimum(Double min, boolean closed) Tighten the minimum value for a random variable.toString()Methods inherited from class org.bzdev.math.rv.DoubleRandomVariable
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximumS, tightenMinimumSMethods inherited from class org.bzdev.math.rv.RandomVariable
clone, getCharacteristics
-
Constructor Details
-
FixedDoubleRV
public FixedDoubleRV(double value) Constructor.- Parameters:
value- the value of the random variable
-
-
Method Details
-
getValue
public double getValue()Get the value of this random variable, which is a constant.- Returns:
- the value
-
setMinimum
public void setMinimum(Double min, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableSet the minimum value for a random variable.- Specified by:
setMinimumin interfaceRandomVariableOps<Double>- Overrides:
setMinimumin classDoubleRandomVariable- 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- Throws:
UnsupportedOperationException- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException- an argument is out of range
-
tightenMinimum
public void tightenMinimum(Double min, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableTighten the minimum value for a random variable. If there is no minimum value, it will be set. Otherwise the minimum of the allowed range will not decrease.- Specified by:
tightenMinimumin interfaceRandomVariableOps<Double>- Overrides:
tightenMinimumin classDoubleRandomVariable- 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- Throws:
UnsupportedOperationException- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException- an argument is out of range
-
setMaximum
public void setMaximum(Double max, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableSet the maximum value for a random variable.- Specified by:
setMaximumin interfaceRandomVariableOps<Double>- Overrides:
setMaximumin classDoubleRandomVariable- Parameters:
max- maximum value.closed- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException- an argument is out of range
-
tightenMaximum
public void tightenMaximum(Double max, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableTighten the maximum value for a random variable. If there is no maximum value, it will be set. Otherwise the maximum of the allowed range will not increase.- Specified by:
tightenMaximumin interfaceRandomVariableOps<Double>- Overrides:
tightenMaximumin classDoubleRandomVariable- Parameters:
max- maximum value.closed- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException- an argument is out of range
-
next
Description copied from class:RandomVariableGet the next value for a random variable. In general, each value will be independent of the last.- Specified by:
nextin interfaceRandomVariableOps<Double>- Specified by:
nextin classRandomVariable<Double>- Returns:
- the next value
-
toString
-