- Companion:
- class
Type members
Value members
Concrete methods
Check that list contains at least a certain number of elements.
Check that list contains at least a certain number of elements.
Truncate a value so it stays within some range.
Truncate a value so it stays within some range.
scala> clamp(5, 10, 15)
10
scala> clamp(5, 10, 0)
5
Construct a range which is unaffected by the size parameter.
Construct a range which is unaffected by the size parameter.
A range from 0
to 10
, with the origin at 0
:
scala> Range.constant(0, 10).bounds(x)
(0,10)
scala> Range.constant(0, 10).origin
0
Construct a range which is unaffected by the size parameter with a origin point which may differ from the bounds.
Construct a range which is unaffected by the size parameter with a origin point which may differ from the bounds.
A range from -10
to 10
, with the origin at 0
:
scala> Range.constantFrom(0, -10, 10).bounds(x)
(-10,10)
scala> Range.constantFrom(0, -10, 10).origin
0
A range from 1970
to 2100
, with the origin at 2000
:
scala> Range.constantFrom(2000, 1970, 2100).bounds(x)
(1970,2100)
scala> Range.constantFrom(2000, 1970, 2100).origin
2000
Construct a range which scales the second bound relative to the size parameter.
Construct a range which scales the second bound relative to the size parameter.
scala> Range.linear(0, 10).bounds(Size(1))
(0,0)
scala> Range.linear(0, 10).bounds(Size(50))
(0,5)
scala> Range.linear(0, 10).bounds(Size(100))
(0,10)
Construct a range which scales the second bound relative to the size parameter.
Construct a range which scales the second bound relative to the size parameter.
This works the same as 'linear', but for fractional values.
Construct a range which scales the bounds relative to the size parameter.
Construct a range which scales the bounds relative to the size parameter.
This works the same as linearFrom, but for fractional values.
Construct a range which scales the second bound relative to the size parameter.
Construct a range which scales the second bound relative to the size parameter.
scala> Range.linearFrom(0, -10, 10).bounds(Size(1))
(0,0)
scala> Range.linearFrom(0, -10, 20).bounds(Size(50))
(-5,10)
scala> Range.linearFrom(0, -10, 20).bounds(Size(100))
(-10,20)
Scale an integral linearly with the size parameter.
Scale an integral linearly with the size parameter.