Percentage

floodsim.model.state.Percentage
object Percentage

Type-safe representation of a percentage value. Ensures that percentage values are always in the valid range of 0.0 to 100.0.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Percentage.type

Members list

Type members

Types

opaque type Percentage

Opaque type to represent a percentage value.

Opaque type to represent a percentage value.

Attributes

Value members

Concrete methods

def apply(value: Double): Percentage

Creates a new percentage value.

Creates a new percentage value.

Value parameters

value

the percentage value (must be between 0.0 and 100.0)

Attributes

Returns

a new Percentage instance

Throws
IllegalArgumentException

if the value is outside the valid range

Extensions

Extensions

extension (p: Percentage)
def asRatio: Double

Converts the percentage to a ratio (0.0 to 1.0).

Converts the percentage to a ratio (0.0 to 1.0).

Attributes

def value: Double

Returns the percentage value.

Returns the percentage value.

Attributes