simtools.data
Class LinearSource

java.lang.Object
  extended by simtools.data.ValueProvider
      extended by simtools.data.DataSource
          extended by simtools.data.LinearSource
All Implemented Interfaces:
java.io.Serializable

public class LinearSource
extends DataSource
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  double _coef
           
protected  long _end
           
protected  double _org
           
protected  long _start
           
 
Fields inherited from class simtools.data.DataSource
endNotificationListeners, listeners, sortedOrder
 
Fields inherited from class simtools.data.ValueProvider
ByteProvider, DoubleProvider, FloatProvider, IntegerProvider, kind, LongProvider, ObjectProvider, ShortProvider
 
Constructor Summary
LinearSource(double min, double max, double step)
          This constructor doesn't use the notion of index at all it may be used to produce a uniform distribution of points between min (included) and max, evenly spaced with step.
LinearSource(double org, double coef, long start, long end)
           
 
Method Summary
 long computeLastIndex()
           
 java.lang.Object computeMax()
           
 java.lang.Object computeMin()
          Force the computation if possible.
 long computeStartIndex()
           
 double getDoubleValue(long index)
          Optimize for double access getValue calls this function and wraps a Double around
 DataInfo getInformation()
           
 long getLastIndex()
           
 java.lang.Object getMax()
           
 java.lang.Object getMin()
          Return values if possibly only, without expensive computations.
 long getStartIndex()
           
 java.lang.Object getValue(long index)
           
 void setSlice(long min, long max)
          Sets a region of interest in the DataSource.
 int sortedOrder()
          Check if the values are sorted or not.
 void update()
           
 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, getDoubleMax, getDoubleMin, getFloatMax, getFloatMin, getIntegerMax, getIntegerMin, getLongMax, getLongMin, getShortMax, getShortMin, getSortedOrder, getSourceDependencies, isAuxiliary, isComparable, isCompound, notifyEndNotificationListeners, notifyListenersForDataReplaced, notifyListenersForDataReplaced, notifyListenersForIndexRangeChange, notifyListenersForInfoChange, notifyListenersForOrderChange, notifyListenersForValueChange, notifyListenersForValueRangeChange, removeEndNotificationListener, removeListener, updateSortedOrder
 
Methods inherited from class simtools.data.ValueProvider
getByteValue, getFloatValue, getIntegerValue, getKind, getLongValue, getObjectValue, getShortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_org

protected double _org

_coef

protected double _coef

_start

protected long _start

_end

protected long _end
Constructor Detail

LinearSource

public LinearSource(double org,
                    double coef,
                    long start,
                    long end)

LinearSource

public LinearSource(double min,
                    double max,
                    double step)
This constructor doesn't use the notion of index at all it may be used to produce a uniform distribution of points between min (included) and max, evenly spaced with step. The last point is <=max. This is especially useful for making plots. The first point, at min, has index 0.

Method Detail

getInformation

public DataInfo getInformation()
Overrides:
getInformation in class DataSource

getMin

public java.lang.Object getMin()
                        throws UnsupportedOperation
Description copied from class: DataSource
Return values if possibly only, without expensive computations.

Overrides:
getMin in class DataSource
Throws:
UnsupportedOperation

getMax

public java.lang.Object getMax()
                        throws UnsupportedOperation
Overrides:
getMax in class DataSource
Throws:
UnsupportedOperation

getStartIndex

public long getStartIndex()
                   throws UnsupportedOperation
Overrides:
getStartIndex in class DataSource
Throws:
UnsupportedOperation

getLastIndex

public long getLastIndex()
                  throws UnsupportedOperation
Overrides:
getLastIndex in class DataSource
Throws:
UnsupportedOperation

computeMin

public java.lang.Object computeMin()
                            throws UnsupportedOperation
Force the computation if possible. The operation may take some time.

Overrides:
computeMin in class DataSource
Throws:
UnsupportedOperation

computeMax

public java.lang.Object computeMax()
                            throws UnsupportedOperation
Overrides:
computeMax in class DataSource
Throws:
UnsupportedOperation

computeStartIndex

public long computeStartIndex()
                       throws UnsupportedOperation
Overrides:
computeStartIndex in class DataSource
Throws:
UnsupportedOperation

computeLastIndex

public long computeLastIndex()
                      throws UnsupportedOperation
Overrides:
computeLastIndex in class DataSource
Throws:
UnsupportedOperation

setSlice

public void setSlice(long min,
                     long max)
Description copied from class: DataSource
Sets a region of interest in the DataSource. This is a purely informative function, but the DataSource may use this information to optimize itself on this specific range.

Overrides:
setSlice in class DataSource

getDoubleValue

public double getDoubleValue(long index)
Optimize for double access getValue calls this function and wraps a Double around

Overrides:
getDoubleValue in class ValueProvider

getValue

public java.lang.Object getValue(long index)
                          throws DataException
Specified by:
getValue in class ValueProvider
Throws:
DataException

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

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

update

public void update()
            throws UnsupportedOperation
Throws:
UnsupportedOperation