Package gov.nasa.jpl.resource
Class DoubleResource
- All Implemented Interfaces:
ResourceContainer
- Direct Known Subclasses:
IntegratingResource
-
Field Summary
Fields inherited from class gov.nasa.jpl.resource.Resource
interpolation, maximum, minimum, possibleStates, subsystem, units
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleResource
(double profile) DoubleResource
(double profile, String subsystem) DoubleResource
(double profile, String subsystem, String units) DoubleResource
(double profile, String subsystem, String units, String interpolation) DoubleResource
(double profile, String subsystem, String units, String interpolation, Double minimum, Double maximum) DoubleResource
(String subsystem, String units, String interpolation) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double toAdd) protected Double
Performs the logic for interpolation for the input time and resource.Returns the value of the resource at a time, linearly interpolating if the query time is not one in which the resource was explicitly set.protected Double
Performs linear interpolation using y = mx + bReturns the default value of the resource before it is set() to a new value.void
subtract
(double toSubtract) void
update()
No-op method that adapters can override in custom resourcesMethods inherited from class gov.nasa.jpl.resource.Resource
addChangeListener, clearHistory, currentval, firstTimeSet, formUniqueName, getChangesDuringWindow, getDataType, getIndices, getInterpolation, getMaximumLimit, getMinimumLimit, getName, getPossibleStates, getSize, getSubsystem, getType, getUniqueName, getUnits, historyIterator, insertRecord, isFrozen, isIndexInArrayedResource, lastTimeSet, lastValue, max, min, nextTimeResourceSetToValue, nextTimeSet, priorTimeResourceSetToValue, priorTimeSet, registerResource, removeChangeListener, resourceHistoryHasElements, set, setFrozen, setIndices, setInterpolation, setMaximumLimit, setMinimumLimit, setName, setSubsystem, setUnits, valueAt, whenEqualTo, whenGreaterThan, whenGreaterThanOrEqualTo, whenLessThan, whenLessThanOrEqualTo, whenNotEqualTo
-
Constructor Details
-
DoubleResource
-
DoubleResource
-
DoubleResource
-
DoubleResource
-
DoubleResource
-
DoubleResource
public DoubleResource(double profile) -
DoubleResource
public DoubleResource()
-
-
Method Details
-
profile
Description copied from class:Resource
Returns the default value of the resource before it is set() to a new value. Must be abstract since different data types have different intuitive defaults. -
add
public void add(double toAdd) -
subtract
public void subtract(double toSubtract) -
interpval
Returns the value of the resource at a time, linearly interpolating if the query time is not one in which the resource was explicitly set. This is in contrast to valueAt, which, if faced with querying the value at a time the resource was not set, returns the most recent update to the resource- Parameters:
t
- The time at which you want the interpolated value of the resource- Returns:
- The value of the resource as interpolated between two explicitly calculated values
-
getInterpolatedValue
Performs the logic for interpolation for the input time and resource. This method is abstracted from interpval because IntegratingResource also has the same logic. -
linearlyInterpolate
Performs linear interpolation using y = mx + b -
update
public void update()Description copied from class:Resource
No-op method that adapters can override in custom resources- Specified by:
update
in interfaceResourceContainer
- Overrides:
update
in classResource<Double>
-