Packages

final class Trilean extends AnyVal

Implementation of three-valued logic.

This type resembles Boolean, but has three values instead of two:

  • Trilean.True (equivalent to true)
  • Trilean.False (equivalent to false)
  • Trilean.Unknown

Trilean supports the same operations that Boolean does, and as long as all values are True or False, the results will be the same. However, the truth tables have to be extended to work with unknown:

not:

-+-
T|F
U|U
F|T

and:

  |T U F
-+-----
T|T U F
U|U U F
F|F F F

or:

  |T U F
-+-----
T|T T T
U|T U U
F|T U F

Trilean is implemented as a value type, so in most cases it will only have the overhead of a single Int. However, in some situations it will be boxed.

Self Type
Trilean
Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Trilean
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Trilean(value: Int)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. def &(rhs: Trilean): Trilean
  4. def &&(rhs: => Trilean): Trilean
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  6. def ^(rhs: Trilean): Trilean
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def assume(b: Boolean): Boolean
  9. def assumeFalse: Boolean
  10. def assumeTrue: Boolean
  11. def fold[A](f: (Boolean) => A)(unknown: => A): A
  12. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  13. def imp(rhs: Trilean): Trilean
  14. def isFalse: Boolean
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def isKnown: Boolean
  17. def isNotFalse: Boolean
  18. def isNotTrue: Boolean
  19. def isTrue: Boolean
  20. def isUnknown: Boolean
  21. def nand(rhs: Trilean): Trilean
  22. def nor(rhs: Trilean): Trilean
  23. def nxor(rhs: Trilean): Trilean
  24. def toBoolean(b: => Boolean): Boolean
  25. def toOption: Option[Boolean]
  26. def toString(): String
    Definition Classes
    Trilean → Any
  27. def unary_!: Trilean
  28. val value: Int
  29. def |(rhs: Trilean): Trilean
  30. def ||(rhs: => Trilean): Trilean

Inherited from AnyVal

Inherited from Any

Ungrouped