java.lang.Object
org.bzdev.math.rv.RandomVariable<Long>
org.bzdev.math.rv.LongRandomVariable
org.bzdev.math.rv.InterarrivalTimeRV
org.bzdev.math.rv.DetermIATimeRV
- All Implemented Interfaces:
Cloneable,RandomVariableOps<Long>
Random variable that generates a deterministic sequence of long values.
-
Constructor Summary
ConstructorsConstructorDescriptionDetermIATimeRV(long[] values) Constructor for a repeating sequence.DetermIATimeRV(long[] values, long finalValue) Constructor.DetermIATimeRV(long value, long finalValue) Constructor given a starting value and a final value. -
Method Summary
Modifier and TypeMethodDescriptionprotected intSpliterator characteristics.longGet the final value for this random variable.long[]Get the values for this random variable.booleanDetermine if this random variable repeats its sequence.next()Get the next value for a random variable.voidsetMaximum(Long max, boolean closed) Set the maximum value for a random variable.voidsetMinimum(Long min, boolean closed) Set the minimum value for a random variable.toString()Methods inherited from class org.bzdev.math.rv.LongRandomVariable
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumSMethods inherited from class org.bzdev.math.rv.RandomVariable
clone
-
Constructor Details
-
DetermIATimeRV
public DetermIATimeRV(long[] values, long finalValue) Constructor. When next is called, after the values in the first argument are returned in order, the final value is returned persistently from then on.- Parameters:
values- the values of the random variable in the order in which these are returnedfinalValue- the final value of the random variable
-
DetermIATimeRV
public DetermIATimeRV(long[] values) Constructor for a repeating sequence.- Parameters:
values- the values of the random variable in the order in which these are returned
-
DetermIATimeRV
public DetermIATimeRV(long value, long 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
-
-
Method Details
-
getValues
public long[] getValues()Get the values for this random variable.- Returns:
- the values in the order in which they are generated, excluding a final value for the non-repeating case
-
getFinalValue
public long getFinalValue()Get the final value for this random variable.- Returns:
- the final value; 0 if this random variable repeats
-
isRepeating
public boolean isRepeating()Determine if this random variable repeats its sequence.- Returns:
- true if it is repeating; false otherwise
-
setMinimum
public void setMinimum(Long min, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableSet the minimum value for a random variable.- Specified by:
setMinimumin interfaceRandomVariableOps<Long>- Overrides:
setMinimumin classLongRandomVariable- 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(Long max, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariableSet the maximum value for a random variable.- Specified by:
setMaximumin interfaceRandomVariableOps<Long>- Overrides:
setMaximumin classLongRandomVariable- 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<Long>- Specified by:
nextin classRandomVariable<Long>- Returns:
- the next value
-
toString
-
getCharacteristics
protected int getCharacteristics()Description copied from class:RandomVariableSpliterator characteristics. The characteristics returned should not includeSpliterator.SIZEDorSpliterator.SUBSIZED. The default value isSpliterator.IMMUTABLE|Spliterator.NONNULL. If the characteristics includeSpliterator.ORDERED,Spliterator.trySplit()will return null. The characteristics includeSpliterator.ORDEREDfor the random variables in this package that return a deterministic sequence of values.- Overrides:
getCharacteristicsin classRandomVariable<Long>- Returns:
- the characteristics
-