Class NozzleMetricsService

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

public final class NozzleMetricsService extends Object
Manages all the pour metrics.
Since:
1
Version:
1
  • Field Details

  • Method Details

    • getTotalMetrics

      public NozzleMetrics getTotalMetrics()
      Return the metrics that track total volume poured.
      Returns:
      total pour metrics
      Since:
      1
    • getLastBeveragePourMetrics

      public NozzleMetrics getLastBeveragePourMetrics(Nozzle nozzle)
      Return the metrics that track the most recent beverage pour.
      Parameters:
      nozzle - the nozzle to return metrics for
      Returns:
      last pour metrics
      Since:
      1
    • addGlobalMetrics

      public NozzleMetrics addGlobalMetrics(String name)
      Register global metrics with the service. These will be updated with pour data regardless of how the ingredient is poured (both beverage and ingredient pours). Adding a name that already exists will simply call reset() on the existing metrics.

      Global metrics will track all pour data across all nozzles.

      Internal metrics cannot be replaced and will throw InvalidMetricsException .

      Parameters:
      name - name of the metrics to add / replace
      Returns:
      the new metrics object
      Since:
      1
    • addMetrics

      public NozzleMetrics addMetrics(Nozzle nozzle, String name)
      Register metrics with the service relative to the specified nozzle. These will be updated with pour data regardless of how the ingredient is poured (both beverage and ingredient pours). Adding a name that already exists will simply call reset() on the existing metrics.

      This will track metrics specific to the specified nozzle.

      Internal metrics cannot be replaced and will throw InvalidMetricsException .

      Parameters:
      nozzle - the nozzle the metrics are relative to
      name - name of the metrics to add / replace
      Returns:
      the new metrics object
      Since:
      1
    • removeGlobalMetrics

      public NozzleMetrics removeGlobalMetrics(String name)
      Remove global metrics with the specified name.

      Internal metrics cannot be removed and will throw InvalidMetricsException

      Parameters:
      name - name of the metrics to remove
      Returns:
      the metrics that were removed
      Since:
      1
    • removeMetrics

      public NozzleMetrics removeMetrics(Nozzle nozzle, String name)
      Remove metrics with the specified name from the nozzle.

      Internal metrics cannot be removed and will throw InvalidMetricsException

      Parameters:
      nozzle - the nozzle to remove metrics from
      name - name of the metrics to remove
      Returns:
      the metrics that were removed
      Since:
      1
    • getGlobalMetricsNames

      public Set<String> getGlobalMetricsNames()
      Return the list of global metrics names.
      Returns:
      the list of global metrics names
      Since:
      1
    • getAllGlobalMetrics

      public Collection<NozzleMetrics> getAllGlobalMetrics()
      Return all the active metrics
      Since:
      1
    • getGlobalMetrics

      public NozzleMetrics getGlobalMetrics(String name)
      Return the global metrics with the specified name.
      Parameters:
      name - name of the metrics
      Returns:
      the named metrics
      Since:
      1
    • getMetricsNames

      public Set<String> getMetricsNames(Nozzle nozzle)
      Return the list of metrics names for the specified nozzle.
      Parameters:
      nozzle - the nozzle to return names for
      Returns:
      the list of metrics names
      Since:
      1
    • getAllMetrics

      public Collection<NozzleMetrics> getAllMetrics(Nozzle nozzle)
      Return all the active metrics for the specified nozzle.
      Parameters:
      nozzle - the nozzle to return metrics for
      Returns:
      the list of metrics
      Since:
      1
    • getMetrics

      public NozzleMetrics getMetrics(Nozzle nozzle, String name)
      Return the metrics with the specified name for the specified nozzle.
      Parameters:
      nozzle - the nozzle to query
      name - name of the metrics
      Returns:
      the named metrics
      Since:
      1