PropertyRange

fun <T : Comparable<T>> PropertyRange(initValue: T, range: ClosedRange<T>, violation: (T, T) -> T = ::defaultViolation)

Creates PropertyRange by ClosedRange.

Parameters

initValue

an initial value of the property.

range

a valid range of the value.

violation

a violation handler.

fun <T : Comparable<T>> PropertyRange(initValue: T, min: T? = null, max: T? = null, violation: (T, T) -> T = ::defaultViolation)

Parameters

initValue

an initial value of the property.

min

a minimum bound of the value.

max

a maximum bound of the value.

violation

a violation handler.