Packages

trait Integral[T] extends Numeric[T]

Source
Integral.scala
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Integral
  2. Numeric
  3. Ordering
  4. PartialOrdering
  5. Equiv
  6. Serializable
  7. Comparator
  8. AnyRef
  9. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. class IntegralOps extends NumericOps
  2. class NumericOps extends AnyRef
    Definition Classes
    Numeric
  3. class OrderingOps extends AnyRef

    This inner class defines comparison operators available for T.

    This inner class defines comparison operators available for T.

    It can't extend AnyVal because it is not a top-level class or a member of a statically accessible object.

    Definition Classes
    Ordering

Abstract Value Members

  1. abstract def compare(x: T, y: T): Int

    Returns an integer whose sign communicates how x compares to y.

    Returns an integer whose sign communicates how x compares to y.

    The result sign has the following meaning:

    • negative if x < y
    • positive if x > y
    • zero otherwise (if x == y)
    Definition Classes
    Ordering → Comparator
  2. abstract def fromInt(x: Int): T
    Definition Classes
    Numeric
  3. abstract def minus(x: T, y: T): T
    Definition Classes
    Numeric
  4. abstract def negate(x: T): T
    Definition Classes
    Numeric
  5. abstract def parseString(str: String): Option[T]
    Definition Classes
    Numeric
  6. abstract def plus(x: T, y: T): T
    Definition Classes
    Numeric
  7. abstract def quot(x: T, y: T): T
  8. abstract def rem(x: T, y: T): T
  9. abstract def times(x: T, y: T): T
    Definition Classes
    Numeric
  10. abstract def toDouble(x: T): Double
    Definition Classes
    Numeric
  11. abstract def toFloat(x: T): Float
    Definition Classes
    Numeric
  12. abstract def toInt(x: T): Int
    Definition Classes
    Numeric
  13. abstract def toLong(x: T): Long
    Definition Classes
    Numeric

Concrete Value Members

  1. def abs(x: T): T
    Definition Classes
    Numeric
  2. def equiv(x: T, y: T): Boolean

    Return true if x == y in the ordering.

    Return true if x == y in the ordering.

    Definition Classes
    OrderingPartialOrderingEquiv
  3. def gt(x: T, y: T): Boolean

    Return true if x > y in the ordering.

    Return true if x > y in the ordering.

    Definition Classes
    OrderingPartialOrdering
  4. def gteq(x: T, y: T): Boolean

    Return true if x >= y in the ordering.

    Return true if x >= y in the ordering.

    Definition Classes
    OrderingPartialOrdering
  5. def isReverseOf(other: Ordering[_]): Boolean

    Returns whether or not the other ordering is the opposite ordering of this one.

    Returns whether or not the other ordering is the opposite ordering of this one.

    Equivalent to other == this.reverse.

    Implementations should only override this method if they are overriding reverse as well.

    Definition Classes
    Ordering
  6. def lt(x: T, y: T): Boolean

    Return true if x < y in the ordering.

    Return true if x < y in the ordering.

    Definition Classes
    OrderingPartialOrdering
  7. def lteq(x: T, y: T): Boolean

    Return true if x <= y in the ordering.

    Return true if x <= y in the ordering.

    Definition Classes
    OrderingPartialOrdering
  8. def max[U <: T](x: U, y: U): U

    Return x if x >= y, otherwise y.

    Return x if x >= y, otherwise y.

    Definition Classes
    Ordering
  9. def min[U <: T](x: U, y: U): U

    Return x if x <= y, otherwise y.

    Return x if x <= y, otherwise y.

    Definition Classes
    Ordering
  10. implicit def mkNumericOps(lhs: T): IntegralOps
    Definition Classes
    IntegralNumeric
  11. implicit def mkOrderingOps(lhs: T): OrderingOps

    This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

    This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

    Definition Classes
    Ordering
  12. def on[U](f: (U) => T): Ordering[U]

    Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

    Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

    def compare(x:U, y:U) = Ordering[T].compare(f(x), f(y))
    Definition Classes
    Ordering
  13. def one: T
    Definition Classes
    Numeric
  14. def orElse(other: Ordering[T]): Ordering[T]

    Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

    Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

    other

    an Ordering to use if this Ordering returns zero

    Definition Classes
    Ordering
    Example:
    1. case class Pair(a: Int, b: Int)
      
      val pairOrdering = Ordering.by[Pair, Int](_.a)
                                 .orElse(Ordering.by[Pair, Int](_.b))
  15. def orElseBy[S](f: (T) => S)(implicit ord: Ordering[S]): Ordering[T]

    Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

    Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

    Ordering[S].compare(f(x), f(y))

    This function is equivalent to passing the result of Ordering.by(f) to orElse.

    Definition Classes
    Ordering
    Example:
    1. case class Pair(a: Int, b: Int)
      
      val pairOrdering = Ordering.by[Pair, Int](_.a)
                                 .orElseBy[Int](_.b)
  16. def reverse: Ordering[T]

    Return the opposite ordering of this one.

    Return the opposite ordering of this one.

    Implementations overriding this method MUST override isReverseOf as well if they change the behavior at all (for example, caching does not require overriding it).

    Definition Classes
    OrderingPartialOrdering
  17. def reversed(): Comparator[T]
    Definition Classes
    Comparator
  18. def sign(x: T): T
    Definition Classes
    Numeric
  19. def thenComparing[U <: Comparable[_ >: U <: AnyRef]](arg0: java.util.function.Function[_ >: T <: AnyRef, _ <: U]): Comparator[T]
    Definition Classes
    Comparator
  20. def thenComparing[U <: AnyRef](arg0: java.util.function.Function[_ >: T <: AnyRef, _ <: U], arg1: Comparator[_ >: U <: AnyRef]): Comparator[T]
    Definition Classes
    Comparator
  21. def thenComparing(arg0: Comparator[_ >: T <: AnyRef]): Comparator[T]
    Definition Classes
    Comparator
  22. def thenComparingDouble(arg0: ToDoubleFunction[_ >: T <: AnyRef]): Comparator[T]
    Definition Classes
    Comparator
  23. def thenComparingInt(arg0: ToIntFunction[_ >: T <: AnyRef]): Comparator[T]
    Definition Classes
    Comparator
  24. def thenComparingLong(arg0: ToLongFunction[_ >: T <: AnyRef]): Comparator[T]
    Definition Classes
    Comparator
  25. def tryCompare(x: T, y: T): Some[Int]

    Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

    Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

    Definition Classes
    OrderingPartialOrdering
  26. def zero: T
    Definition Classes
    Numeric

Deprecated Value Members

  1. def signum(x: T): Int
    Definition Classes
    Numeric
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) use sign method instead