diff options
author | michelou <michelou@epfl.ch> | 2008-01-18 21:20:33 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-01-18 21:20:33 +0000 |
commit | f614f2eb68959f78cef6db3d2a1cd54c23567b9f (patch) | |
tree | dfa521cb75d78d9a49c7cb190be4d13eacbb6978 /src/dotnet-library | |
parent | 7e1a139a3545280101fb122e16028c60a9cfee01 (diff) | |
download | scala-f614f2eb68959f78cef6db3d2a1cd54c23567b9f.tar.gz scala-f614f2eb68959f78cef6db3d2a1cd54c23567b9f.tar.bz2 scala-f614f2eb68959f78cef6db3d2a1cd54c23567b9f.zip |
added toBinary-/toHex-/toOctalString (Long)
Diffstat (limited to 'src/dotnet-library')
-rw-r--r-- | src/dotnet-library/scala/runtime/RichLong.scala | 30 |
1 files changed, 30 insertions, 0 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) +} |