Permalink
Browse files

cleaned up code in library/scala/**/*.scala

  • Loading branch information...
1 parent 33637d5 commit 5a8391bb88f3dd65458a77539a1475eaa84cc434 michelou committed Aug 31, 2006
Showing with 2,112 additions and 1,968 deletions.
  1. +12 −12 src/library/scala/Application.scala
  2. +38 −23 src/library/scala/Array.scala
  3. +7 −7 src/library/scala/BufferedIterator.scala
  4. +12 −7 src/library/scala/CaseClass.scala
  5. +2 −2 src/library/scala/Cell.scala
  6. +278 −275 src/library/scala/Console.scala
  7. +73 −74 src/library/scala/Enumeration.scala
  8. +101 −97 src/library/scala/Iterable.scala
  9. +82 −77 src/library/scala/IterableProxy.scala
  10. +187 −172 src/library/scala/Iterator.scala
  11. +10 −8 src/library/scala/MatchError.scala
  12. +5 −5 src/library/scala/Proxy.scala
  13. +30 −4 src/library/scala/Responder.scala
  14. +68 −66 src/library/scala/Seq.scala
  15. +81 −70 src/library/scala/SeqProxy.scala
  16. +19 −20 src/library/scala/Stream.scala
  17. +28 −28 src/library/scala/collection/BitSet.scala
  18. +38 −36 src/library/scala/collection/Map.scala
  19. +12 −12 src/library/scala/collection/MapProxy.scala
  20. +8 −8 src/library/scala/collection/Set.scala
  21. +9 −9 src/library/scala/collection/SetProxy.scala
  22. +5 −5 src/library/scala/collection/immutable/BitSet.scala
  23. +100 −96 src/library/scala/collection/immutable/ListMap.scala
  24. +68 −68 src/library/scala/collection/immutable/ListSet.scala
  25. +119 −110 src/library/scala/collection/immutable/Map.scala
  26. +22 −22 src/library/scala/collection/immutable/Queue.scala
  27. +61 −56 src/library/scala/collection/immutable/Set.scala
  28. +26 −26 src/library/scala/collection/immutable/Stack.scala
  29. +103 −106 src/library/scala/collection/immutable/Tree.scala
  30. +88 −80 src/library/scala/collection/immutable/TreeMap.scala
  31. +44 −41 src/library/scala/collection/immutable/TreeSet.scala
  32. +115 −109 src/library/scala/util/automata/BaseBerrySethi.scala
  33. +44 −28 src/library/scala/util/automata/DetWordAutom.scala
  34. +36 −30 src/library/scala/util/automata/Inclusion.scala
  35. +49 −49 src/library/scala/util/automata/NondetWordAutom.scala
  36. +132 −130 src/library/scala/util/automata/WordBerrySethi.scala
@@ -9,7 +9,7 @@
// $Id$
-package scala;
+package scala
/** The <code>Application</code> class can be used to quickly turn objects
@@ -38,16 +38,16 @@ package scala;
trait Application {
- /** The time when execution of this program started.
- */
- val executionStart: Long = java.lang.System.currentTimeMillis();
-
- /** The default main method.
- */
- def main(args: Array[String]) = {
- if (java.lang.System.getProperty("scala.time") != null)
- java.lang.System.out.println("[total " +
- (java.lang.System.currentTimeMillis()
- - executionStart) + "ms]");
+ /** The time when execution of this program started.
+ */
+ val executionStart: Long = java.lang.System.currentTimeMillis()
+
+ /** The default main method.
+ */
+ def main(args: Array[String]) = {
+ if (java.lang.System.getProperty("scala.time") != null) {
+ val total = java.lang.System.currentTimeMillis() - executionStart
+ java.lang.System.out.println("[total " + total + "ms]")
}
+ }
}
@@ -8,31 +8,41 @@
// $Id$
+package scala
-package scala;
-
-
-import runtime._
-
+/** This object ...
+ *
+ * @author Martin Odersky
+ * @version 1.0
+ */
object Array {
- /** Copy one array to another
- * Equaivalent to System.arraycopy(src, srcPos, dest, destPos, length),
- * except that this works also for plymorphic and boxed arrays
+ /** Copy one array to another.
+ * Equivalent to
+ * <code>System.arraycopy(src, srcPos, dest, destPos, length)</code>,
+ * except that this works also for polymorphic and boxed arrays.
+ *
+ * @param src ...
+ * @param srcPos ...
+ * @param dest ...
+ * @param destPos ...
+ * @param length ...
*/
def copy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int): Unit = src match {
- case xs: BoxedArray =>
+ case xs: runtime.BoxedArray =>
xs.copyTo(srcPos, dest, destPos, length)
case _ =>
dest match {
- case xs: BoxedArray =>
+ case xs: runtime.BoxedArray =>
xs.copyFrom(src, srcPos, destPos, length)
case _ =>
System.arraycopy(src, srcPos, dest, destPos, length)
}
}
- /** Concatenate all argument arrays into a single array
+ /** Concatenate all argument arrays into a single array.
+ *
+ * @param xs ...
*/
def concat[T](xs: Array[T]*) = {
var len = 0
@@ -55,22 +65,27 @@ object Array {
* @return the sorted array of all integers in range [from;end).
*/
def range(start: Int, end: Int): Array[Int] = {
- val result = new Array[Int](end - start);
- for (val i <- Iterator.range(start, end)) result(i - start) = i
+ val result = new Array[Int](end - start)
+ for (val i <- start until end) result(i - start) = i
result
}
}
+/** This class ...
+ *
+ * @author Martin Odersky
+ * @version 1.0
+ */
[cloneable,serializable]
final class Array[a](_length: Int) extends Seq[a] {
- def length: Int = throw new Error();
- def apply(i: Int): a = throw new Error();
- def update(i: Int, x: a): Unit = throw new Error();
- def elements: Iterator[a] = throw new Error();
- def subArray(from: Int, end: Int): Array[a] = throw new Error();
- def filter(p: a => Boolean): Array[a] = throw new Error();
- def map[b](f: a => b): Array[b] = throw new Error();
- def flatMap[b](f: a => Array[b]): Array[b] = throw new Error();
- def zip[b](that: Array[b]): Array[Tuple2[a,b]] = throw new Error();
- def zipWithIndex: Array[Tuple2[a,Int]] = throw new Error();
+ def length: Int = throw new Error()
+ def apply(i: Int): a = throw new Error()
+ def update(i: Int, x: a): Unit = throw new Error()
+ def elements: Iterator[a] = throw new Error()
+ def subArray(from: Int, end: Int): Array[a] = throw new Error()
+ def filter(p: a => Boolean): Array[a] = throw new Error()
+ def map[b](f: a => b): Array[b] = throw new Error()
+ def flatMap[b](f: a => Array[b]): Array[b] = throw new Error()
+ def zip[b](that: Array[b]): Array[Tuple2[a,b]] = throw new Error()
+ def zipWithIndex: Array[Tuple2[a,Int]] = throw new Error()
}
@@ -9,7 +9,7 @@
// $Id$
-package scala;
+package scala
/** Buffered iterators are iterators which llow to inspect the next
@@ -20,11 +20,11 @@ package scala;
*/
trait BufferedIterator[+A] extends Iterator[A] {
- /** Checks what the next available element is.
- *
- * @return the current element
- */
- def head: A;
+ /** Checks what the next available element is.
+ *
+ * @return the current element
+ */
+ def head: A
- override def buffered: BufferedIterator[A] = this;
+ override def buffered: BufferedIterator[A] = this
}
@@ -9,28 +9,33 @@
// $Id$
-package scala;
+package scala
/** defines an access function for instances of case classes
*
* @author Burak Emir
+ * @version 1.0
*/
trait CaseClass extends AnyRef {
/** for a case class A(x_0,...,x_(k-1)), returns x_i for 0 &lt;= i &lt; k,
- ** null otherwise
- */
- def caseElement(n: Int): Any ;
+ * <code>null</code> otherwise.
+ *
+ * @param n ...
+ */
+ def caseElement(n: Int): Any
/** need also, for reflection
def setCaseElement(n: Int, v: Any): unit
*/
/** for a case class A(x_0,...,x_(k-1)), returns k
- */
- def caseArity: Int ;
+ */
+ def caseArity: Int
- def caseName: String ;
+ /**
+ */
+ def caseName: String
}
@@ -9,7 +9,7 @@
// $Id$
-package scala;
+package scala
/** A <code>Cell</code> is a generic wrapper which completely
@@ -19,4 +19,4 @@ package scala;
* @author Martin Odersky
* @version 1.0, 08/08/2003
*/
-case class Cell[+T](elem: T);
+case class Cell[+T](elem: T)
Oops, something went wrong.

0 comments on commit 5a8391b

Please sign in to comment.