summaryrefslogtreecommitdiff
path: root/src/dotnet-library
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-09-25 17:00:23 +0000
committermichelou <michelou@epfl.ch>2007-09-25 17:00:23 +0000
commitaee3d8d52d13849aa7670dc98d6295382c03044c (patch)
tree97f063d659780808845a2482e934bc882e13a224 /src/dotnet-library
parentb7a2b46a736984266e02d2e37161dde39925a034 (diff)
downloadscala-aee3d8d52d13849aa7670dc98d6295382c03044c.tar.gz
scala-aee3d8d52d13849aa7670dc98d6295382c03044c.tar.bz2
scala-aee3d8d52d13849aa7670dc98d6295382c03044c.zip
Updated lib/mscorlib to Mono 1.2.5, added bin/h...
Updated lib/mscorlib to Mono 1.2.5, added bin/hex/oct conversions in class RichInt
Diffstat (limited to 'src/dotnet-library')
-rw-r--r--src/dotnet-library/scala/runtime/RichInt.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/dotnet-library/scala/runtime/RichInt.scala b/src/dotnet-library/scala/runtime/RichInt.scala
new file mode 100644
index 0000000000..204e50fd2c
--- /dev/null
+++ b/src/dotnet-library/scala/runtime/RichInt.scala
@@ -0,0 +1,39 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: RichInt.scala 12529 2007-08-14 14:02:27Z michelou $
+
+
+package scala.runtime
+
+
+final class RichInt(start: Int) extends Proxy with Ordered[Int] {
+
+ // Proxy
+ def self: Any = start
+
+ // Ordered[Int]
+ def compare(that: Int): Int = if (start < that) -1 else if (start > that) 1 else 0
+
+ /** See <code>Iterator.range</code>. */
+ def until(end: Int): Range = Iterator.range(start, end)
+
+ /** See <code>Iterator.range</code>. */
+ def until(end: Int, step: Int): Range = Iterator.range(start, end, step)
+
+ /** like <code>until</code>, but includes the last index */
+ def to(end: Int) = until(end + 1)
+
+ def min(that: Int): Int = if (start < that) start else that
+ def max(that: Int): Int = if (start > that) start else that
+ def abs: Int = if (start < 0) -start else start
+
+ def toBinaryString: String = System.Convert.ToString(start, 2)
+ def toHexString: String = System.Convert.ToString(start, 16)
+ def toOctalString: String = System.Convert.ToString(start, 8)
+}