diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotnet-library/scala/runtime/RichLong.scala | 30 | ||||
-rw-r--r-- | src/library/scala/runtime/RichInt.scala | 2 | ||||
-rw-r--r-- | src/library/scala/runtime/RichLong.scala | 7 |
3 files changed, 36 insertions, 3 deletions
diff --git a/src/dotnet-library/scala/runtime/RichLong.scala b/src/dotnet-library/scala/runtime/RichLong.scala new file mode 100644 index 0000000000..1d8c064d81 --- /dev/null +++ b/src/dotnet-library/scala/runtime/RichLong.scala @@ -0,0 +1,30 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: $ + + +package scala.runtime + + +final class RichLong(x: Long) extends Proxy with Ordered[Long] { + + // Proxy.self + def self: Any = x + + // Ordered[Long].compare + def compare(y: Long): Int = if (x < y) -1 else if (x > y) 1 else 0 + + def min(y: Long): Long = if (x < y) x else y + def max(y: Long): Long = if (x > y) x else y + def abs: Long = if (x < 0) -x else x + + def toBinaryString: String = System.Convert.ToString(x, 2) + def toHexString: String = System.Convert.ToString(x, 16) + def toOctalString: String = System.Convert.ToString(x, 8) +} diff --git a/src/library/scala/runtime/RichInt.scala b/src/library/scala/runtime/RichInt.scala index 1af3d4653e..07827d4287 100644 --- a/src/library/scala/runtime/RichInt.scala +++ b/src/library/scala/runtime/RichInt.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/src/library/scala/runtime/RichLong.scala b/src/library/scala/runtime/RichLong.scala index 1f6d527170..7e835f10c3 100644 --- a/src/library/scala/runtime/RichLong.scala +++ b/src/library/scala/runtime/RichLong.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -24,4 +24,7 @@ final class RichLong(x: Long) extends Proxy with Ordered[Long] { def max(y: Long): Long = if (x > y) x else y def abs: Long = if (x < 0) -x else x + def toBinaryString: String = java.lang.Long.toBinaryString(x) + def toHexString: String = java.lang.Long.toHexString(x) + def toOctalString: String = java.lang.Long.toOctalString(x) } |