Class NozzleMetricsTotalVolumeAction

java.lang.Object
com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetricsTotalVolumeAction
All Implemented Interfaces:
NozzleMetricsAction

public class NozzleMetricsTotalVolumeAction extends Object implements 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
  • 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: NozzleMetricsAction
      Reset the trigger. Called when the metrics is reset.
      Specified by:
      reset in interface NozzleMetricsAction
    • metricsChanged

      public void metricsChanged(NozzleMetrics metrics)
      Description copied from interface: NozzleMetricsAction
      Process 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:
      metricsChanged in interface NozzleMetricsAction
      Parameters:
      metrics - the metrics that changed