ValueMax

data class ValueMax<T : Number> constructor(val value: T, val max: T)

Initializes the ValueMax class

Author

Arnau Mora

Since

20210313

Parameters

value

The current value

max

The maximum value

Throws

When value is greater than max

Constructors

Link copied to clipboard
fun <T : Number> ValueMax(value: T, max: T)

Functions

Link copied to clipboard
fun <R> let(block: (value: T, max: T) -> R): R

Properties

Link copied to clipboard
val max: T
Link copied to clipboard

Returns the percentage of value in max.

Link copied to clipboard
@FloatRange(from = 0.0, to = 1.0, fromInclusive = true, toInclusive = true)
val toFloat: Float

Converts the proportion between value and max to a float. This is, a value between 0 and

Link copied to clipboard
val value: T

Extensions

Link copied to clipboard

Converts the ValueMax to a Int-based one, using the ValueMax.percentage function.