jsynoptic.builtin
Class RangeSource

java.lang.Object
  extended by simtools.data.ValueProvider
      extended by simtools.data.DataSource
          extended by jsynoptic.builtin.RangeSource

public class RangeSource
extends DataSource

This data source produces all the values in a given range, and can work either on "integers" or "real" numbers The range may be infinite


Nested Class Summary
static class RangeSource.OptionPanel
           
 
Field Summary
protected  double dmaxValue
           
protected  double dminValue
           
protected  double dstep
           
static java.lang.String ID_PREFIX
           
protected  DataInfo info
           
protected  long lmaxValue
           
protected  long lminValue
           
protected  long lstep
           
static BasicMessageWriter messages
           
static java.util.ResourceBundle resources
           
 
Fields inherited from class simtools.data.DataSource
endNotificationListeners, listeners, sortedOrder
 
Fields inherited from class simtools.data.ValueProvider
ByteProvider, DoubleProvider, FloatProvider, IntegerProvider, LongProvider, ObjectProvider, ShortProvider
 
Constructor Summary
RangeSource(java.lang.String name, double minValue, double maxValue, double step)
           
RangeSource(java.lang.String name, long minValue, long maxValue, long step)
           
 
Method Summary
 long computeLastIndex()
           
 java.lang.Object computeMax()
           
 java.lang.Object computeMin()
          Force the computation if possible.
 long computeStartIndex()
           
 double getDoubleMax()
           
 double getDoubleMin()
           
 double getDoubleValue(long index)
          Optimized accessor for double values.
 DataInfo getInformation()
           
 int getKind()
          The kind of this provider may be used fo optimization purpose.
 long getLastIndex()
           
 long getLongMax()
           
 long getLongMin()
           
 long getLongValue(long index)
          Optimized accessor for long values.
 java.lang.Object getMax()
           
 java.lang.Object getMin()
          Return values if possibly only, without expensive computations.
 long getStartIndex()
           
 java.lang.Number getStep()
           
 java.lang.Object getValue(long index)
           
 boolean isComparable()
          Check if the values are comparable with each other.
 int sortedOrder()
          Check if the values are sorted or not.
 java.lang.Class valueClass()
          Returns the more specialized superclass of all objects returned by this provider.
 
Methods inherited from class simtools.data.DataSource
addEndNotificationListener, addListener, computeSortedOrder, createEmptyDataSource, equals, getAuxiliarySources, getByteMax, getByteMin, getChoiceFormat, getDataSourceInformationClass, getFloatMax, getFloatMin, getIntegerMax, getIntegerMin, getShortMax, getShortMin, getSortedOrder, getSourceDependencies, isAuxiliary, isCompound, notifyEndNotificationListeners, notifyListenersForDataReplaced, notifyListenersForDataReplaced, notifyListenersForIndexRangeChange, notifyListenersForInfoChange, notifyListenersForOrderChange, notifyListenersForValueChange, notifyListenersForValueRangeChange, removeEndNotificationListener, removeListener, setSlice, updateSortedOrder
 
Methods inherited from class simtools.data.ValueProvider
getByteValue, getFloatValue, getIntegerValue, getObjectValue, getShortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PREFIX

public static final java.lang.String ID_PREFIX
See Also:
Constant Field Values

resources

public static java.util.ResourceBundle resources

messages

public static BasicMessageWriter messages

dminValue

protected double dminValue

dmaxValue

protected double dmaxValue

dstep

protected double dstep

lminValue

protected long lminValue

lmaxValue

protected long lmaxValue

lstep

protected long lstep

info

protected DataInfo info
Constructor Detail

RangeSource

public RangeSource(java.lang.String name,
                   double minValue,
                   double maxValue,
                   double step)

RangeSource

public RangeSource(java.lang.String name,
                   long minValue,
                   long maxValue,
                   long step)
Method Detail

getKind

public int getKind()
Description copied from class: ValueProvider
The kind of this provider may be used fo optimization purpose. This is just an indication for getXXXValue typed functions.

Overrides:
getKind in class ValueProvider
Returns:
the kind of this provider

getInformation

public DataInfo getInformation()
Overrides:
getInformation in class DataSource

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

getLongValue

public long getLongValue(long index)
                  throws DataException
Description copied from class: ValueProvider
Optimized accessor for long values. If the provider can provide longs directly, then it should override this method. Otherwise, the default implementation will do its best to convert the Object returned by getValue() to a long. This conversion also parses strings, and returns 0 if it failed. An exception is thrown if, and only if, getValue throws it.

Overrides:
getLongValue 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

getLongMax

public long getLongMax()
Overrides:
getLongMax in class DataSource

getLongMin

public long getLongMin()
Overrides:
getLongMin 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

getStep

public java.lang.Number getStep()

isComparable

public boolean isComparable()
Description copied from class: DataSource
Check if the values are comparable with each other. If they are, the sortedOrder() function tells if they are also sorted.

Overrides:
isComparable in class DataSource

sortedOrder

public int sortedOrder()
Description copied from class: DataSource
Check if the values are sorted or not. This is usefull to optimize some computations (curves drawing for instance)

Overrides:
sortedOrder in class DataSource
Returns:
0 if the values are not sorted, 1 if the values are sorted in ascending order and -1 if the values are sorted in descending order

valueClass

public java.lang.Class valueClass()
Description copied from class: ValueProvider
Returns the more specialized superclass of all objects returned by this provider. Returns Object by default in the base implementation, subclass should specialize if possible.

Overrides:
valueClass in class ValueProvider