_methods
trait _methods
Short Extension Methods
Extension methods universaly avaialble for type scala.Short
- Source
- _methods.scala
Def
@targetName("range")
Range
Range
Returns Short.Range from current to given value
(1.Short <> 10.Short).tp // Prints 1 <> 10
- Source
- _methods.scala
@targetName("rangeOfSize")
Range by size
Range by size
Returns Short.Range starting at current value and with given size
(5.Short <>= 10).tp // Prints 5 <> 14
- Source
- _methods.scala
@targetName("rangeX")
Exclusive end range
Exclusive end range
Returns Short.Range from current to given value exclusive
(1.Short <>> 10.Short).tp // Prints 1 <> 9
- Source
- _methods.scala
@targetName("Opt")
To option
To option
Returns Short.Opt for current value
val o : Short.Opt = 12.Short.?
- Source
- _methods.scala
Max value
Max value
Returns maximum of current or given value
val b = 5.Short
b.max(0).tp // Prints 5
b.max(10).tp // Prints 10
- Source
- _methods.scala
Min value
Min value
Returns minimun of current or given value
val b = 5.Short
b.min(0).tp // Prints 0
b.min(10).tp // Prints 5
- Source
- _methods.scala
Round to size
Round to size
Rounds current value to specified size
91.Short.roundTo(5).tp // Prints 90
91.Short.roundTo(5)(using UP).tp // Prints 95
- Source
- _methods.scala