ProportionalAllocator

Allocates a Money in ratios. Example:

val money = 100 money "USD"
val ratios = Ratios(75.percent(), 25.percent())
val allocator = ProportionalAllocator.default()

allocator.allocate(money, ratios).result() // [USD 75.00, USD 25.00]

Parameters

differenceAllocator

Strategy to allocate the difference generated when allocating a Money amount.

Constructors

Link copied to clipboard
constructor(differenceAllocator: DifferenceAllocation)

Types

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun allocate(money: Money, by: Ratios): Result

Allocates a Money.

open fun allocate(money: Money, vararg ratios: Percentage): Result
open fun allocate(money: Money, ratios: List<Percentage>): Result

Allocates a Money in ratios.