Diet

cats.collections.Diet
See theDiet companion object
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]

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.

Attributes

Companion
object
Source
Diet.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

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

intersection with the given range

intersection with the given range

Attributes

Source
Diet.scala
def &(that: Diet[A])(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

intersection with the given diet

intersection with the given diet

Attributes

Source
Diet.scala
def +(value: A)(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

alias for add

alias for add

Attributes

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

alias for add

alias for add

Attributes

Source
Diet.scala
def ++(that: Diet[A])(implicit 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.

Attributes

Source
Diet.scala
def -(value: A)(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

alias for remove

alias for remove

Attributes

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

alias for removeRange

alias for removeRange

Attributes

Source
Diet.scala
def --(that: Diet[A])(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

Attributes

Source
Diet.scala
def add(value: A)(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

Adds new value to the tree.

Adds new value to the tree.

Attributes

Source
Diet.scala
def addRange(range: Range[A])(implicit 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.

Attributes

Source
Diet.scala
final def contains(v: A)(implicit 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.

Attributes

Source
Diet.scala
final def containsRange(range: Range[A])(implicit 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

Attributes

Source
Diet.scala
def foldLeft[B](s: B)(f: (B, A) => B)(implicit enumA: Discrete[A], orderA: Order[A]): B

Attributes

Source
Diet.scala
def foldLeftRange[B](z: B)(f: (B, Range[A]) => B): B

Attributes

Source
Diet.scala
def foldRight[B](s: Eval[B])(f: (A, Eval[B]) => Eval[B])(implicit enumA: Discrete[A], orderA: Order[A]): Eval[B]

Attributes

Source
Diet.scala
def foldRightRange[B](z: Eval[B])(f: (Range[A], Eval[B]) => Eval[B]): Eval[B]

Attributes

Source
Diet.scala
def max: Option[A]

max value in the tree

max value in the tree

Attributes

Source
Diet.scala
def min: Option[A]

min value in the tree

min value in the tree

Attributes

Source
Diet.scala
def remove(x: A)(implicit discrete: Discrete[A], order: Order[A]): Diet[A]

remove x from the tree

remove x from the tree

Attributes

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

remove a range from Diet

remove a range from Diet

Attributes

Source
Diet.scala
def toIterator: Iterator[Range[A]]

Attributes

Source
Diet.scala
def toList(implicit discrete: Discrete[A], order: Order[A]): List[A]

Attributes

Source
Diet.scala
def |(that: Diet[A])(implicit 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.

Attributes

Source
Diet.scala

Deprecated methods

def map[B : Order](f: A => B): Diet[B]

Attributes

Deprecated
true
Source
Diet.scala

Abstract fields

val isEmpty: Boolean

Attributes

Source
Diet.scala