public class TraceVariate extends RandomVariateBase
doubles
and a default value. Unless the supporting
RandomNumber is replaced, generate
will return the contents of
the array in order. After all values of the array have been used, the default
value is returned until reset.Modifier and Type | Field and Description |
---|---|
private boolean |
allDataInToString
True if all of the trace values will be included in the result of
toString.
|
private static double |
DEFAULT_DEFAULT_VALUE
The default value for the default is Double.NaN
|
private double |
defaultValue
The value to be generated after all of the trace values are used.
|
private static java.text.DecimalFormat |
DF |
static int |
SHORT_NUMBER
The number of values to limit the output of toString to if
allDataInToString is false.
|
private double[] |
traceValues
An array of the values to be generated.
|
rng
Constructor and Description |
---|
TraceVariate()
Constructs a new TraceVariate.
|
Modifier and Type | Method and Description |
---|---|
double |
generate()
Generate a random variate having this class's distribution.
|
double |
getDefaultValue() |
java.lang.Object[] |
getParameters()
Returns a 1 or 2 element array containing the trace value array and the
default value (if not NaN).
|
double[] |
getTraceValues() |
void |
setAllDataInToString(boolean allDataInToString) |
void |
setDefaultValue(double defaultValue) |
void |
setParameters(java.lang.Object... params)
Sets the contents of the trace array and (optionally) the default value.
|
void |
setRandomNumber(RandomNumber rng)
This is a no-op because the TraceVariate must use a Sequential instance
to successively generate values
|
void |
setTraceValues(double[] traceValues) |
java.lang.String |
toString()
Returns a String containing the trace values.
|
getRandomNumber
private static final double DEFAULT_DEFAULT_VALUE
private static final java.text.DecimalFormat DF
private double[] traceValues
private double defaultValue
private boolean allDataInToString
public static final int SHORT_NUMBER
public TraceVariate()
public void setTraceValues(double[] traceValues)
traceValues
- the traceValues to be returned by generate().public double[] getTraceValues()
public void setDefaultValue(double defaultValue)
defaultValue
- the defaultValue that will be generated after all of
the trace values have been used.public double getDefaultValue()
public void setAllDataInToString(boolean allDataInToString)
allDataInToString
- True if all of the trace values will be included
in the result of toString. If false, only a limited number of values will
be output.public void setParameters(java.lang.Object... params)
params
- A 1 or 2 element array. The first element is an array of
doubles containing the values to be returned by generate
.
The second (optional) element contains the default value to be returned
after all of the trace values have been used.java.lang.IllegalArgumentException
- If the array is not 1 or 2 elements, if
the first element is not an array of doubles
, or if the 2nd
element (if present) is not a Number.public java.lang.Object[] getParameters()
public double generate()
RandomVariate
public java.lang.String toString()
toString
in class java.lang.Object
public void setRandomNumber(RandomNumber rng)
setRandomNumber
in interface RandomVariate
setRandomNumber
in class RandomVariateBase
rng
- The RandomNumber instance