Class/Object

framian.column

Mask

Related Docs: object Mask | package column

Permalink

final class Mask extends (Int) ⇒ Boolean

A Mask provides a dense bitset implementation. This replaces uses of BitSet. The major difference is that we don't box the Ints.

An explanation of some of the arithmetic you'll see here:

We store the bits in array of words. Each word contains 64 bits and the words are in order. So, the word containing bit n is n >>> 6 - we simply drop the lower 6 bits (divide by 64). If n is set, then the bit n & 0x3FL (the last 6 bits - ie n % 64 if n was an unsigned int), in word bits(n >>> 6) will be true. We can check this by masking the word with 1L << (n & 0x3FL) and checking if the result is non-zero.

Note that we use shift-without-carry (> > >) and intersection (&) to divide and mod by 64 instead of using / and % because they do not behave correctly with negative numbers; they carry the sign through in the result, and we want the absolute value.

An invariant of the underlying bits array is that the highest order word (ie. bits(bits.length - 1)) is always non-zero (except if bits has 0 length). This sometimes means we must *trim* the array for some operations that could possibly zero out the highest order word (eg. intersection and subtraction.

Source
Mask.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Mask
  2. Function1
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Mask(bits: Array[Long], size: Int)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def &(that: Mask): Mask

    Permalink
  4. def +(n: Int): Mask

    Permalink
  5. final def ++(that: Mask): Mask

    Permalink
  6. def -(n: Int): Mask

    Permalink
  7. def --(that: Mask): Mask

    Permalink
  8. def ->[B](y: B): (Mask, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to ArrowAssoc[Mask] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  9. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def andThen[A](g: (Boolean) ⇒ A): (Int) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  11. def apply(n: Int): Boolean

    Permalink
    Definition Classes
    Mask → Function1
  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def compose[A](g: (A) ⇒ Int): (A) ⇒ Boolean

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  15. def ensuring(cond: (Mask) ⇒ Boolean, msg: ⇒ Any): Mask

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to Ensuring[Mask] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: (Mask) ⇒ Boolean): Mask

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to Ensuring[Mask] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean, msg: ⇒ Any): Mask

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to Ensuring[Mask] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean): Mask

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to Ensuring[Mask] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(that: Any): Boolean

    Permalink
    Definition Classes
    Mask → AnyRef → Any
  21. def filter(f: (Int) ⇒ Boolean): Mask

    Permalink
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def foreach[U](f: (Int) ⇒ U): Unit

    Permalink
  24. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to StringFormat[Mask] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Permalink
    Definition Classes
    Mask → AnyRef → Any
  27. def isEmpty: Boolean

    Permalink
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. def map(f: (Int) ⇒ Int): Mask

    Permalink
  30. def max: Option[Int]

    Permalink
  31. def min: Option[Int]

    Permalink
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. val size: Int

    Permalink
  36. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  37. def toBitSet: BitSet

    Permalink
  38. def toSet: Set[Int]

    Permalink
  39. def toString(): String

    Permalink
    Definition Classes
    Mask → Function1 → AnyRef → Any
  40. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. def |(that: Mask): Mask

    Permalink
  44. def [B](y: B): (Mask, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to ArrowAssoc[Mask] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Mask to any2stringadd[Mask] performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (mask: any2stringadd[Mask]).+(other)
    Definition Classes
    any2stringadd

Inherited from (Int) ⇒ Boolean

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Mask to any2stringadd[Mask]

Inherited by implicit conversion StringFormat from Mask to StringFormat[Mask]

Inherited by implicit conversion Ensuring from Mask to Ensuring[Mask]

Inherited by implicit conversion ArrowAssoc from Mask to ArrowAssoc[Mask]

Ungrouped