java.lang.Object
com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetrics

public class NozzleMetrics extends Object
Accumulates pour data for a Nozzle.
Version:
2024-01-29
  • Constructor Details

    • NozzleMetrics

      public NozzleMetrics()
  • Method Details

    • getName

      public String getName()
      Return the name of the metrics
    • addAction

      public void addAction(NozzleMetricsAction action)
      Add an action to the metrics.
      Parameters:
      action - the action to add
    • removeAction

      public void removeAction(NozzleMetricsAction action)
      Remove an action from the metrics.
      Parameters:
      action - the action to remove
    • isInternal

      public boolean isInternal()
      Return true if this bean is an internally managed metrics.
      Returns:
      true if can't be deleted
    • setLocked

      public void setLocked(boolean locked)
      Change the lock state of the metric. Doesn't record data while locked.
      Parameters:
      locked - the new lock value
    • isLocked

      public boolean isLocked()
      Return true if the metrics is locked and no longer recording data.
      Returns:
      true if locked
    • record

      public void record(Pump<?> pump, String ingredientId, double volume)
      Record data about volume of ingredients pumped.
      Parameters:
      pump - the pump that poured
      ingredientId - the ingredient
      volume - the number of ml poured
    • getCreationDate

      public Date getCreationDate()
      Get the creation date of the metrics.
      Returns:
      the date the metrics was created
    • getCreationTimeMS

      public long getCreationTimeMS()
      Get the creation time of the metrics.
      Returns:
      the time the metrics was created in msec
    • getLastChangedTimeMS

      public long getLastChangedTimeMS()
      Return the last time the data changed.
      Returns:
      the last change time
    • getLastChangedTimeMono

      public long getLastChangedTimeMono()
      Return the last time the data changed in mono time.
      Returns:
      the last change time in mono time
    • getIngredientVolume

      public double getIngredientVolume(String ingredientId)
      Get the volume for the specified ingredientId.
      Parameters:
      ingredientId - the ingredient to return volume data for
    • getPumpVolume

      public double getPumpVolume(Pump<?> pump)
      Get the volume for the specified pump.
      Parameters:
      pump - the pump to return volume data for
    • getTotalVolume

      public double getTotalVolume()
      Return the total volume poured.
      Returns:
      the total volume so far
    • getIngredientIds

      public Collection<String> getIngredientIds()
      Return the list of ingredientId's that have been tracked.
      Returns:
      list of ingredientId's in this metrics
    • getPumpPaths

      public Collection<String> getPumpPaths()
      Return the list of pump paths that have been tracked.
      Returns:
      list of pump paths in this metrics
    • getByIngredients

      public Map<String,com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetrics.Info> getByIngredients()
      Return volume data by ingredientId.
    • getByPumps

      public Map<String,com.tccc.kos.ext.dispense.service.nozzle.metrics.NozzleMetrics.Info> getByPumps()
      Return volume data by pump path.
    • reset

      public void reset()
      Reset the contents of the metrics back to zero.
    • resetPump

      public void resetPump(Pump<?> pump)
      Reset metrics for the specified pump. This doesn't adjust the total so the sum of the pump volumes will no longer match the total.
      Parameters:
      pump - the pump metrics to reset
    • isRemoved

      public boolean isRemoved()
      Return true when the metrics have been removed from the service.
      Returns:
      true when removed from the service