java.lang.Object
org.bzdev.math.rv.RandomVariable<Boolean>
org.bzdev.math.rv.BooleanRandomVariable
org.bzdev.math.rv.DetermBooleanRV
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<Boolean>
Random variable that generates a deterministic sequence of boolean values.
-
Constructor Summary
ConstructorsConstructorDescriptionDetermBooleanRV
(boolean[] values) /** Constructor for a repeating sequence.DetermBooleanRV
(boolean[] values, boolean finalValue) Constructor given initial values and a final value.DetermBooleanRV
(boolean value, boolean finalValue) Constructor given a starting value and a final value. -
Method Summary
Methods inherited from class org.bzdev.math.rv.BooleanRandomVariable
parallelStream, parallelStream, stream, stream, tightenMaximumS, tightenMinimumS
Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, tightenMaximum, tightenMinimum
-
Constructor Details
-
DetermBooleanRV
public DetermBooleanRV(boolean[] values) /** Constructor for a repeating sequence.- Parameters:
values
- the values of the random variable in the order in which these are returned
-
DetermBooleanRV
public DetermBooleanRV(boolean value, boolean finalValue) Constructor given a starting value and a final value.- Parameters:
value
- the starting value of the random variablefinalValue
- the subsequent value of the random variable
-
DetermBooleanRV
public DetermBooleanRV(boolean[] values, boolean finalValue) Constructor given initial values and a final value.- Parameters:
values
- the initial sequence of values for the random variablefinalValue
- the subsequent value of the random variable after the initial sequence is used
-
-
Method Details
-
getValues
public boolean[] getValues()Get the values.- Returns:
- an array of the values, excluding the final value
-
getFinalValue
public boolean getFinalValue()Get the final value- Returns:
- the final value; undefined if the sequence repeats forever
-
isRepeating
public boolean isRepeating()Determine if the sequence is a repeating one.- Returns:
- true if repeating, false otherwise.
-
next
Description copied from class:RandomVariable
Get the next value for a random variable. In general, each value will be independent of the last.- Specified by:
next
in interfaceRandomVariableOps<Boolean>
- Specified by:
next
in classRandomVariable<Boolean>
- Returns:
- the next value
-
toString
-
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<Boolean>
- Returns:
- the characteristics
-