diff options
author | Shane Delmore <shane@delmore.io> | 2016-02-01 09:50:35 -0800 |
---|---|---|
committer | Shane Delmore <shane@delmore.io> | 2016-02-01 09:51:27 -0800 |
commit | 7137a3bfa6863860b7aee7920f74fb8257e66c01 (patch) | |
tree | 0b2bc257e9442951d85d3ec1649bb33077b224c7 /src | |
parent | 36bf0c9d58bd1a7aa378ae4a5283b0d3271b725b (diff) | |
download | scala-7137a3bfa6863860b7aee7920f74fb8257e66c01.tar.gz scala-7137a3bfa6863860b7aee7920f74fb8257e66c01.tar.bz2 scala-7137a3bfa6863860b7aee7920f74fb8257e66c01.zip |
Extend BigInt with Ordered for java interop
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/math/BigInt.scala | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/library/scala/math/BigInt.scala b/src/library/scala/math/BigInt.scala index abc7371d9f..3ae3b9bf6c 100644 --- a/src/library/scala/math/BigInt.scala +++ b/src/library/scala/math/BigInt.scala @@ -109,7 +109,12 @@ object BigInt { * @author Martin Odersky * @version 1.0, 15/07/2003 */ -final class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNumericConversions with Serializable { +final class BigInt(val bigInteger: BigInteger) + extends ScalaNumber + with ScalaNumericConversions + with Serializable + with Ordered[BigInt] +{ /** Returns the hash code for this BigInt. */ override def hashCode(): Int = if (isValidLong) unifiedPrimitiveHashcode() @@ -176,22 +181,6 @@ final class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNum */ def compare (that: BigInt): Int = this.bigInteger.compareTo(that.bigInteger) - /** Less-than-or-equals comparison of BigInts - */ - def <= (that: BigInt): Boolean = compare(that) <= 0 - - /** Greater-than-or-equals comparison of BigInts - */ - def >= (that: BigInt): Boolean = compare(that) >= 0 - - /** Less-than of BigInts - */ - def < (that: BigInt): Boolean = compare(that) < 0 - - /** Greater-than comparison of BigInts - */ - def > (that: BigInt): Boolean = compare(that) > 0 - /** Addition of BigInts */ def + (that: BigInt): BigInt = new BigInt(this.bigInteger.add(that.bigInteger)) |