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

public class NozzleMetrics extends Object
Accumulates pour data for a Nozzle.
Since:
1
Version:
1
  • Constructor Details

    • NozzleMetrics

      public NozzleMetrics()
  • Method Details

    • getName

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

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

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

      public boolean isInternal()
      Return true if this bean is an internally managed metrics.
      Returns:
      true if can't be deleted
      Since:
      1
    • 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
      Since:
      1
    • isLocked

      public boolean isLocked()
      Return true if the metrics is locked and no longer recording data.
      Returns:
      true if locked
      Since:
      1
    • 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
      Since:
      1
    • getCreationDate

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

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

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

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

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

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

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

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

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

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

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

      public void reset()
      Reset the contents of the metrics back to zero.
      Since:
      1
    • 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
      Since:
      1
    • isRemoved

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