Class BeveragePourBuilder
PourSequence
as a list of Pourable
objects, each with
an associated ratio. The sequence can be assigned a total volume which
is then spread across the pourables based on their ratios.
Examples based on a sequence configured with a total volume of 100ml:
- The sequence contains a single pourable with a non-zero ratio. The pourable will pour the entire 100ml as it is the only pourable.
- The sequence contains two pourbles, both with a ratio of 1. Each pourable will pour 50ml as a ratio of 1 represents 50% of the ratio total for the sequence
- The sequence contains two pourables with ratios of 7 and 3 respectively. The first pourable will pour 70ml as 7 represents 70 percent of the ratio total of 10. The second pourable will pour 30ml.
The use of ratios allows for volume independent sequences, effectively allowing the sequence to be scaled by setting the total volume after the sequence is constructed. It is also possible to use actual volumes as the ratios and call... todo...
- Since:
- 1.0
- Version:
- 2023-09-09
-
Method Summary
Modifier and TypeMethodDescriptionaddFixedPour
(Pourable pourable, String fixedName) Add the specifiedPourable
using the named pour volume.addFixedPour
(Pourable pourable, String fixedName, double splitPercent, int delay) Add the specifiedPourable
using the named pour volume and optionally split into two separate pours at the specified percent using the specified delay.Add the specifiedPourable
using the effective volume specified in the pourable.addSelectedFixedPour
(String fixedName) Add the currently selectedPourable
using the named pour volume.addSelectedFixedPour
(String fixedName, double splitPercent, int delay) Add the currently selectedPourable
using the named pour volume and optionally split into two separate pours at the specified percent using the specified delay.Add the currently selectedPourable
using the max pour volume from thePourServiceDelegate
as the limit.addSelectedVolumePour
(double volume) Add the currently selectedPourable
using the specified volume.addVolumePour
(Pourable pourable, double volume) Add the specifiedPourable
using the specified volume.com.tccc.kos.commons.util.concurrent.future.FutureWork
pour()
Pour the sequence defined by the current state of the builder.
-
Method Details
-
addSelectedMaxVolumePour
Add the currently selectedPourable
using the max pour volume from thePourServiceDelegate
as the limit. This is typically used for pouring triggered by a hold-to-pour button where releasing the button will cancel the pour.- Throws:
BeveragePourBuilderException
- ifPourEngineDelegate
isn't set
-
addSelectedVolumePour
Add the currently selectedPourable
using the specified volume.- Parameters:
volume
- the volume to pour in milliliters- Throws:
BeveragePourBuilderException
- if noPourable
is currently selected
-
addVolumePour
Add the specifiedPourable
using the specified volume. This will clone the pourable and set the totalVolume to the specified volume and set start / stop percent as specified.- Parameters:
pourable
- the pourable to pourvolume
- the volume to pour in milliliters
-
addPour
Add the specifiedPourable
using the effective volume specified in the pourable. This will clone the pourable.- Parameters:
pourable
- the pourable to pour
-
addSelectedFixedPour
Add the currently selectedPourable
using the named pour volume.PourServiceDelegate
is used to convertFixedName
to a volume.If the pourable implements
FixedPourAware
then the pour will be split based on the information from the pourable. If not, the pour will not be split.- Parameters:
fixedName
- the name to resolve to a volume usingPourServiceDelegate
-
addSelectedFixedPour
Add the currently selectedPourable
using the named pour volume and optionally split into two separate pours at the specified percent using the specified delay.PourServiceDelegate
is used to convertFixedName
to a volume.If splitPercent is <=0 or >=100 then there will be a single pour for the entire volume and the delay will be ignored. For any other value of splitPercent, the pour will be split and the specified delay inserted.
- Parameters:
fixedName
- the name to resolve to a volume usingPourServiceDelegate
splitPercent
- where to split the pour into two pours with the delaydelay
- the delay between two parts of a split pour in milliseconds
-
addFixedPour
Add the specifiedPourable
using the named pour volume.PourServiceDelegate
is used to convertFixedName
to a volume.If the pourable implements
FixedPourAware
then the pour will be split based on the information from the pourable. If not, the pour will not be split.- Parameters:
pourable
- the pourable to addfixedName
- the name to resolve to a volume usingPourServiceDelegate
-
addFixedPour
public BeveragePourBuilder addFixedPour(Pourable pourable, String fixedName, double splitPercent, int delay) Add the specifiedPourable
using the named pour volume and optionally split into two separate pours at the specified percent using the specified delay.PourServiceDelegate
is used to convertFixedName
to a volume.If
splitPercent
is <=0 or >=100 then there will be a single pour for the entire volume and the delay will be ignored. For any other value ofsplitPercent
splitPercent, the pour will be split into two parts with the delay between them.- Parameters:
pourable
- the pourable to addfixedName
- the name to resolve to a volume usingPourServiceDelegate
splitPercent
- where to split the pour into two pours with the delaydelay
- the delay between two parts of a split pour in milliseconds
-
pour
public com.tccc.kos.commons.util.concurrent.future.FutureWork pour()Pour the sequence defined by the current state of the builder.
-