Charges

world.money.Charges
See theCharges companion class
object Charges

Row construction, validated assembly, and the charge lookup for Charges.

Attributes

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

Members list

Type members

Classlikes

sealed abstract class Invalid(message: String) extends WorldError

Why a table was refused, the order case carrying the offending bound.

Why a table was refused, the order case carrying the offending bound.

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
object Invalid

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Invalid.type
sealed abstract class Outside(message: String) extends WorldError

The amount lies outside the table: below its floor, or past its cap.

The amount lies outside the table: below its floor, or past its cap.

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 Above
object Above
class Below
object Below
object Outside

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Outside.type
final case class Row[C <: Currency & Singleton]

One row: its inclusive upper bound, open for the last row, and its flat charge.

One row: its inclusive upper bound, open for the last row, and its flat charge.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

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 charge[C <: Currency & Singleton](c: Charges[C], m: Money[C]): Either[Outside, Money[C]]

The charge for an amount: the containing row's, upper bounds inclusive.

The charge for an amount: the containing row's, upper bounds inclusive.

Attributes

def of[C <: Currency & Singleton](floor: BigDecimal, first: Row[C], rest: Row[C]*): Either[Invalid, Charges[C]]

Assembles a table from its inclusive floor upward: bounds strictly ascend above the floor, and only the last row may be open.

Assembles a table from its inclusive floor upward: bounds strictly ascend above the floor, and only the last row may be open.

Attributes

def open[C <: Currency & Singleton](charge: Money[C]): Row[C]

The open final row: everything above the previous bound.

The open final row: everything above the previous bound.

Attributes

def upTo[C <: Currency & Singleton](bound: BigDecimal, charge: Money[C]): Row[C]

A bounded row.

A bounded row.

Attributes

Givens

Givens

given given_CanEqual_Charges_Charges: [C <: Currency & Singleton] => CanEqual[Charges[C], Charges[C]]
given given_CanEqual_Row_Row: [C <: Currency & Singleton] => CanEqual[Row[C], Row[C]]

Extensions

Extensions

extension [C <: Currency & Singleton](c: Charges[C])
def cap: Option[BigDecimal]

The last bounded row's bound; None for an open table.

The last bounded row's bound; None for an open table.

Attributes

def charge(m: Money[C]): Either[Outside, Money[C]]

The containing row's charge, upper bounds inclusive. Below the floor and past a capped table's last bound are both typed refusals.

The containing row's charge, upper bounds inclusive. Below the floor and past a capped table's last bound are both typed refusals.

Attributes