spire.algebra

PartialOrder

trait PartialOrder[A] extends Eq[A]

The PartialOrder type class is used to define a partial ordering on some type A.

A partial order is defined by a relation <=, which obeys the following laws:

- x <= x (reflexivity) - if x <= y and y <= x, then x == y (antisymmetry) - if x <= y and y <= z, then x <= z (transitivity)

To compute both <= and >= at the same time, we use a Double number to encode the result of the comparisons x <= y and x >= y. The truth table is defined as follows:

x <= y x >= y Double true true = 0 (corresponds to x == y) false false = NaN (x and y cannot be compared) true false < 0 (corresponds to x < y) false true > 0 (corresponds to x > y)

Self Type
PartialOrder[A]
Linear Supertypes
Eq[A], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. PartialOrder
  2. Eq
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def partialCompare(x: A, y: A): Double

    Result of comparing x with y.

    Result of comparing x with y. Returns NaN if operands are not comparable. If operands are comparable, returns a Double whose sign is: - negative iff x < y - zero iff x === y - positive iff x > y

Concrete Value Members

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

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

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def eqv(x: A, y: A): Boolean

    Returns true if x and y are equivalent, false otherwise.

    Returns true if x and y are equivalent, false otherwise.

    Definition Classes
    PartialOrderEq
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  11. def gt(x: A, y: A): Boolean

  12. def gteqv(x: A, y: A): Boolean

  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. def lt(x: A, y: A): Boolean

  16. def lteqv(x: A, y: A): Boolean

  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def neqv(x: A, y: A): Boolean

    Returns false if x and y are equivalent, true otherwise.

    Returns false if x and y are equivalent, true otherwise.

    Definition Classes
    Eq
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. def on[B](f: (B) ⇒ A): PartialOrder[B]

    Defines a partial order on B by mapping B to A using f and using As order to order B.

    Defines a partial order on B by mapping B to A using f and using As order to order B.

    Definition Classes
    PartialOrderEq
  22. def pmax(x: A, y: A): Option[A]

    Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

  23. def pmin(x: A, y: A): Option[A]

    Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

  24. def reverse: PartialOrder[A]

    Defines a partial order on A where all arrows switch direction.

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

    Definition Classes
    AnyRef
  26. def toString(): String

    Definition Classes
    AnyRef → Any
  27. def tryCompare(x: A, y: A): Option[Int]

    Result of comparing x with y.

    Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is: - negative iff x < y - zero iff x == y - positive iff x > y

  28. def tryGt(x: A, y: A): Option[Boolean]

  29. def tryGteqv(x: A, y: A): Option[Boolean]

  30. def tryLt(x: A, y: A): Option[Boolean]

  31. def tryLteqv(x: A, y: A): Option[Boolean]

  32. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Eq[A]

Inherited from AnyRef

Inherited from Any

Ungrouped