jsynoptic.builtin
Class RandomSource
java.lang.Object
simtools.data.ValueProvider
simtools.data.DataSource
jsynoptic.builtin.RandomSource
- Direct Known Subclasses:
- GaussianRandomSource, UniformRandomSource
public abstract class RandomSource
- extends DataSource
Base class for the uniform and gaussian random sources
Constructor Summary |
RandomSource(java.lang.String name,
double param1,
double param2)
|
RandomSource(java.lang.String name,
double param1,
double param2,
long nSamples)
|
RandomSource(java.lang.String name,
long seed,
double param1,
double param2)
|
RandomSource(java.lang.String name,
long seed,
double param1,
double param2,
long nSamples)
|
Methods inherited from class simtools.data.DataSource |
addEndNotificationListener, addListener, computeSortedOrder, createEmptyDataSource, equals, getAuxiliarySources, getByteMax, getByteMin, getChoiceFormat, getDataSourceInformationClass, getFloatMax, getFloatMin, getIntegerMax, getIntegerMin, getLongMax, getLongMin, getShortMax, getShortMin, getSortedOrder, getSourceDependencies, isAuxiliary, isComparable, isCompound, notifyEndNotificationListeners, notifyListenersForDataReplaced, notifyListenersForDataReplaced, notifyListenersForIndexRangeChange, notifyListenersForInfoChange, notifyListenersForOrderChange, notifyListenersForValueChange, notifyListenersForValueRangeChange, removeEndNotificationListener, removeListener, setSlice, sortedOrder, updateSortedOrder |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
resources
public static java.util.ResourceBundle resources
maxIndex
protected long maxIndex
seed
protected java.lang.Long seed
generator
protected java.util.Random generator
param1
protected double param1
param2
protected double param2
minValue
protected double minValue
maxValue
protected double maxValue
values
protected double[] values
info
protected DataInfo info
RandomSource
public RandomSource(java.lang.String name,
double param1,
double param2)
RandomSource
public RandomSource(java.lang.String name,
double param1,
double param2,
long nSamples)
RandomSource
public RandomSource(java.lang.String name,
long seed,
double param1,
double param2)
RandomSource
public RandomSource(java.lang.String name,
long seed,
double param1,
double param2,
long nSamples)
getInformation
public DataInfo getInformation()
- Overrides:
getInformation
in class DataSource
fillValues
protected void fillValues()
nextRandomValue
protected abstract double nextRandomValue()
- For subclasses to implement according to their distribution
getValue
public java.lang.Object getValue(long index)
throws DataException
- Specified by:
getValue
in class ValueProvider
- Throws:
DataException
getDoubleValue
public double getDoubleValue(long index)
throws DataException
- Description copied from class:
ValueProvider
- Optimized accessor for double values. If the provider can provide doubles directly,
then it should override this method. Otherwise, the default implementation will
do its best to convert the Object returned by getValue() to a double.
This conversion also parses strings, and returns 0 if it failed. An exception is thrown
if, and only if, getValue throws it.
- Overrides:
getDoubleValue
in class ValueProvider
- Throws:
DataException
computeLastIndex
public long computeLastIndex()
throws UnsupportedOperation
- Overrides:
computeLastIndex
in class DataSource
- Throws:
UnsupportedOperation
computeStartIndex
public long computeStartIndex()
throws UnsupportedOperation
- Overrides:
computeStartIndex
in class DataSource
- Throws:
UnsupportedOperation
getLastIndex
public long getLastIndex()
throws UnsupportedOperation
- Overrides:
getLastIndex
in class DataSource
- Throws:
UnsupportedOperation
getStartIndex
public long getStartIndex()
throws UnsupportedOperation
- Overrides:
getStartIndex
in class DataSource
- Throws:
UnsupportedOperation
computeMax
public java.lang.Object computeMax()
- Overrides:
computeMax
in class DataSource
computeMin
public java.lang.Object computeMin()
- Description copied from class:
DataSource
- Force the computation if possible. The operation may take some time.
- Overrides:
computeMin
in class DataSource
getDoubleMax
public double getDoubleMax()
- Overrides:
getDoubleMax
in class DataSource
getDoubleMin
public double getDoubleMin()
- Overrides:
getDoubleMin
in class DataSource
getMax
public java.lang.Object getMax()
- Overrides:
getMax
in class DataSource
getMin
public java.lang.Object getMin()
- Description copied from class:
DataSource
- Return values if possibly only, without expensive computations.
- Overrides:
getMin
in class DataSource
getMaxIndex
public long getMaxIndex()
- Returns:
- Returns the maxIndex.