summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorMatthias Zenger <mzenger@gmail.com>2004-06-04 08:51:07 +0000
committerMatthias Zenger <mzenger@gmail.com>2004-06-04 08:51:07 +0000
commitce4346489cc16774255bba385a675ded819b6d7d (patch)
tree35478d90fbea98f7ebff0bac7345db847ee025c7 /sources
parent7f8e3d286e031ed309d67adfa60ae5474a4a6a2f (diff)
downloadscala-ce4346489cc16774255bba385a675ded819b6d7d.tar.gz
scala-ce4346489cc16774255bba385a675ded819b6d7d.tar.bz2
scala-ce4346489cc16774255bba385a675ded819b6d7d.zip
Removed tabs.
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/Application.scala4
-rw-r--r--sources/scala/Iterator.scala222
-rw-r--r--sources/scala/Predef.scala98
-rw-r--r--sources/scala/SeqProxy.scala4
-rw-r--r--sources/scala/collection/immutable/TreeMap.scala20
-rw-r--r--sources/scala/collection/immutable/TreeSet.scala10
-rw-r--r--sources/scala/collection/mutable/ArrayBuffer.scala72
-rw-r--r--sources/scala/collection/mutable/Buffer.scala42
-rw-r--r--sources/scala/collection/mutable/HashMap.scala6
-rw-r--r--sources/scala/collection/mutable/HashSet.scala6
-rw-r--r--sources/scala/collection/mutable/HashTable.scala12
-rw-r--r--sources/scala/collection/mutable/JavaMapAdaptor.scala32
-rw-r--r--sources/scala/collection/mutable/JavaSetAdaptor.scala12
-rw-r--r--sources/scala/collection/mutable/Map.scala12
-rw-r--r--sources/scala/collection/mutable/MutableList.scala2
-rw-r--r--sources/scala/collection/mutable/ObservableBuffer.scala22
-rw-r--r--sources/scala/collection/mutable/PriorityQueue.scala126
-rw-r--r--sources/scala/collection/mutable/Queue.scala10
-rw-r--r--sources/scala/collection/mutable/QueueProxy.scala6
-rw-r--r--sources/scala/collection/mutable/ResizableArray.scala70
-rw-r--r--sources/scala/collection/mutable/Set.scala12
-rw-r--r--sources/scala/collection/mutable/Stack.scala18
-rw-r--r--sources/scala/collection/mutable/StackProxy.scala4
-rw-r--r--sources/scala/collection/mutable/SynchronizedBuffer.scala4
-rw-r--r--sources/scala/collection/mutable/SynchronizedMap.scala2
-rw-r--r--sources/scala/collection/mutable/SynchronizedPriorityQueue.scala18
-rw-r--r--sources/scala/collection/mutable/SynchronizedSet.scala8
-rw-r--r--sources/scala/tools/scalap/ByteArrayReader.scala16
-rw-r--r--sources/scala/tools/scalap/Entity.scala22
-rw-r--r--sources/scala/tools/scalap/JavaWriter.scala4
-rw-r--r--sources/scala/tools/scalap/ScalaAttribute.scala6
-rw-r--r--sources/scala/tools/scalap/ScalaWriter.scala58
32 files changed, 480 insertions, 480 deletions
diff --git a/sources/scala/Application.scala b/sources/scala/Application.scala
index bb289ed79d..73b63de635 100644
--- a/sources/scala/Application.scala
+++ b/sources/scala/Application.scala
@@ -45,7 +45,7 @@ class Application {
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]");
+ (java.lang.System.currentTimeMillis()
+ - executionStart) + "ms]");
}
}
diff --git a/sources/scala/Iterator.scala b/sources/scala/Iterator.scala
index 4457d03ee7..1d1a16b2dd 100644
--- a/sources/scala/Iterator.scala
+++ b/sources/scala/Iterator.scala
@@ -152,43 +152,43 @@ trait Iterator[+A] {
/** Does this iterator provide another element?
*/
- def hasNext: Boolean;
+ def hasNext: Boolean;
- /** Returns the next element.
- */
- def next: A;
+ /** Returns the next element.
+ */
+ def next: A;
/** Returns a new iterator that iterates only over the first <code>n</code>
* elements.
*/
- def take(n: Int) = new Iterator[A] {
- var remaining = n;
- def hasNext = remaining > 0 && Iterator.this.hasNext;
- def next: A =
- if (hasNext) { remaining = remaining - 1; Iterator.this.next }
- else error("next on empty iterator");
- }
+ def take(n: Int) = new Iterator[A] {
+ var remaining = n;
+ def hasNext = remaining > 0 && Iterator.this.hasNext;
+ def next: A =
+ if (hasNext) { remaining = remaining - 1; Iterator.this.next }
+ else error("next on empty iterator");
+ }
/** Removes the first <code>n</code> elements from this iterator.
*/
- def drop(n: Int): Iterator[A] =
- if (n > 0) { next; drop(n - 1) } else this;
+ def drop(n: Int): Iterator[A] =
+ if (n > 0) { next; drop(n - 1) } else this;
/** Returns a new iterator that maps all elements of this iterator
* to new elements using function <code>f</code>.
*/
- def map[B](f: A => B): Iterator[B] = new Iterator[B] {
- def hasNext = Iterator.this.hasNext;
- def next = f(Iterator.this.next)
- }
+ def map[B](f: A => B): Iterator[B] = new Iterator[B] {
+ def hasNext = Iterator.this.hasNext;
+ def next = f(Iterator.this.next)
+ }
/** Returns a new iterator that first yields the elements of this
* iterator followed by the elements provided by iterator <code>that</code>.
*/
- def append[B >: A](that: Iterator[B]) = new Iterator[B] {
- def hasNext = Iterator.this.hasNext || that.hasNext;
- def next = if (Iterator.this.hasNext) Iterator.this.next else that.next;
- }
+ def append[B >: A](that: Iterator[B]) = new Iterator[B] {
+ def hasNext = Iterator.this.hasNext || that.hasNext;
+ def next = if (Iterator.this.hasNext) Iterator.this.next else that.next;
+ }
/** Applies the given function <code>f</code> to each element of
* this iterator, then concatenates the results.
@@ -197,37 +197,37 @@ trait Iterator[+A] {
* @return an iterator over <code>f(a0), ... , f(an)</code> if this iterator
* yields the elements <code>a0, ..., an</code>.
*/
- def flatMap[B](f: A => Iterator[B]): Iterator[B] = new Iterator[B] {
- private var cur: Iterator[B] = Iterator.empty;
- def hasNext: Boolean =
- if (cur.hasNext) true
- else if (Iterator.this.hasNext) {
- cur = f(Iterator.this.next);
- hasNext
- } else false;
- def next: B =
- if (cur.hasNext) cur.next
- else if (Iterator.this.hasNext) {
- cur = f(Iterator.this.next);
- next
- } else error("next on empty iterator");
- }
-
- /** Returns an iterator over all the elements of this iterator that
- * satisfy the predicate <code>p</code>. The order of the elements
- * is preserved.
- *
- * @param p the redicate used to filter the iterator.
- * @return the elements of this iterator satisfying <code>p</code>.
- */
- def filter(p: A => Boolean): Iterator[A] = new BufferedIterator[A] {
- private val source = Iterator.this.buffered;
- private def skip: Unit =
- while (source.hasNext && !p(source.head)) { source.next; () }
- def hasNext: Boolean = { skip; source.hasNext }
- def next: A = { skip; source.next }
- def head: A = { skip; source.head; }
- }
+ def flatMap[B](f: A => Iterator[B]): Iterator[B] = new Iterator[B] {
+ private var cur: Iterator[B] = Iterator.empty;
+ def hasNext: Boolean =
+ if (cur.hasNext) true
+ else if (Iterator.this.hasNext) {
+ cur = f(Iterator.this.next);
+ hasNext
+ } else false;
+ def next: B =
+ if (cur.hasNext) cur.next
+ else if (Iterator.this.hasNext) {
+ cur = f(Iterator.this.next);
+ next
+ } else error("next on empty iterator");
+ }
+
+ /** Returns an iterator over all the elements of this iterator that
+ * satisfy the predicate <code>p</code>. The order of the elements
+ * is preserved.
+ *
+ * @param p the redicate used to filter the iterator.
+ * @return the elements of this iterator satisfying <code>p</code>.
+ */
+ def filter(p: A => Boolean): Iterator[A] = new BufferedIterator[A] {
+ private val source = Iterator.this.buffered;
+ private def skip: Unit =
+ while (source.hasNext && !p(source.head)) { source.next; () }
+ def hasNext: Boolean = { skip; source.hasNext }
+ def next: A = { skip; source.next }
+ def head: A = { skip; source.head; }
+ }
/** Return an iterator formed from this iterator and the specified iterator
* <code>that</code> by associating each element of the former with
@@ -239,10 +239,10 @@ trait Iterator[+A] {
* <code>ai</code> are the elements from this iterator and
* <code>bi</code> are the elements from iterator <code>that</code>.
*/
- def zip[B](that: Iterator[B]) = new Iterator[Pair[A, B]] {
- def hasNext = Iterator.this.hasNext && that.hasNext;
- def next = Pair(Iterator.this.next, that.next);
- }
+ def zip[B](that: Iterator[B]) = new Iterator[Pair[A, B]] {
+ def hasNext = Iterator.this.hasNext && that.hasNext;
+ def next = Pair(Iterator.this.next, that.next);
+ }
/** Apply a function <code>f</code> to all elements of this
* iterable object.
@@ -330,55 +330,55 @@ trait Iterator[+A] {
/** Returns a buffered iterator from this iterator.
*/
- def buffered: BufferedIterator[A] = new BufferedIterator[A] {
- private var hd: A = _;
- private var ahead: Boolean = false;
- def head: A = {
- if (!ahead) {
- hd = Iterator.this.next;
- ahead = true
- }
- hd
- }
- def next: A =
- if (ahead) { ahead = false; hd } else head;
- def hasNext: Boolean = ahead || Iterator.this.hasNext;
- override def buffered: BufferedIterator[A] = this;
- }
-
- /** Creates two new iterators that both iterate over the same elements
- * than this iterator (in the same order).
- */
- def duplicate: Pair[Iterator[A], Iterator[A]] = {
- var xs: List[A] = Nil;
- var ahead: Iterator[A] = null;
- class Partner extends Iterator[A] {
- var ys: List[A] = Nil;
- def hasNext: Boolean = Iterator.this.synchronized {
- ((this == ahead) && Iterator.this.hasNext) ||
- ((this != ahead) && (!xs.isEmpty || !ys.isEmpty || Iterator.this.hasNext));
- }
- def next: A = Iterator.this.synchronized {
- if (this == ahead) {
- val e = Iterator.this.next;
- xs = e :: xs; e
- } else {
- if (ys.isEmpty) {
- ys = xs.reverse;
- xs = Nil;
- }
- ys match {
- case Nil => val e = Iterator.this.next;
- ahead = this;
- xs = e :: xs; e
- case z :: zs => ys = zs; z
- }
- }
- }
- }
- ahead = new Partner;
- Pair(ahead, new Partner)
- }
+ def buffered: BufferedIterator[A] = new BufferedIterator[A] {
+ private var hd: A = _;
+ private var ahead: Boolean = false;
+ def head: A = {
+ if (!ahead) {
+ hd = Iterator.this.next;
+ ahead = true
+ }
+ hd
+ }
+ def next: A =
+ if (ahead) { ahead = false; hd } else head;
+ def hasNext: Boolean = ahead || Iterator.this.hasNext;
+ override def buffered: BufferedIterator[A] = this;
+ }
+
+ /** Creates two new iterators that both iterate over the same elements
+ * than this iterator (in the same order).
+ */
+ def duplicate: Pair[Iterator[A], Iterator[A]] = {
+ var xs: List[A] = Nil;
+ var ahead: Iterator[A] = null;
+ class Partner extends Iterator[A] {
+ var ys: List[A] = Nil;
+ def hasNext: Boolean = Iterator.this.synchronized {
+ ((this == ahead) && Iterator.this.hasNext) ||
+ ((this != ahead) && (!xs.isEmpty || !ys.isEmpty || Iterator.this.hasNext));
+ }
+ def next: A = Iterator.this.synchronized {
+ if (this == ahead) {
+ val e = Iterator.this.next;
+ xs = e :: xs; e
+ } else {
+ if (ys.isEmpty) {
+ ys = xs.reverse;
+ xs = Nil;
+ }
+ ys match {
+ case Nil => val e = Iterator.this.next;
+ ahead = this;
+ xs = e :: xs; e
+ case z :: zs => ys = zs; z
+ }
+ }
+ }
+ }
+ ahead = new Partner;
+ Pair(ahead, new Partner)
+ }
/** Fills the given array <code>xs</code> with the elements of
* this sequence starting at position <code>start</code>.
@@ -388,12 +388,12 @@ trait Iterator[+A] {
* @return the given array <code>xs</code> filled with this list.
*/
def copyToArray[B >: A](xs: Array[B], start: Int): Array[B] = {
- var i = start;
- while (hasNext) {
- xs(i) = next;
- i = i + 1;
- }
- xs
+ var i = start;
+ while (hasNext) {
+ xs(i) = next;
+ i = i + 1;
+ }
+ xs
}
/** Transform this iterator into a list of all elements.
diff --git a/sources/scala/Predef.scala b/sources/scala/Predef.scala
index 053c92088b..7dd8bc3a60 100644
--- a/sources/scala/Predef.scala
+++ b/sources/scala/Predef.scala
@@ -137,19 +137,19 @@ object Predef {
}
def view[A <% Ordered[A]](xs: Array[A]): Ordered[Array[A]] = new Ordered[Array[A]] with Proxy(xs) {
- def compareTo[B >: Array[A] <% Ordered[B]](that: B): Int = that match {
- case ys: Array[A] =>
- var i, res = 0;
- while ((i < xs.length) && (i < ys.length) && (res == 0)) {
- res = xs(i) compareTo ys(i);
- i = i + 1;
- }
- if (res != 0) res
- else if (i < xs.length) 1
- else -1
- case _ =>
- -(that compareTo xs)
- }
+ def compareTo[B >: Array[A] <% Ordered[B]](that: B): Int = that match {
+ case ys: Array[A] =>
+ var i, res = 0;
+ while ((i < xs.length) && (i < ys.length) && (res == 0)) {
+ res = xs(i) compareTo ys(i);
+ i = i + 1;
+ }
+ if (res != 0) res
+ else if (i < xs.length) 1
+ else -1
+ case _ =>
+ -(that compareTo xs)
+ }
}
private def first(xs: Int*): Int = xs.elements.find(x => x != 0) match {
@@ -161,49 +161,49 @@ object Predef {
* wait for the next release...
*
def view[A <% Ordered[A], B <% Ordered[B]](x: Tuple2[A, B]): Ordered[Tuple2[A, B]] =
- new Ordered[Tuple2[A, B]] with Proxy(x) {
- def compareTo[T >: Tuple2[A, B] <% Ordered[T]](y: T): Int = y match {
- case y1: Tuple2[A, B] => first(x._1.compareTo(y1._1),
- x._2.compareTo(y1._2));
- case _ => -(y compareTo x)
- }
- }
+ new Ordered[Tuple2[A, B]] with Proxy(x) {
+ def compareTo[T >: Tuple2[A, B] <% Ordered[T]](y: T): Int = y match {
+ case y1: Tuple2[A, B] => first(x._1.compareTo(y1._1),
+ x._2.compareTo(y1._2));
+ case _ => -(y compareTo x)
+ }
+ }
def view[A <% Ordered[A], B <% Ordered[B], C <% Ordered[C]]
(x: Tuple3[A, B, C]): Ordered[Tuple3[A, B, C]] =
- new Ordered[Tuple3[A, B, C]] with Proxy(x) {
- def compareTo[T >: Tuple3[A, B, C] <% Ordered[T]](y: T): Int = y match {
- case y1: Tuple3[A, B, C] => first(x._1.compareTo(y1._1),
- x._2.compareTo(y1._2),
- x._3.compareTo(y1._3));
- case _ => -(y compareTo x)
- }
- }
+ new Ordered[Tuple3[A, B, C]] with Proxy(x) {
+ def compareTo[T >: Tuple3[A, B, C] <% Ordered[T]](y: T): Int = y match {
+ case y1: Tuple3[A, B, C] => first(x._1.compareTo(y1._1),
+ x._2.compareTo(y1._2),
+ x._3.compareTo(y1._3));
+ case _ => -(y compareTo x)
+ }
+ }
def view[A <% Ordered[A], B <% Ordered[B], C <% Ordered[C], D <% Ordered[D]]
- (x: Tuple4[A, B, C, D]): Ordered[Tuple4[A, B, C, D]] =
- new Ordered[Tuple4[A, B, C, D]] with Proxy(x) {
- def compareTo[T >: Tuple4[A, B, C, D] <% Ordered[T]](y: T): Int = y match {
- case y1: Tuple4[A, B, C, D] => first(x._1.compareTo(y1._1),
- x._2.compareTo(y1._2),
- x._3.compareTo(y1._3),
- x._4.compareTo(y1._4));
- case _ => -(y compareTo x)
- }
- }
+ (x: Tuple4[A, B, C, D]): Ordered[Tuple4[A, B, C, D]] =
+ new Ordered[Tuple4[A, B, C, D]] with Proxy(x) {
+ def compareTo[T >: Tuple4[A, B, C, D] <% Ordered[T]](y: T): Int = y match {
+ case y1: Tuple4[A, B, C, D] => first(x._1.compareTo(y1._1),
+ x._2.compareTo(y1._2),
+ x._3.compareTo(y1._3),
+ x._4.compareTo(y1._4));
+ case _ => -(y compareTo x)
+ }
+ }
def view[A <% Ordered[A], B <% Ordered[B], C <% Ordered[C], D <% Ordered[D], E <% Ordered[E]]
- (x: Tuple5[A, B, C, D, E]): Ordered[Tuple5[A, B, C, D, E]] =
- new Ordered[Tuple5[A, B, C, D, E]] with Proxy(x) {
- def compareTo[T >: Tuple5[A, B, C, D, E] <% Ordered[T]](y: T): Int = y match {
- case y1: Tuple5[A, B, C, D, E] => first(x._1.compareTo(y1._1),
- x._2.compareTo(y1._2),
- x._3.compareTo(y1._3),
- x._4.compareTo(y1._4),
- x._5.compareTo(y1._5));
- case _ => -(y compareTo x)
- }
- }
+ (x: Tuple5[A, B, C, D, E]): Ordered[Tuple5[A, B, C, D, E]] =
+ new Ordered[Tuple5[A, B, C, D, E]] with Proxy(x) {
+ def compareTo[T >: Tuple5[A, B, C, D, E] <% Ordered[T]](y: T): Int = y match {
+ case y1: Tuple5[A, B, C, D, E] => first(x._1.compareTo(y1._1),
+ x._2.compareTo(y1._2),
+ x._3.compareTo(y1._3),
+ x._4.compareTo(y1._4),
+ x._5.compareTo(y1._5));
+ case _ => -(y compareTo x)
+ }
+ }
*/
def view(x: String): Ordered[String] = new Ordered[String] with Proxy(x) {
diff --git a/sources/scala/SeqProxy.scala b/sources/scala/SeqProxy.scala
index 3c5b506647..cfb0d4ad6d 100644
--- a/sources/scala/SeqProxy.scala
+++ b/sources/scala/SeqProxy.scala
@@ -42,7 +42,7 @@ class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
*
* @param elem element to search for.
* @return the index in this sequence of the first occurence of the specified
- * element, or -1 if the sequence does not contain this element.
+ * element, or -1 if the sequence does not contain this element.
*/
override def indexOf[B >: A](elem: B): Int = x.indexOf(elem);
@@ -55,7 +55,7 @@ class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
* specified element, or -1 if the sequence does not contain
* this element.
*/
- override def lastIndexOf[B >: A](elem: B): Int = x.lastIndexOf(elem);
+ override def lastIndexOf[B >: A](elem: B): Int = x.lastIndexOf(elem);
/** Returns the sub-sequence starting from index <code>n</code>.
*/
diff --git a/sources/scala/collection/immutable/TreeMap.scala b/sources/scala/collection/immutable/TreeMap.scala
index 45d7f09067..a4f4709156 100644
--- a/sources/scala/collection/immutable/TreeMap.scala
+++ b/sources/scala/collection/immutable/TreeMap.scala
@@ -97,14 +97,14 @@ object TreeMap {
* @return true, iff both maps contain exactly the same mappings.
*/
override def equals(obj: Any): Boolean =
- if (obj.isInstanceOf[scala.collection.Map[A, B]]) {
- val that = obj.asInstanceOf[scala.collection.Map[A, B]];
- if (size != that.size) false else elements.forall {
- case Pair(key, value) => that.get(key) match {
- case None => false;
- case Some(v) => v == value;
- }
- }
- } else
- false;
+ if (obj.isInstanceOf[scala.collection.Map[A, B]]) {
+ val that = obj.asInstanceOf[scala.collection.Map[A, B]];
+ if (size != that.size) false else elements.forall {
+ case Pair(key, value) => that.get(key) match {
+ case None => false;
+ case Some(v) => v == value;
+ }
+ }
+ } else
+ false;
}
diff --git a/sources/scala/collection/immutable/TreeSet.scala b/sources/scala/collection/immutable/TreeSet.scala
index ddcc7b27c2..cde2ae86a3 100644
--- a/sources/scala/collection/immutable/TreeSet.scala
+++ b/sources/scala/collection/immutable/TreeSet.scala
@@ -60,9 +60,9 @@ class TreeSet[A <% Ordered[A]] extends Tree[A, A] with Set[A] {
* Two set are equal iff they contain the same elements.
*/
override def equals(obj: Any): Boolean =
- if (obj.isInstanceOf[scala.collection.Set[A]]) {
- val that = obj.asInstanceOf[scala.collection.Set[A]];
- if (size != that.size) false else toList.forall(that.contains);
- } else
- false;
+ if (obj.isInstanceOf[scala.collection.Set[A]]) {
+ val that = obj.asInstanceOf[scala.collection.Set[A]];
+ if (size != that.size) false else toList.forall(that.contains);
+ } else
+ false;
}
diff --git a/sources/scala/collection/mutable/ArrayBuffer.scala b/sources/scala/collection/mutable/ArrayBuffer.scala
index 5f346c7fd3..7e7f1c2744 100644
--- a/sources/scala/collection/mutable/ArrayBuffer.scala
+++ b/sources/scala/collection/mutable/ArrayBuffer.scala
@@ -18,12 +18,12 @@ package scala.collection.mutable;
*/
class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
- def apply(n: Int): A = {
- if ((n < 0) || (n >= size))
- error("cannot access element " + n + " in ArrayBuffer");
- else
- array(n);
- }
+ def apply(n: Int): A = {
+ if ((n < 0) || (n >= size))
+ error("cannot access element " + n + " in ArrayBuffer");
+ else
+ array(n);
+ }
/** Append a single element to this buffer and return
* the identity of the buffer.
@@ -31,10 +31,10 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
* @param elem the element to append.
*/
def +(elem: A): Buffer[A] = {
- ensureSize(1);
- array(size) = elem;
- size = size + 1;
- this
+ ensureSize(1);
+ array(size) = elem;
+ size = size + 1;
+ this
}
/** Appends a number of elements provided by an iterable object
@@ -75,13 +75,13 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
*/
def insertAll(n: Int, iter: Iterable[A]): Unit = {
if ((n < 0) || (n > size))
- error("cannot insert element " + n + " in ListBuffer");
- val xs = iter.elements.toList;
- val len = xs.length;
- ensureSize(len);
- copy(n, n + len, size - n);
- xs.copyToArray(array, n);
- size = size + len;
+ error("cannot insert element " + n + " in ListBuffer");
+ val xs = iter.elements.toList;
+ val len = xs.length;
+ ensureSize(len);
+ copy(n, n + len, size - n);
+ xs.copyToArray(array, n);
+ size = size + len;
}
/** Replace element at index <code>n</code> with the new element
@@ -91,13 +91,13 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
* @param newelem the new element.
*/
def update(n: Int, newelem: A): Unit = {
- if ((n < 0) || (n >= size))
- error("cannot update element " + n + " in ArrayBuffer");
- else {
- val res = array(n);
- array(n) = newelem;
- res
- }
+ if ((n < 0) || (n >= size))
+ error("cannot update element " + n + " in ArrayBuffer");
+ else {
+ val res = array(n);
+ array(n) = newelem;
+ res
+ }
}
/** Removes the element on a given index position.
@@ -105,8 +105,8 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
* @param n the index which refers to the element to delete.
*/
def remove(n: Int): A = {
- if ((n < 0) || (n >= size))
- error("cannot remove element " + n + " in Buffer");
+ if ((n < 0) || (n >= size))
+ error("cannot remove element " + n + " in Buffer");
val res = array(n);
copy(n + 1, n, size - n - 1);
size = size - 1;
@@ -124,9 +124,9 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
* @return an <code>ArrayBuffer</code> with the same elements.
*/
override def clone(): Buffer[A] = {
- val res = new ArrayBuffer[A];
- res ++= this;
- res
+ val res = new ArrayBuffer[A];
+ res ++= this;
+ res
}
/** Checks if two buffers are structurally identical.
@@ -134,14 +134,14 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
* @return true, iff both buffers contain the same sequence of elements.
*/
override def equals(obj: Any): Boolean = obj match {
- case that: ArrayBuffer[A] =>
- elements.zip(that.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem;
- }
- case _ => false
+ case that: ArrayBuffer[A] =>
+ elements.zip(that.elements).forall {
+ case Pair(thiselem, thatelem) => thiselem == thatelem;
+ }
+ case _ => false
}
/** Defines the prefix of the string representation.
- */
- override protected def stringPrefix: String = "ArrayBuffer";
+ */
+ override protected def stringPrefix: String = "ArrayBuffer";
}
diff --git a/sources/scala/collection/mutable/Buffer.scala b/sources/scala/collection/mutable/Buffer.scala
index 3d99e11f73..9dec464ff6 100644
--- a/sources/scala/collection/mutable/Buffer.scala
+++ b/sources/scala/collection/mutable/Buffer.scala
@@ -172,27 +172,27 @@ trait Buffer[A] with Seq[A] with Scriptable[Message[Pair[Location, A]]] with Clo
* @param cmd the message to send.
*/
def <<(cmd: Message[Pair[Location, A]]): Unit = cmd match {
- case Include(Pair(l, elem)) => l match {
- case Start => prepend(elem);
- case End => append(elem);
- case Index(n) => insert(n, elem);
- case _ => error("message " + cmd + " not understood");
- }
- case Update(Pair(l, elem)) => l match {
- case Start => update(0, elem);
- case End => update(length - 1, elem);
- case Index(n) => update(n, elem);
- case _ => error("message " + cmd + " not understood");
- }
- case Remove(Pair(l, _)) => l match {
- case Start => remove(0);
- case End => remove(length - 1);
- case Index(n) => remove(n);
- case _ => error("message " + cmd + " not understood");
- }
- case Reset() => clear;
- case s: Script[Pair[Location, A]] => s.elements foreach <<;
- case _ => error("message " + cmd + " not understood");
+ case Include(Pair(l, elem)) => l match {
+ case Start => prepend(elem);
+ case End => append(elem);
+ case Index(n) => insert(n, elem);
+ case _ => error("message " + cmd + " not understood");
+ }
+ case Update(Pair(l, elem)) => l match {
+ case Start => update(0, elem);
+ case End => update(length - 1, elem);
+ case Index(n) => update(n, elem);
+ case _ => error("message " + cmd + " not understood");
+ }
+ case Remove(Pair(l, _)) => l match {
+ case Start => remove(0);
+ case End => remove(length - 1);
+ case Index(n) => remove(n);
+ case _ => error("message " + cmd + " not understood");
+ }
+ case Reset() => clear;
+ case s: Script[Pair[Location, A]] => s.elements foreach <<;
+ case _ => error("message " + cmd + " not understood");
}
/** Return a clone of this buffer.
diff --git a/sources/scala/collection/mutable/HashMap.scala b/sources/scala/collection/mutable/HashMap.scala
index 3771a54fee..3f5fcdee90 100644
--- a/sources/scala/collection/mutable/HashMap.scala
+++ b/sources/scala/collection/mutable/HashMap.scala
@@ -28,8 +28,8 @@ class HashMap[A, B] extends scala.collection.mutable.Map[A, B]
}
override def clone(): HashMap[A, B] = {
- val res = new HashMap[A, B];
- res ++= this;
- res
+ val res = new HashMap[A, B];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/HashSet.scala b/sources/scala/collection/mutable/HashSet.scala
index 6a7b895791..0cbfa1b53a 100644
--- a/sources/scala/collection/mutable/HashSet.scala
+++ b/sources/scala/collection/mutable/HashSet.scala
@@ -41,8 +41,8 @@ class HashSet[A] extends scala.collection.mutable.Set[A] with HashTable[A] {
protected def entryKey(e: Entry) = e;
override def clone(): HashSet[A] = {
- val res = new HashSet[A];
- res ++= this;
- res
+ val res = new HashSet[A];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/HashTable.scala b/sources/scala/collection/mutable/HashTable.scala
index 51b259f312..5d39d19162 100644
--- a/sources/scala/collection/mutable/HashTable.scala
+++ b/sources/scala/collection/mutable/HashTable.scala
@@ -109,8 +109,8 @@ abstract class HashTable[A] {
protected def initTable(tb: Array[List[Entry]]): Unit = {
var i = tb.length - 1;
while (i >= 0) {
- tb(i) = Nil;
- i = i - 1;
+ tb(i) = Nil;
+ i = i - 1;
}
}
@@ -122,11 +122,11 @@ abstract class HashTable[A] {
initTable(newTable);
var i = table.length - 1;
while (i >= 0) {
- table(i).foreach { e => {
- val idx = improve(elemHashCode(entryKey(e))) & (newSize - 1);
+ table(i).foreach { e => {
+ val idx = improve(elemHashCode(entryKey(e))) & (newSize - 1);
newTable(idx) = e :: newTable(idx);
- }};
- i = i - 1;
+ }};
+ i = i - 1;
}
table = newTable;
threshold = newThreshold(newSize);
diff --git a/sources/scala/collection/mutable/JavaMapAdaptor.scala b/sources/scala/collection/mutable/JavaMapAdaptor.scala
index f84562d4cb..3679e787e8 100644
--- a/sources/scala/collection/mutable/JavaMapAdaptor.scala
+++ b/sources/scala/collection/mutable/JavaMapAdaptor.scala
@@ -21,7 +21,7 @@ class JavaMapAdaptor[A, B](jmap: java.util.Map) extends Map[A, B] {
def size: Int = jmap.size();
def get(key: A): Option[B] =
- if (jmap.containsKey(key)) Some(jmap.get(key).asInstanceOf[B]) else None;
+ if (jmap.containsKey(key)) Some(jmap.get(key).asInstanceOf[B]) else None;
override def isEmpty: Boolean = jmap.isEmpty();
@@ -32,24 +32,24 @@ class JavaMapAdaptor[A, B](jmap: java.util.Map) extends Map[A, B] {
override def isDefinedAt(key: A) = jmap.containsKey(key);
override def keys: Iterator[A] = new Iterator[A] {
- val iter = jmap.keySet().iterator();
- def hasNext = iter.hasNext();
- def next = iter.next().asInstanceOf[A];
+ val iter = jmap.keySet().iterator();
+ def hasNext = iter.hasNext();
+ def next = iter.next().asInstanceOf[A];
}
override def values: Iterator[B] = new Iterator[B] {
- val iter = jmap.values().iterator();
- def hasNext = iter.hasNext();
- def next = iter.next().asInstanceOf[B];
+ val iter = jmap.values().iterator();
+ def hasNext = iter.hasNext();
+ def next = iter.next().asInstanceOf[B];
}
def elements: Iterator[Pair[A, B]] = new Iterator[Pair[A, B]] {
- val iter = jmap.keySet().iterator();
- def hasNext = iter.hasNext();
- def next = {
- val key = iter.next().asInstanceOf[A];
- Pair(key, apply(key))
- }
+ val iter = jmap.keySet().iterator();
+ def hasNext = iter.hasNext();
+ def next = {
+ val key = iter.next().asInstanceOf[A];
+ Pair(key, apply(key))
+ }
}
def update(key: A, value: B): Unit = { val x = jmap.put(key, value); }
@@ -59,8 +59,8 @@ class JavaMapAdaptor[A, B](jmap: java.util.Map) extends Map[A, B] {
override def clear: Unit = jmap.clear();
override def clone(): Map[A, B] = {
- val res = new HashMap[A, B];
- res ++= this;
- res
+ val res = new HashMap[A, B];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/JavaSetAdaptor.scala b/sources/scala/collection/mutable/JavaSetAdaptor.scala
index a07ef614c7..3279e85a13 100644
--- a/sources/scala/collection/mutable/JavaSetAdaptor.scala
+++ b/sources/scala/collection/mutable/JavaSetAdaptor.scala
@@ -25,9 +25,9 @@ class JavaSetAdaptor[A](jset: java.util.Set) extends Set[A] {
def contains(elem: A): Boolean = jset.contains(elem);
def elements: Iterator[A] = new Iterator[A] {
- val iter = jset.iterator();
- def hasNext = iter.hasNext();
- def next = iter.next().asInstanceOf[A];
+ val iter = jset.iterator();
+ def hasNext = iter.hasNext();
+ def next = iter.next().asInstanceOf[A];
}
def +=(elem: A): Unit = { val x = jset.add(elem); }
@@ -37,8 +37,8 @@ class JavaSetAdaptor[A](jset: java.util.Set) extends Set[A] {
def clear: Unit = jset.clear();
override def clone(): Set[A] = {
- val res = new HashSet[A];
- res ++= this;
- res;
+ val res = new HashSet[A];
+ res ++= this;
+ res;
}
}
diff --git a/sources/scala/collection/mutable/Map.scala b/sources/scala/collection/mutable/Map.scala
index 053e90de43..f5a58eb08b 100644
--- a/sources/scala/collection/mutable/Map.scala
+++ b/sources/scala/collection/mutable/Map.scala
@@ -99,12 +99,12 @@ trait Map[A, B] with scala.collection.Map[A, B] with Scriptable[Message[Pair[A,
* @param cmd the message to send.
*/
def <<(cmd: Message[Pair[A, B]]): Unit = cmd match {
- case Include(Pair(k, v)) => update(k, v);
- case Update(Pair(k, v)) => update(k, v);
- case Remove(Pair(k, _)) => this -= k;
- case Reset() => clear;
- case s: Script[Pair[A, B]] => s.elements foreach <<;
- case _ => error("message " + cmd + " not understood");
+ case Include(Pair(k, v)) => update(k, v);
+ case Update(Pair(k, v)) => update(k, v);
+ case Remove(Pair(k, _)) => this -= k;
+ case Reset() => clear;
+ case s: Script[Pair[A, B]] => s.elements foreach <<;
+ case _ => error("message " + cmd + " not understood");
}
/** Return a clone of this map.
diff --git a/sources/scala/collection/mutable/MutableList.scala b/sources/scala/collection/mutable/MutableList.scala
index b17b161e5d..46513634f0 100644
--- a/sources/scala/collection/mutable/MutableList.scala
+++ b/sources/scala/collection/mutable/MutableList.scala
@@ -73,5 +73,5 @@ abstract class MutableList[A] extends Seq[A] with PartialFunction[Int, A] {
*/
override def toList: List[A] = if (first == null) Nil else first.toList;
- override protected def stringPrefix: String = "MutableList";
+ override protected def stringPrefix: String = "MutableList";
}
diff --git a/sources/scala/collection/mutable/ObservableBuffer.scala b/sources/scala/collection/mutable/ObservableBuffer.scala
index 70b94fe5ac..9c2a1febe5 100644
--- a/sources/scala/collection/mutable/ObservableBuffer.scala
+++ b/sources/scala/collection/mutable/ObservableBuffer.scala
@@ -31,8 +31,8 @@ abstract class ObservableBuffer[A, This <: ObservableBuffer[A, This]]: This
}
abstract override def +:(elem: A): Buffer[A] = {
- super.+:(elem);
- publish(new Include(Pair(Start, elem)) with Undoable {
+ super.+:(elem);
+ publish(new Include(Pair(Start, elem)) with Undoable {
def undo: Unit = trimStart(1);
});
this
@@ -43,25 +43,25 @@ abstract class ObservableBuffer[A, This <: ObservableBuffer[A, This]]: This
var i = n;
val it = iter.elements;
while (it.hasNext) {
- publish(new Include(Pair(Index(i), it.next)) with Undoable {
- def undo: Unit = remove(i);
- });
- i = i + 1;
+ publish(new Include(Pair(Index(i), it.next)) with Undoable {
+ def undo: Unit = remove(i);
+ });
+ i = i + 1;
}
}
abstract override def update(n: Int, newelem: A): Unit = {
- val oldelem = apply(n);
+ val oldelem = apply(n);
super.update(n, newelem);
- publish(new Update(Pair(Index(n), newelem)) with Undoable {
+ publish(new Update(Pair(Index(n), newelem)) with Undoable {
def undo: Unit = update(n, oldelem);
});
}
abstract override def remove(n: Int): A = {
- val oldelem = apply(n);
- super.remove(n);
- publish(new Remove(Pair(Index(n), oldelem)) with Undoable {
+ val oldelem = apply(n);
+ super.remove(n);
+ publish(new Remove(Pair(Index(n), oldelem)) with Undoable {
def undo: Unit = insert(n, oldelem);
});
oldelem
diff --git a/sources/scala/collection/mutable/PriorityQueue.scala b/sources/scala/collection/mutable/PriorityQueue.scala
index c639b29b60..d7ece75d9c 100644
--- a/sources/scala/collection/mutable/PriorityQueue.scala
+++ b/sources/scala/collection/mutable/PriorityQueue.scala
@@ -18,50 +18,50 @@ package scala.collection.mutable;
* @version 1.0, 03/05/2004
*/
class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with Cloneable {
- size = size + 1; // we do not use array(0)
-
- protected def fixUp(as: Array[A], m: Int): Unit = {
- var k: Int = m;
- while ((k > 1) && (as(k / 2) < as(k))) {
- swap(k, k / 2);
- k = k / 2;
- }
- }
-
- protected def fixDown(as: Array[A], m: Int, n: Int): Unit = {
- var k: Int = m;
- var loop: Boolean = true;
- while (loop && (n >= 2 * k)) {
- var j = 2 * k;
- if ((j < n) && (as(j) < as(j + 1)))
- j = j + 1;
- if (!(as(k) < as(j)))
- loop = false;
- else {
- val h = as(k);
- as(k) = as(j);
- as(j) = h;
- k = j;
- }
- }
- }
-
- /** Checks if the queue is empty.
+ size = size + 1; // we do not use array(0)
+
+ protected def fixUp(as: Array[A], m: Int): Unit = {
+ var k: Int = m;
+ while ((k > 1) && (as(k / 2) < as(k))) {
+ swap(k, k / 2);
+ k = k / 2;
+ }
+ }
+
+ protected def fixDown(as: Array[A], m: Int, n: Int): Unit = {
+ var k: Int = m;
+ var loop: Boolean = true;
+ while (loop && (n >= 2 * k)) {
+ var j = 2 * k;
+ if ((j < n) && (as(j) < as(j + 1)))
+ j = j + 1;
+ if (!(as(k) < as(j)))
+ loop = false;
+ else {
+ val h = as(k);
+ as(k) = as(j);
+ as(j) = h;
+ k = j;
+ }
+ }
+ }
+
+ /** Checks if the queue is empty.
*
* @return true, iff there is no element in the queue.
*/
- def isEmpty: Boolean = size < 2;
+ def isEmpty: Boolean = size < 2;
- /** Inserts a single element into the priority queue.
+ /** Inserts a single element into the priority queue.
*
* @param elem the element to insert
*/
- def +=(elem: A): Unit = {
- ensureSize(1);
- array(size) = elem;
- fixUp(array, size);
- size = size + 1;
- }
+ def +=(elem: A): Unit = {
+ ensureSize(1);
+ array(size) = elem;
+ fixUp(array, size);
+ size = size + 1;
+ }
/** Adds all elements provided by an <code>Iterable</code> object
* into the priority queue.
@@ -82,27 +82,27 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with Cloneable {
*/
def enqueue(elems: A*): Unit = (this ++= elems);
- /** Returns the element with the highest priority in the queue,
- * and removes this element from the queue.
+ /** Returns the element with the highest priority in the queue,
+ * and removes this element from the queue.
*
* @return the element with the highest priority.
*/
- def dequeue: A = {
- if (size > 1) {
- size = size - 1;
- swap(1, size);
- fixDown(array, 1, size - 1);
- array(size)
- } else
- error("no element to remove from heap");
- }
+ def dequeue: A = {
+ if (size > 1) {
+ size = size - 1;
+ swap(1, size);
+ fixDown(array, 1, size - 1);
+ array(size)
+ } else
+ error("no element to remove from heap");
+ }
/** Returns the element with the highest priority in the queue,
* or throws an error if there is no element contained in the queue.
*
* @return the element with the highest priority.
*/
- def max: A = if (size > 1) array(1) else error("queue is empty");
+ def max: A = if (size > 1) array(1) else error("queue is empty");
/** Removes all elements from the queue. After this operation is completed,
* the queue will be empty.
@@ -116,19 +116,19 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with Cloneable {
*
* @return an iterator over all elements sorted in descending order.
*/
- override def elements: Iterator[A] = new Iterator[A] {
- val as: Array[A] = new Array[A](size);
- java.lang.System.arraycopy(array, 0, as, 0, size);
- var i = size - 1;
- def hasNext: Boolean = i > 0;
+ override def elements: Iterator[A] = new Iterator[A] {
+ val as: Array[A] = new Array[A](size);
+ java.lang.System.arraycopy(array, 0, as, 0, size);
+ var i = size - 1;
+ def hasNext: Boolean = i > 0;
def next: A = {
val res = as(1);
as(1) = as(i);
i = i - 1;
- fixDown(as, 1, i);
- res
+ fixDown(as, 1, i);
+ res
}
- }
+ }
/** Checks if two queues are structurally identical.
*
@@ -151,9 +151,9 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with Cloneable {
/** Returns a regular queue containing the same elements.
*/
def toQueue: Queue[A] = {
- val res = new Queue[A];
- res ++= this;
- res
+ val res = new Queue[A];
+ res ++= this;
+ res
}
/** Returns a list of all elements.
@@ -171,8 +171,8 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with Cloneable {
* @return a priority queue with the same elements.
*/
override def clone(): PriorityQueue[A] = {
- val res = new PriorityQueue[A];
- res ++= this;
- res
+ val res = new PriorityQueue[A];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/Queue.scala b/sources/scala/collection/mutable/Queue.scala
index 441aafec44..0584ac0b86 100644
--- a/sources/scala/collection/mutable/Queue.scala
+++ b/sources/scala/collection/mutable/Queue.scala
@@ -38,7 +38,7 @@ class Queue[A] extends MutableList[A] with Cloneable {
*/
def ++=(iter: Iterable[A]): Unit = this ++= iter.elements;
- /** Adds all elements provided by an iterator
+ /** Adds all elements provided by an iterator
* at the end of the queue. The elements are prepended in the order they
* are given out by the iterator.
*
@@ -63,7 +63,7 @@ class Queue[A] extends MutableList[A] with Cloneable {
else {
val res = first.elem;
first = first.next;
- len = len - 1;
+ len = len - 1;
res;
}
}
@@ -109,8 +109,8 @@ class Queue[A] extends MutableList[A] with Cloneable {
* @return a queue with the same elements.
*/
override def clone(): Queue[A] = {
- val res = new Queue[A];
- res ++= this;
- res
+ val res = new Queue[A];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/QueueProxy.scala b/sources/scala/collection/mutable/QueueProxy.scala
index d1cfcd10cf..b9c3b52c0c 100644
--- a/sources/scala/collection/mutable/QueueProxy.scala
+++ b/sources/scala/collection/mutable/QueueProxy.scala
@@ -25,8 +25,8 @@ class QueueProxy[A](q: Queue[A]) extends Queue[A] with SeqProxy[A](q) {
override def apply(n: Int): A = q.apply(n);
/** Returns the length of this queue.
- */
- override def length: Int = q.length;
+ */
+ override def length: Int = q.length;
/** Checks if the queue is empty.
*
@@ -48,7 +48,7 @@ class QueueProxy[A](q: Queue[A]) extends Queue[A] with SeqProxy[A](q) {
*/
override def ++=(iter: Iterable[A]): Unit = q ++= iter;
- /** Adds all elements provided by an iterator
+ /** Adds all elements provided by an iterator
* at the end of the queue. The elements are prepended in the order they
* are given out by the iterator.
*
diff --git a/sources/scala/collection/mutable/ResizableArray.scala b/sources/scala/collection/mutable/ResizableArray.scala
index 08ff972fc0..5337a5212f 100644
--- a/sources/scala/collection/mutable/ResizableArray.scala
+++ b/sources/scala/collection/mutable/ResizableArray.scala
@@ -17,41 +17,41 @@ package scala.collection.mutable;
* @version 1.0, 03/05/2004
*/
abstract class ResizableArray[A] with Iterable[A] {
- import java.lang.System.arraycopy;
-
- protected val initialSize: Int = 16;
- protected var array: Array[A] = new Array[A](initialSize);
- protected var size: Int = 0;
-
- /** Extends the internal array if more elements are needed.
- */
- protected def ensureSize(n: Int): Unit = {
- if ((size + n) > array.length) {
- val newar: Array[A] = new Array(array.length * 2);
- arraycopy(array, 0, newar, 0, size);
- array = newar;
- }
- }
-
- /** Swap two elements of this array.
- */
- protected def swap(a: Int, b: Int): Unit = {
- val h = array(a);
- array(a) = array(b);
- array(b) = h;
- }
-
- /** Move parts of the array.
- */
- protected def copy(m: Int, n: Int, len: Int) = {
- arraycopy(array, m, array, n, len);
- }
-
- /** Returns the length of this resizable array.
- */
- def length: Int = size;
-
- /** Returns a new iterator over all elements of this resizable array.
+ import java.lang.System.arraycopy;
+
+ protected val initialSize: Int = 16;
+ protected var array: Array[A] = new Array[A](initialSize);
+ protected var size: Int = 0;
+
+ /** Extends the internal array if more elements are needed.
+ */
+ protected def ensureSize(n: Int): Unit = {
+ if ((size + n) > array.length) {
+ val newar: Array[A] = new Array(array.length * 2);
+ arraycopy(array, 0, newar, 0, size);
+ array = newar;
+ }
+ }
+
+ /** Swap two elements of this array.
+ */
+ protected def swap(a: Int, b: Int): Unit = {
+ val h = array(a);
+ array(a) = array(b);
+ array(b) = h;
+ }
+
+ /** Move parts of the array.
+ */
+ protected def copy(m: Int, n: Int, len: Int) = {
+ arraycopy(array, m, array, n, len);
+ }
+
+ /** Returns the length of this resizable array.
+ */
+ def length: Int = size;
+
+ /** Returns a new iterator over all elements of this resizable array.
*/
def elements: Iterator[A] = new Iterator[A] {
var i = 0;
diff --git a/sources/scala/collection/mutable/Set.scala b/sources/scala/collection/mutable/Set.scala
index b9f4e20b75..f974b7d1e5 100644
--- a/sources/scala/collection/mutable/Set.scala
+++ b/sources/scala/collection/mutable/Set.scala
@@ -26,7 +26,7 @@ trait Set[A] with scala.collection.Set[A] with Scriptable[Message[A]] with Clone
* <pre>set(elem) = true</pre>
*/
def update(elem: A, included: Boolean): Unit =
- if (included) +=(elem) else -=(elem);
+ if (included) +=(elem) else -=(elem);
/** This method adds a new element to the set.
*/
@@ -88,11 +88,11 @@ trait Set[A] with scala.collection.Set[A] with Scriptable[Message[A]] with Clone
* @param cmd the message to send.
*/
def <<(cmd: Message[A]): Unit = cmd match {
- case Include(elem) => this += elem;
- case Remove(elem) => this -= elem;
- case Reset() => clear;
- case s: Script[A] => s.elements foreach <<;
- case _ => error("message " + cmd + " not understood");
+ case Include(elem) => this += elem;
+ case Remove(elem) => this -= elem;
+ case Reset() => clear;
+ case s: Script[A] => s.elements foreach <<;
+ case _ => error("message " + cmd + " not understood");
}
/** Return a clone of this set.
diff --git a/sources/scala/collection/mutable/Stack.scala b/sources/scala/collection/mutable/Stack.scala
index 7da0b6a6f6..756b1637e3 100644
--- a/sources/scala/collection/mutable/Stack.scala
+++ b/sources/scala/collection/mutable/Stack.scala
@@ -64,12 +64,12 @@ class Stack[A] extends MutableList[A] with Cloneable {
/** Removes the top element from the stack.
*/
def pop: A =
- if (first != null) {
- val res = first.elem;
- first = first.next;
- res
- } else
- error("stack empty");
+ if (first != null) {
+ val res = first.elem;
+ first = first.next;
+ res
+ } else
+ error("stack empty");
/**
* Removes all elements from the stack. After this operation completed,
@@ -122,8 +122,8 @@ class Stack[A] extends MutableList[A] with Cloneable {
* @return a stack with the same elements.
*/
override def clone(): Stack[A] = {
- val res = new Stack[A];
- res ++= this;
- res
+ val res = new Stack[A];
+ res ++= this;
+ res
}
}
diff --git a/sources/scala/collection/mutable/StackProxy.scala b/sources/scala/collection/mutable/StackProxy.scala
index 5ee8bbb140..62f333945e 100644
--- a/sources/scala/collection/mutable/StackProxy.scala
+++ b/sources/scala/collection/mutable/StackProxy.scala
@@ -25,8 +25,8 @@ class StackProxy[A](s: Stack[A]) extends Stack[A] with SeqProxy[A](s) {
override def apply(n: Int): A = s.apply(n);
/** Returns the length of this stack.
- */
- override def length: Int = s.length;
+ */
+ override def length: Int = s.length;
/** Checks if the stack is empty.
*
diff --git a/sources/scala/collection/mutable/SynchronizedBuffer.scala b/sources/scala/collection/mutable/SynchronizedBuffer.scala
index f4250d22a5..e15c59b4b4 100644
--- a/sources/scala/collection/mutable/SynchronizedBuffer.scala
+++ b/sources/scala/collection/mutable/SynchronizedBuffer.scala
@@ -167,7 +167,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
}
override def <<(cmd: Message[Pair[Location, A]]): Unit = synchronized {
- super.<<(cmd);
+ super.<<(cmd);
}
/** Return a clone of this buffer.
@@ -175,7 +175,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
* @return an <code>ArrayBuffer</code> with the same elements.
*/
override def clone(): Buffer[A] = synchronized {
- super.clone();
+ super.clone();
}
/** The hashCode method always yields an error, since it is not
diff --git a/sources/scala/collection/mutable/SynchronizedMap.scala b/sources/scala/collection/mutable/SynchronizedMap.scala
index 8e10b51068..b0db7078de 100644
--- a/sources/scala/collection/mutable/SynchronizedMap.scala
+++ b/sources/scala/collection/mutable/SynchronizedMap.scala
@@ -111,6 +111,6 @@ trait SynchronizedMap[A, B] extends scala.collection.mutable.Map[A, B] {
}
override def clone(): Map[A, B] = synchronized {
- super.clone();
+ super.clone();
}
}
diff --git a/sources/scala/collection/mutable/SynchronizedPriorityQueue.scala b/sources/scala/collection/mutable/SynchronizedPriorityQueue.scala
index aa41070763..8b3078e74b 100644
--- a/sources/scala/collection/mutable/SynchronizedPriorityQueue.scala
+++ b/sources/scala/collection/mutable/SynchronizedPriorityQueue.scala
@@ -19,17 +19,17 @@ package scala.collection.mutable;
*/
class SynchronizedPriorityQueue[A <% Ordered[A]] extends PriorityQueue[A] {
- /** Checks if the queue is empty.
+ /** Checks if the queue is empty.
*
* @return true, iff there is no element in the queue.
*/
- override def isEmpty: Boolean = synchronized { super.isEmpty; }
+ override def isEmpty: Boolean = synchronized { super.isEmpty; }
- /** Inserts a single element into the priority queue.
+ /** Inserts a single element into the priority queue.
*
* @param elem the element to insert
*/
- override def +=(elem: A): Unit = synchronized { super.+=(elem); }
+ override def +=(elem: A): Unit = synchronized { super.+=(elem); }
/** Adds all elements provided by an <code>Iterable</code> object
* into the priority queue.
@@ -50,19 +50,19 @@ class SynchronizedPriorityQueue[A <% Ordered[A]] extends PriorityQueue[A] {
*/
override def enqueue(elems: A*): Unit = synchronized { super.++=(elems); }
- /** Returns the element with the highest priority in the queue,
- * and removes this element from the queue.
+ /** Returns the element with the highest priority in the queue,
+ * and removes this element from the queue.
*
* @return the element with the highest priority.
*/
- override def dequeue: A = synchronized { super.dequeue; }
+ override def dequeue: A = synchronized { super.dequeue; }
/** Returns the element with the highest priority in the queue,
* or throws an error if there is no element contained in the queue.
*
* @return the element with the highest priority.
*/
- override def max: A = synchronized { super.max; }
+ override def max: A = synchronized { super.max; }
/** Removes all elements from the queue. After this operation is completed,
* the queue will be empty.
@@ -74,7 +74,7 @@ class SynchronizedPriorityQueue[A <% Ordered[A]] extends PriorityQueue[A] {
*
* @return an iterator over all elements sorted in descending order.
*/
- override def elements: Iterator[A] = synchronized { super.elements; }
+ override def elements: Iterator[A] = synchronized { super.elements; }
/** Checks if two queues are structurally identical.
*
diff --git a/sources/scala/collection/mutable/SynchronizedSet.scala b/sources/scala/collection/mutable/SynchronizedSet.scala
index 2d4c2d5767..743a5a85c4 100644
--- a/sources/scala/collection/mutable/SynchronizedSet.scala
+++ b/sources/scala/collection/mutable/SynchronizedSet.scala
@@ -31,7 +31,7 @@ trait SynchronizedSet[A] extends scala.collection.mutable.Set[A] {
}
abstract override def update(elem: A, included: Boolean): Unit = synchronized {
- super.update(elem, included);
+ super.update(elem, included);
}
abstract override def +=(elem: A): Unit = synchronized {
@@ -95,10 +95,10 @@ trait SynchronizedSet[A] extends scala.collection.mutable.Set[A] {
}
override def <<(cmd: Message[A]): Unit = synchronized {
- super.<<(cmd);
- }
+ super.<<(cmd);
+ }
override def clone(): Set[A] = synchronized {
- super.clone();
+ super.clone();
}
}
diff --git a/sources/scala/tools/scalap/ByteArrayReader.scala b/sources/scala/tools/scalap/ByteArrayReader.scala
index df9cdf2335..5a88a2333b 100644
--- a/sources/scala/tools/scalap/ByteArrayReader.scala
+++ b/sources/scala/tools/scalap/ByteArrayReader.scala
@@ -86,14 +86,14 @@ class ByteArrayReader(content: Array[Byte]) {
/** read the next signed number in big endian format
*/
def nextNum(n: Int): Long = {
- var x: Long = 0;
- var i: Int = 0;
- while (i < n) {
- x = (x << 8) + (nextByte & 0xff);
- i = i + 1;
- }
- val leading: Int = 64 - (n * 8);
- x << leading >> leading;
+ var x: Long = 0;
+ var i: Int = 0;
+ while (i < n) {
+ x = (x << 8) + (nextByte & 0xff);
+ i = i + 1;
+ }
+ val leading: Int = 64 - (n * 8);
+ x << leading >> leading;
}
/** read an UTF8 encoded string
diff --git a/sources/scala/tools/scalap/Entity.scala b/sources/scala/tools/scalap/Entity.scala
index b9ce65ddd6..01e20f8b04 100644
--- a/sources/scala/tools/scalap/Entity.scala
+++ b/sources/scala/tools/scalap/Entity.scala
@@ -36,21 +36,21 @@ class Value extends Entity {
}
case class SimpleValue(tag: Value.Value) extends Value {
- import Value._;
- override def toString(): String = tag match {
- case UNIT => "()"
- case NULL => "null"
- case ZERO => "0"
+ import Value._;
+ override def toString(): String = tag match {
+ case UNIT => "()"
+ case NULL => "null"
+ case ZERO => "0"
}
}
case class NumberValue(tag: Value.Value, value: Long) extends Value {
import Value._;
override def toString(): String = tag match {
- case BOOLEAN => if (value == 0) "false" else "true"
- case BYTE | SHORT | CHAR | INT | LONG => value.toString()
- case FLOAT => java.lang.Float.intBitsToFloat(value.asInstanceOf[Int]).toString()
- case DOUBLE => java.lang.Double.longBitsToDouble(value).toString()
+ case BOOLEAN => if (value == 0) "false" else "true"
+ case BYTE | SHORT | CHAR | INT | LONG => value.toString()
+ case FLOAT => java.lang.Float.intBitsToFloat(value.asInstanceOf[Int]).toString()
+ case DOUBLE => java.lang.Double.longBitsToDouble(value).toString()
}
}
@@ -59,8 +59,8 @@ case class StringValue(str: String) extends Value {
}
object Value extends Enumeration {
- val UNIT, BOOLEAN, BYTE, SHORT, CHAR, INT, LONG, FLOAT, DOUBLE,
- NULL, ZERO = Value;
+ val UNIT, BOOLEAN, BYTE, SHORT, CHAR, INT, LONG, FLOAT, DOUBLE,
+ NULL, ZERO = Value;
}
/** Types
diff --git a/sources/scala/tools/scalap/JavaWriter.scala b/sources/scala/tools/scalap/JavaWriter.scala
index 72db125ba8..7fd75d2e2e 100644
--- a/sources/scala/tools/scalap/JavaWriter.scala
+++ b/sources/scala/tools/scalap/JavaWriter.scala
@@ -37,8 +37,8 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
}
def nameToClass0(str: String) = {
- val res = Names.decode(str.replace('/', '.'));
- if (res == "java.lang.Object") "scala.AnyRef" else res
+ val res = Names.decode(str.replace('/', '.'));
+ if (res == "java.lang.Object") "scala.AnyRef" else res
}
def nameToSimpleClass(str: String) =
diff --git a/sources/scala/tools/scalap/ScalaAttribute.scala b/sources/scala/tools/scalap/ScalaAttribute.scala
index 34125f08a0..bd7b39c40e 100644
--- a/sources/scala/tools/scalap/ScalaAttribute.scala
+++ b/sources/scala/tools/scalap/ScalaAttribute.scala
@@ -124,9 +124,9 @@ class ScalaAttribute(in: ByteArrayReader) {
LONG_LIT |
FLOAT_LIT |
DOUBLE_LIT =>
- Literal(tag, in.nextNum(len))
- case _ =>
- error("unknown meta data tag: " + tag);
+ Literal(tag, in.nextNum(len))
+ case _ =>
+ error("unknown meta data tag: " + tag);
}
}
diff --git a/sources/scala/tools/scalap/ScalaWriter.scala b/sources/scala/tools/scalap/ScalaWriter.scala
index 1a19ce63f4..014a6e2d87 100644
--- a/sources/scala/tools/scalap/ScalaWriter.scala
+++ b/sources/scala/tools/scalap/ScalaWriter.scala
@@ -36,7 +36,7 @@ class ScalaWriter(args: Arguments, writer: Writer) extends CodeWriter(writer) {
printConstr(s.constr);
} else {
print("class " + s.name);
- printConstr(s.constr);
+ printConstr(s.constr);
}
print(" extends ");
printType(s.tpe);
@@ -106,21 +106,21 @@ class ScalaWriter(args: Arguments, writer: Writer) extends CodeWriter(writer) {
def printParameterType(tpe: Type, basic: Boolean): Unit = tpe match {
case TypeRef(SingletonType(ThisType(root), top), sym, args) =>
if ((root.name.equals("<root>") || root.name.equals("")) &&
- top.name.equals("scala") &&
- sym.name.startsWith("Function")) {
- if ((args.length == 2) && !isFunctionType(args.head)) {
- printType(args.head);
- print(" => ");
- printParameterType(args.tail.head, basic);
- } else {
- printParameterTypes(args.take(args.length - 1), "(", ", ", ")", basic);
- print(" => ");
- printParameterType(args.last, basic);
- }
+ top.name.equals("scala") &&
+ sym.name.startsWith("Function")) {
+ if ((args.length == 2) && !isFunctionType(args.head)) {
+ printType(args.head);
+ print(" => ");
+ printParameterType(args.tail.head, basic);
+ } else {
+ printParameterTypes(args.take(args.length - 1), "(", ", ", ")", basic);
+ print(" => ");
+ printParameterType(args.last, basic);
+ }
} else if (basic)
- printType0(tpe);
+ printType0(tpe);
else
- printType(tpe);
+ printType(tpe);
case _ => if (basic) printType0(tpe); else printType(tpe);
}
@@ -159,12 +159,12 @@ class ScalaWriter(args: Arguments, writer: Writer) extends CodeWriter(writer) {
printPrefix(tpe);
print(sym.name)
case TypeRef(pre, sym, args) =>
- if (isJavaRoot(tpe))
- print("scala.AnyRef");
- else {
- printPrefix(pre);
- print(sym.name);
- printTypes(args, "[", ", ", "]");
+ if (isJavaRoot(tpe))
+ print("scala.AnyRef");
+ else {
+ printPrefix(pre);
+ print(sym.name);
+ printTypes(args, "[", ", ", "]");
}
case CompoundType(clazz, components) =>
printTypes(components, "", " with ", "");
@@ -243,16 +243,16 @@ class ScalaWriter(args: Arguments, writer: Writer) extends CodeWriter(writer) {
def printTVar(tvar: Symbol): Unit = tvar match {
case sym: TypeSymbol =>
if (Flags.is(Flags.COVAR, sym.flags))
- print("+" + sym.name)
+ print("+" + sym.name)
else if (Flags.is(Flags.CONTRAVAR, sym.flags))
- print("-" + sym.name);
+ print("-" + sym.name);
else
- print(sym.name);
+ print(sym.name);
if (!isExternalType(sym.tpe, "Any")) {
- if (Flags.is(Flags.VIEWBOUND, sym.flags))
- print(" <% ");
- else
- print(" <: ");
+ if (Flags.is(Flags.VIEWBOUND, sym.flags))
+ print(" <% ");
+ else
+ print(" <: ");
printType(sym.tpe);
}
if (!isExternalType(sym.lower, "All")) {
@@ -295,7 +295,7 @@ class ScalaWriter(args: Arguments, writer: Writer) extends CodeWriter(writer) {
Flags.is(Flags.CASEACCESSOR, s.flags) ||
(Flags.is(Flags.CASE, s.flags) &&
(s match {
- case sym: ValSymbol => true
- case _ => false
+ case sym: ValSymbol => true
+ case _ => false
}))
}