Bands

world.money.Bands
See theBands companion class
object Bands

Band construction, validated assembly, and both directions for Bands.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Bands.type

Members list

Type members

Classlikes

final case class Band

One band: its upper bound - open for the last band - and its marginal rate.

One band: its upper bound - open for the last band - and its marginal rate.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed abstract class Invalid(message: String) extends WorldError

Why a scale was refused, each case carrying the offending number.

Why a scale was refused, each case carrying the offending number.

Attributes

Companion
object
Supertypes
class WorldError
class TypedError
trait NoStackTrace
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Open
object Open
class Order
class Rate
object Invalid

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Invalid.type

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def banded[C <: Currency & Singleton](b: Bands, amount: Money[C], mode: Rounding)(using ValueOf[C]): Vector[Money[C]]

The per-band marginal charges over the amount.

The per-band marginal charges over the amount.

Attributes

def gross[C <: Currency & Singleton](b: Bands, net: Money[C], mode: Rounding)(using ValueOf[C]): Money[C]

The exact inverse - the gross whose after-charges remainder is net.

The exact inverse - the gross whose after-charges remainder is net.

Attributes

def gross[C <: Currency & Singleton](b: Bands, net: Money[C], scale: Int, mode: Rounding): Money[C]
def of(first: Band, rest: Band*): Either[Invalid, Bands]

Assembles a scale: limits strictly ascending from zero, only the last band open, and every rate below one hundred percent, which is what makes gross total.

Assembles a scale: limits strictly ascending from zero, only the last band open, and every rate below one hundred percent, which is what makes gross total.

Attributes

def open(rate: Percent): Band
def total[C <: Currency & Singleton](b: Bands, amount: Money[C], mode: Rounding)(using ValueOf[C]): Money[C]

The marginal total.

The marginal total.

Attributes

def upTo(limit: BigDecimal, rate: Percent): Band

Givens

Givens

given derived$CanEqual: CanEqual[Bands, Bands]

Extensions

Extensions

extension (b: Bands)
def banded[C <: Currency & Singleton](amount: Money[C], mode: Rounding)(using ValueOf[C]): Vector[Money[C]]

The marginal charge per band, each rounded at the currency's scale by mode, as a payslip prints its deduction lines. Bands the amount never reaches charge zero, and a negative amount mirrors as the contra entry.

The marginal charge per band, each rounded at the currency's scale by mode, as a payslip prints its deduction lines. Bands the amount never reaches charge zero, and a negative amount mirrors as the contra entry.

Attributes

def gross[C <: Currency & Singleton](net: Money[C], mode: Rounding)(using c: ValueOf[C]): Money[C]

The gross whose after-charges remainder is net, computed over rationals and rounded once at the currency's scale by mode. Total: the scale is piecewise linear and strictly increasing, so the inverse is closed form. Applying banded to the result reconstructs net exactly where the band limits sit at the rounding scale. Negative nets mirror.

The gross whose after-charges remainder is net, computed over rationals and rounded once at the currency's scale by mode. Total: the scale is piecewise linear and strictly increasing, so the inverse is closed form. Applying banded to the result reconstructs net exactly where the band limits sit at the rounding scale. Negative nets mirror.

Attributes

def gross[C <: Currency & Singleton](net: Money[C], scale: Int, mode: Rounding): Money[C]

The same inverse at an explicit scale - the controlled form for currencies that record no minor unit, completing the family's explicit-scale pair.

The same inverse at an explicit scale - the controlled form for currencies that record no minor unit, completing the family's explicit-scale pair.

Attributes

def total[C <: Currency & Singleton](amount: Money[C], mode: Rounding)(using ValueOf[C]): Money[C]

The marginal total: the sum of the banded charges.

The marginal total: the sum of the banded charges.

Attributes