Class BeveragePourBuilder
PourSequence as a list of Pourable objects, each with
an associated volume, that can be poured as an atomic operation.
A builder is bound to a pour pipeline and is single use. The builder
can be used to construct a sequence by calling the various pour
api's ending with a call to pour(). This will generate the
final sequence and pass it to the associated pipeline to be converted
to a FutureWork(). The future can then be started to perform
the physical pour. Once pour() has been called, the builder
can no longer be used and all methods will throw an exception.
The builder provides access to pours based on the currently selected
beverage. This leverages the associated BeveragePipelineService
class which has a concept of selected beverage and corresponding
endpoints. This typically allows developers to avoid introducing
custom code or endpoints to manage beverage selection, although doesn't
preclude it.
The builder also leverages named volumes to handle common use cases
such as pre-configured cup sizes. The BeverageNozzlePipeline
supports a BeveragePipelineDelegate which defines the max
volume pour as well as resolves named volumes to actual numeric values.
This allows the pipeline to route volume resolution to any user defined
process.
Virtually all methods in the builder operate on Pourable objects.
A Pourable defines the beverage to pour and can contain a volume.
In some cases the volume from the provided pourable is used, but in many
cases a new volume is computed based on inputs. In every instance, the
provided Pourable is first cloned and then updated to use the
computed volume, leaving the original pourable unchanged.
- Since:
- 1
- Version:
- 9
-
Method Summary
Modifier and TypeMethodDescriptionaddDelay(int delayMs) Add a delay to the sequenceaddFixedPour(Pourable pourable, String fixedName) Deprecated.addFixedPour(Pourable pourable, String namedVolume, double splitPercent, int delay) Deprecated.Split pours should be generated by pourables.addMaxVolumePour(Pourable pourable) Add the specifiedPourableusing the max pour volume from thePourServiceDelegateas the limit.Add the specifiedPourableusing the effective volume specified in the pourable.Add the specifiedPourableusing the specified volume.Add the specifiedPourableusing the named pour volume.addSelectedFixedPour(String fixedName) Deprecated.Renamed toaddSelectedPour(java.lang.String).addSelectedFixedPour(String fixedName, double splitPercent, int delay) Deprecated.Split pours should be generated by pourables.Add the currently selectedPourableusing the max pour volume from thePourServiceDelegateas the limit.addSelectedPour(double volume) Add the currently selectedPourableusing the specified volume.addSelectedPour(String namedVolume) Add the currently selectedPourableusing the named pour volume.addSelectedVolumePour(double volume) Deprecated.Renamed toaddSelectedPour(double).addVolumePour(Pourable pourable, double volume) Deprecated.doubleGet the max volume pour for the pipeline.doublegetNamedVolume(String namedVolume) Given a named volume, return the actual volume usingPourServiceDelegateto do the conversion.Return the underlying sequence.com.kosdev.kos.commons.util.concurrent.future.FutureWorkpour()Pour the sequence defined by the current state of the builder.
-
Method Details
-
getNamedVolume
Given a named volume, return the actual volume usingPourServiceDelegateto do the conversion.- Parameters:
namedVolume- the name of the volume to return- Since:
- 1
-
getMaxPourVolume
public double getMaxPourVolume()Get the max volume pour for the pipeline. This is determined by thePourServiceDelegate.- Since:
- 1
-
addPour
Add the specifiedPourableusing the effective volume specified in the pourable. This will clone the pourable.The specified
Pourablewill be cloned and added to the sequence. The volume of the original pourable can be changed after this call without impacting the sequence.- Parameters:
pourable- the pourable to pour- Since:
- 9
-
addSelectedMaxVolumePour
Add the currently selectedPourableusing the max pour volume from thePourServiceDelegateas 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- ifPourEngineDelegateisn't set- Since:
- 1
-
addSelectedPour
Add the currently selectedPourableusing the specified volume.The selected
Pourablewill be cloned and the volume will be set on the clone. Any volume on the incoming pourable will be ignored.- Parameters:
volume- the volume to pour in ml- Since:
- 9
-
addSelectedPour
Add the currently selectedPourableusing the named pour volume.PourServiceDelegateis used to convertnamedVolumeto a volume.The selected
Pourablewill be cloned and the volume will be set on the clone. Any volume on the incoming pourable will be ignored.- Parameters:
namedVolume- the name to resolve to a volume usingPourServiceDelegate- Since:
- 9
-
addMaxVolumePour
Add the specifiedPourableusing the max pour volume from thePourServiceDelegateas the limit.The specified
Pourablewill be cloned and the volume will be set on the clone. Any volume on the incoming pourable will be ignored.- Throws:
BeveragePourBuilderException- ifPourEngineDelegateisn't set- Since:
- 9
-
addPour
Add the specifiedPourableusing the named pour volume.PourServiceDelegateis used to convertnamedVolumeto a volume.The specified
Pourablewill be cloned and the volume will be set on the clone. Any volume on the incoming pourable will be ignored.- Parameters:
pourable- the pourable to addnamedVolume- the name to resolve to a volume usingPourServiceDelegate- Since:
- 9
-
addPour
Add the specifiedPourableusing the specified volume.The specified
Pourablewill be cloned and the volume will be set on the clone. Any volume on the incoming pourable will be ignored.- Parameters:
pourable- the pourable to addvolume- the volume to pour- Since:
- 9
-
addDelay
Add a delay to the sequence- Since:
- 1
-
getSequence
Return the underlying sequence. A sequence can not be poured more than once so this should not be used in an effort to reuse a sequence. This exists to provide access to sequence api's such as adding user data, applying a volume limit and so on.- Since:
- 1
-
pour
public com.kosdev.kos.commons.util.concurrent.future.FutureWork pour()Pour the sequence defined by the current state of the builder.- Since:
- 1
-
addSelectedVolumePour
Deprecated.Renamed toaddSelectedPour(double).- Since:
- 1
-
addVolumePour
Deprecated.- Since:
- 1
-
addSelectedFixedPour
Deprecated.Renamed toaddSelectedPour(java.lang.String).- Since:
- 1
-
addSelectedFixedPour
@Deprecated public BeveragePourBuilder addSelectedFixedPour(String fixedName, double splitPercent, int delay) Deprecated.Split pours should be generated by pourables.- Since:
- 1
-
addFixedPour
Deprecated.- Since:
- 1
-
addFixedPour
@Deprecated public BeveragePourBuilder addFixedPour(Pourable pourable, String namedVolume, double splitPercent, int delay) Deprecated.Split pours should be generated by pourables.- Since:
- 1
-
addPour(com.kosdev.kos.ext.dispense.pipeline.beverage.Pourable,java.lang.String).