Class BeveragePourSequence

java.lang.Object
com.kosdev.kos.ext.dispense.pipeline.beverage.BeveragePourSequence
All Implemented Interfaces:
com.kosdev.kos.commons.util.AttributeAware

public class BeveragePourSequence extends Object implements com.kosdev.kos.commons.util.AttributeAware
A list of Pourable objects that will be poured in order as an atomic operation. Each Pourable will be passed to the pour engine to convert the Pourable to a FutureWork that will execute the pourable. It is possible to define new Pourable classes that perform non-pouring processes that should be part of the overall pour process, such as pausing or dispensing ice.

A PourSequence also support pour limits. A limit will pour the expected volume for each pourable in the sequence until the volume limit is hit, effectively ending the pour early. This differs from changing the overall volume of the sequence where the volumes per pourable will be reduced to run the entire sequence. These options are particularly useful in controlled pour applications.

As a sequence spans multiple pourables, the sequence can represent the overall pour transaction. To facilitate the ability to store data across pours in a sequence, BeveragePourSequence supports user data. This is a map that allows users to attach additional data to the sequence using a string key.

Sequences are created using BeveragePourBuilder.

Since:
1
Version:
1
  • Method Details

    • getDuration

      public int getDuration()
      Return the duration of the sequence in milliseconds. If called before the sequence ends, this will return the duration so far.
      Since:
      1
    • getFuture

      public com.kosdev.kos.commons.util.concurrent.future.FutureWork getFuture()
      Return the future for the overall sequence.
      Since:
      1
    • getTotalVolume

      public double getTotalVolume()
      Return the total volume of the pour. This may not be the amount poured if there is a limit volume.
      Since:
      1
    • getLimitVolume

      public double getLimitVolume()
      Return the volume limit of the pour. If >= zero, this is how much of the total volume will actually be poured. A negative value represents no limit applied.
      Since:
      1
    • setLimitVolume

      public void setLimitVolume(double limitVolume)
      Set the limit volume of the pour in milliliters. If this is greater than or equal to zero, only this portion of the pour will be poured (negative values will be clipped to zero). All pourables will still pour the expected volume based on the total volume, but total output will be limited to the limit volume. If limit volume is less than total volume, the pour will end early and some pourables may not be poured as a result.

      If the limit it set higher than the total volume, it will be adjusted to match the total volume.

      Use disableLimitVolume() to disable any previously applied limit.

      Parameters:
      limitVolume - pour limit, negative is zero volume
      Since:
      1
    • disableLimitVolume

      public void disableLimitVolume()
      Disable the volume limit if set.
      Since:
      1
    • getEffectiveVolume

      public double getEffectiveVolume()
      Return the total volume of the pour. This is the sum of all the pourable volumes constrained by any applied limit.
      Since:
      1
    • setAttribute

      public void setAttribute(Object key, Object data)
      Specified by:
      setAttribute in interface com.kosdev.kos.commons.util.AttributeAware
    • getAttribute

      public Object getAttribute(Object key)
      Specified by:
      getAttribute in interface com.kosdev.kos.commons.util.AttributeAware
    • removeAttribute

      public Object removeAttribute(Object key)
      Specified by:
      removeAttribute in interface com.kosdev.kos.commons.util.AttributeAware
    • getId

      public String getId()
    • getStartTime

      public long getStartTime()
    • getEndTime

      public long getEndTime()