Packages

t

scala.math

PartialOrdering

trait PartialOrdering[T] extends Equiv[T]

A trait for representing partial orderings. It is important to distinguish between a type that has a partial order and a representation of partial ordering on some type. This trait is for representing the latter.

A partial ordering is a binary relation on a type T, exposed as the lteq method of this trait. This relation must be:

  • reflexive: lteq(x, x) == true, for any x of type T.
  • anti-symmetric: if lteq(x, y) == true and lteq(y, x) == true then equiv(x, y) == true, for any x and y of type T.
  • transitive: if lteq(x, y) == true and lteq(y, z) == true then lteq(x, z) == true, for any x, y, and z of type T.

Additionally, a partial ordering induces an equivalence relation on a type T: x and y of type T are equivalent if and only if lteq(x, y) && lteq(y, x) == true. This equivalence relation is exposed as the equiv method, inherited from the Equiv trait.

Self Type
PartialOrdering[T]
Source
PartialOrdering.scala
Version

1.0, 2008-04-0-3

Since

2.7

Linear Supertypes
Equiv[T], Serializable, java.io.Serializable, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PartialOrdering
  2. Equiv
  3. Serializable
  4. Serializable
  5. AnyRef
  6. 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

Abstract Value Members

  1. abstract def lteq(x: T, y: T): Boolean

    Returns true iff x comes before y in the ordering.

  2. abstract def tryCompare(x: T, y: T): Option[Int]

    Result of comparing x with operand y.

    Result of comparing x with operand y. Returns None if operands are not comparable. If operands are comparable, returns Some(r) where

    • r < 0 iff x < y
    • r == 0 iff x == y
    • r > 0 iff x > y

Concrete Value Members

  1. def equiv(x: T, y: T): Boolean

    Returns true iff x is equivalent to y in the ordering.

    Returns true iff x is equivalent to y in the ordering.

    Definition Classes
    PartialOrderingEquiv
  2. def gt(x: T, y: T): Boolean

    Returns true iff y comes before x in the ordering and is not the same as x.

  3. def gteq(x: T, y: T): Boolean

    Returns true iff y comes before x in the ordering.

  4. def lt(x: T, y: T): Boolean

    Returns true iff x comes before y in the ordering and is not the same as y.

  5. def reverse: PartialOrdering[T]