blob: 60aef1dfd01b7f69612fd2bdf344fd0a3b384f5a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
package com.mosol.sl;
case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Function1[K, boolean] {
def apply(k: K): boolean = this match {
case Span(Some(low), Some(high)) => (k >= low && k <= high)
case Span(Some(low), None) => (k >= low)
case Span(None, Some(high)) => (k <= high)
case _ => false
}
}
|