Diet

sealed abstract class Diet[A]

Discrete Interval Encoding Tree (Diet). It stores subsets of types having a total order, a predecessor and a successor function described by Discrete[A]

Discrete Interval Encoding Tree (Diet). It stores subsets of types having a total order, a predecessor and a successor function described by Discrete[A]

Diet is a binary search tree where each node contains a range of values and the set of all nodes is a set of disjoint sets.

In the best case, when there are no "holes" in the stored set, the interval representation consists of just one single interval (node) and finding, inserting and deleting operations are O(1). In the worse case, where there are not two adjacent elements in the set, the representation is equivalent to a binary search tree.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def &(other: Range[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

intersection with the given range

intersection with the given range

def &(that: Diet[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

intersection with the given diet

intersection with the given diet

def +(value: A)(discrete: Discrete[A], order: Order[A]): Diet[A]

alias for add

alias for add

def +(range: Range[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

alias for add

alias for add

def ++(that: Diet[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

Returns the union of this Diet with another Diet.

Returns the union of this Diet with another Diet.

def -(value: A)(discrete: Discrete[A], order: Order[A]): Diet[A]

alias for remove

alias for remove

def -(range: Range[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

alias for removeRange

alias for removeRange

def --(that: Diet[A])(discrete: Discrete[A], order: Order[A]): Diet[A]
def add(value: A)(discrete: Discrete[A], order: Order[A]): Diet[A]

Adds new value to the tree.

Adds new value to the tree.

def addRange(range: Range[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

Add new value range [x, y] to the Diet.

Add new value range [x, y] to the Diet.

@tailrec
final def contains(v: A)(order: Order[A]): Boolean

Returns true if x is a value is in the tree.

Returns true if x is a value is in the tree.

@tailrec
final def containsRange(range: Range[A])(order: Order[A]): Boolean

Returns true if all values in the range are contained in the tree

Returns true if all values in the range are contained in the tree

def foldLeft[B](s: B)(f: (B, A) => B)(enumA: Discrete[A], orderA: Order[A]): B
def foldLeftRange[B](z: B)(f: (B, Range[A]) => B): B
def foldRight[B](s: Eval[B])(f: (A, Eval[B]) => Eval[B])(enumA: Discrete[A], orderA: Order[A]): Eval[B]
def foldRightRange[B](z: Eval[B])(f: (Range[A], Eval[B]) => Eval[B]): Eval[B]
def max: Option[A]

max value in the tree

max value in the tree

def min: Option[A]

min value in the tree

min value in the tree

def remove(x: A)(discrete: Discrete[A], order: Order[A]): Diet[A]

remove x from the tree

remove x from the tree

def removeRange(range: Range[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

remove a range from Diet

remove a range from Diet

def toIterator: Iterator[Range[A]]
def toList(discrete: Discrete[A], order: Order[A]): List[A]
def |(that: Diet[A])(discrete: Discrete[A], order: Order[A]): Diet[A]

Returns the union of this Diet with another Diet.

Returns the union of this Diet with another Diet.

Deprecated methods

@deprecated("the semantics of this method are unclear and unspecified, avoid!", "0.8.0")
def map[B](f: A => B)(`evidence$1`: Discrete[B], `evidence$2`: Order[B]): Diet[B]
Deprecated

Abstract fields

val isEmpty: Boolean