Class DistanceRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.distance.DistanceRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Distance from 2 indicators
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDistanceRTIndicator(@NonNull RTIndicator indicator, @NonNull RTIndicator baseIndicator) -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReady()Ready when both of the indicators it measures are: a distance needs the two of them.voidreset()Returns both indicators it updates to their pre-first-update state, as a holder does.doubleupdate(double newValue) Computes the fractional distance between two indicators: (indicator - base) / base.Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Field Details
-
ID
Canonical catalog id, set as an explicit IndicatorMeta.ID override where getId() class-name derivation would be wrong.- See Also:
-
-
Constructor Details
-
DistanceRTIndicator
public DistanceRTIndicator(@NonNull @NonNull RTIndicator indicator, @NonNull @NonNull RTIndicator baseIndicator)
-
-
Method Details
-
isReady
public boolean isReady()Ready when both of the indicators it measures are: a distance needs the two of them.- Returns:
trueif the indicator has completed its warmup period
-
reset
public void reset()Returns both indicators it updates to their pre-first-update state, as a holder does.- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
update
public double update(double newValue) Computes the fractional distance between two indicators: (indicator - base) / base. Both indicators receive the same input value. Returns 0 when the base is zero to avoid division by zero.- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator- Parameters:
newValue- the input value forwarded to both indicators- Returns:
- the fractional distance between the two indicator values
-