Class NozzleMetricsTotalVolumeAction
java.lang.Object
com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetricsTotalVolumeAction
- All Implemented Interfaces:
NozzleMetricsAction
Action that triggers a single callback when the metrics total reaches
the specified volume. Calling
reset() or setVolume()
will cause the triggered flag to be cleared and allow the callback
to be triggered again. As these calls don't change the total volume
in the associated metrics object, the next pour update will trigger
the callback. Resetting the metric will clear all the pour data as
well as trigger all actions to be reset.- Version:
- 2024-01-29
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCalled when the volume threshold is reached. -
Constructor Summary
ConstructorsConstructorDescriptionNozzleMetricsTotalVolumeAction(double volume, NozzleMetricsTotalVolumeAction.ActionCallback callback) Create a new action that will trigger a callback at the specified volume. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGet the trigger volume.voidmetricsChanged(NozzleMetrics metrics) Process a metrics change.voidreset()Reset the trigger.voidsetVolume(double volume) Set the trigger volume.
-
Constructor Details
-
NozzleMetricsTotalVolumeAction
public NozzleMetricsTotalVolumeAction(double volume, NozzleMetricsTotalVolumeAction.ActionCallback callback) Create a new action that will trigger a callback at the specified volume.- Parameters:
volume- the total volume to trigger at
-
-
Method Details
-
getVolume
public double getVolume()Get the trigger volume.- Returns:
- the trigger volume
-
setVolume
public void setVolume(double volume) Set the trigger volume. This will reset the trigger if it has already triggered.- Parameters:
volume- the new trigger volume
-
reset
public void reset()Description copied from interface:NozzleMetricsActionReset the trigger. Called when the metrics is reset.- Specified by:
resetin interfaceNozzleMetricsAction
-
metricsChanged
Description copied from interface:NozzleMetricsActionProcess a metrics change. This is called from the thread that is processing pour events in order to provide metrics as fast as possible, but this means that actions should run as fast as possible. Consider performing any long running operations in a separate thread.- Specified by:
metricsChangedin interfaceNozzleMetricsAction- Parameters:
metrics- the metrics that changed
-