@KwrkImmutable(knownImmutableClasses: [Quantity]) @CompileStatic class Cargo extends Object implements PostMapConstructorCheckable
Models a containerized cargo consisting of related commodity and container attributes, together with cargo attributes derived from contained commodity and container characteristics.
Majority of cargo attributes are calculated from ContainerDimensionType and Commodity, as demonstrated inBookingOfferAggregate
.
Type | Name and description |
---|---|
Commodity |
commodity Commodity of this cargo. |
Integer |
containerCount Derived property representing the number of containers required to carry the weight of a related commodity. |
BigDecimal |
containerTeuCount Derived property representing the number of containers expressed as Twenty-foot Equivalent Units (TEU). |
ContainerType |
containerType Container type associated with this cargo. |
Quantity<Mass> |
maxAllowedWeightPerContainer The maximally allowed commodity weight per container for this cargo (usually dictated by some policy). |
Quantity<Mass> |
maxRecommendedWeightPerContainer Derived property representing the maximum recommended commodity weight per container. |
Constructor and description |
---|
Cargo() |
Type Params | Return Type | Name and description |
---|---|---|
|
static Cargo |
make(ContainerType containerType, Commodity commodity, Quantity<Mass> maxAllowedWeightPerContainer) Creates a Cargo instance based on required properties and calculates derived properties.
|
|
void |
postMapConstructorCheck(Map<String, ?> constructorArguments) |
Commodity of this cargo.
Must not benull
.containerType.featuresType == commodity.commodityType.containerFeaturesType
.Derived property representing the number of containers required to carry the weight of a related commodity.
During calculation, maxAllowedWeightPerContainer is taken into account. Note that, in shipping, containerCount is just informal information. On the other side, TEU count is much more valuable as standard measurement for container quantity. Must not benull
.1
.Derived property representing the number of containers expressed as Twenty-foot Equivalent Units (TEU).
Must not benull
.scale
between 0 and 2 inclusive.containerCount * containerType.dimensionType.teu
rounded up to two decimals.Container type associated with this cargo.
Must not benull
.containerType.featuresType == commodity.commodityType.containerFeaturesType
.The maximally allowed commodity weight per container for this cargo (usually dictated by some policy).
Note that this weight is always lesser than or equal to the maximally allowed commodity weight of correspondingcontainerType
. It can be lesser if some policy dictates that we should not
reach the absolute maximum of the commodity weight for particular containerType
.
Must not be null
.containerType.maxCommodityWeight
.maxRecommendedWeightPerContainer
.Derived property representing the maximum recommended commodity weight per container.
This value is calculated when we spread the weight of a commodity across all containers. In other words, this value is the rounded up quotient of commodity weight and the number of containers. Must not benull
.maxAllowedWeightPerContainer
.maxRecommendedWeightPerContainer.value * containerCount >= commodity.weight.value
. Creates a Cargo
instance based on required properties and calculates derived properties.
maxAllowedWeightPerContainer
parameter is null, maxAllowedWeightPerContainer
is equal to the containerType.maxCommodityWeight
.
Groovy Documentation