Class BeveragePourSequence
- All Implemented Interfaces:
com.tccc.kos.commons.util.UserDataAware
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.
- Since:
- 1.0
- Version:
- 2023-08-10
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Disable the volume limit if set.int
Return the duration of the sequence in milliseconds.double
Return the total volume of the pour.long
com.tccc.kos.commons.util.concurrent.future.FutureWork
Return the future for the overall sequence.getId()
double
Return the volume limit of the pour.long
double
Return the total volume of the pour.getUserData
(String key) removeUserData
(String key) void
setLimitVolume
(double limitVolume) Set the limit volume of the pour in milliliters.void
setUserData
(String key, Object data)
-
Constructor Details
-
BeveragePourSequence
public BeveragePourSequence()
-
-
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. -
getFuture
public com.tccc.kos.commons.util.concurrent.future.FutureWork getFuture()Return the future for the overall sequence. -
getTotalVolume
public double getTotalVolume()Return the total volume of the pour. This may not be the amount poured if there is a limit volume. -
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. -
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
-
disableLimitVolume
public void disableLimitVolume()Disable the volume limit if set. -
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. -
setUserData
- Specified by:
setUserData
in interfacecom.tccc.kos.commons.util.UserDataAware
-
getUserData
- Specified by:
getUserData
in interfacecom.tccc.kos.commons.util.UserDataAware
-
removeUserData
- Specified by:
removeUserData
in interfacecom.tccc.kos.commons.util.UserDataAware
-
getId
-
getStartTime
public long getStartTime() -
getEndTime
public long getEndTime()
-