diff options
author | mihaylov <mihaylov@epfl.ch> | 2006-03-03 14:32:42 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2006-03-03 14:32:42 +0000 |
commit | d7007f7a9607481eb73b8df587e3c52cf4272147 (patch) | |
tree | bd7a2af714fa1f12f38a3f1172c4001dde78f558 /src/library | |
parent | 91a9821f91d9953eaa14d09c18041ed3fdb4f0bb (diff) | |
download | scala-d7007f7a9607481eb73b8df587e3c52cf4272147.tar.gz scala-d7007f7a9607481eb73b8df587e3c52cf4272147.tar.bz2 scala-d7007f7a9607481eb73b8df587e3c52cf4272147.zip |
Use 'mixin class' instead of 'trait'
Diffstat (limited to 'src/library')
96 files changed, 183 insertions, 174 deletions
diff --git a/src/library/scala/Application.scala b/src/library/scala/Application.scala index e4d0c37f8b..8d5327e8be 100644 --- a/src/library/scala/Application.scala +++ b/src/library/scala/Application.scala @@ -36,7 +36,7 @@ package scala; * @version 1.0, 10/09/03 */ -[_trait_] class Application { +mixin class Application { /** The time when execution of this program started. */ diff --git a/src/library/scala/BufferedIterator.scala b/src/library/scala/BufferedIterator.scala index 3f30bf3659..0675f22167 100644 --- a/src/library/scala/BufferedIterator.scala +++ b/src/library/scala/BufferedIterator.scala @@ -18,7 +18,7 @@ package scala; * @author Martin Odersky * @version 1.0, 16/07/2003 */ -trait BufferedIterator[+A] extends Iterator[A] { +mixin class BufferedIterator[+A] extends Iterator[A] { /** Checks what the next available element is. * diff --git a/src/library/scala/CaseClass.scala b/src/library/scala/CaseClass.scala index d50220f737..91b290956e 100644 --- a/src/library/scala/CaseClass.scala +++ b/src/library/scala/CaseClass.scala @@ -16,7 +16,7 @@ package scala; * * @author Burak Emir */ -trait CaseClass extends AnyRef { +mixin class CaseClass extends AnyRef { /** for a case class A(x_0,...,x_(k-1)), returns x_i for 0 <= i < k, ** null otherwise diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala index 734d1221bf..a3e9a5383b 100644 --- a/src/library/scala/Console.scala +++ b/src/library/scala/Console.scala @@ -12,8 +12,6 @@ package scala; -import Predef._; - /** The <code>Console</code> object implements functionality for * printing Scala values on the terminal. There are also functions * for reading specific values. <code>Console</code> also defines diff --git a/src/library/scala/CountedIterator.scala b/src/library/scala/CountedIterator.scala index cf45174e17..bce9fd45fe 100644 --- a/src/library/scala/CountedIterator.scala +++ b/src/library/scala/CountedIterator.scala @@ -18,7 +18,7 @@ package scala; * @author Martin Odersky * @version 1.0, 16/07/2003 */ -trait CountedIterator[+A] extends Iterator[A] { +mixin class CountedIterator[+A] extends Iterator[A] { /** counts the elements in this iterator; counts start at 0 */ diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 064b6259ac..5bd0ccf0f5 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -13,7 +13,6 @@ package scala; import scala.collection.mutable._; -import Predef._; /** * <p>The class <code>Enumeration</code> provides the same functionality as the @@ -115,7 +114,7 @@ abstract class Enumeration(initial: Int, names: String*) { protected final def Value(i: Int, name: String): Value = new Val(i, name); - trait Value extends Ordered[Value] { + abstract class Value extends Ordered[Value] { def id: Int; override def compareTo[S >: Value <% Ordered[S]](that: S): Int = that match { case that1: Value => id - that1.id diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index e7d2da57f4..7309ed403c 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -15,7 +15,7 @@ package scala; /** * Function with no parameters */ -trait Function0[+R] extends AnyRef { +mixin class Function0[+R] extends AnyRef { def apply(): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index f928596332..a5e19bb2fa 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 1 parameter */ -trait Function1[-T0, +R] extends AnyRef { +mixin class Function1[-T0, +R] extends AnyRef { def apply(v0: T0): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala index bea1a9a951..e58173d6b3 100644 --- a/src/library/scala/Function2.scala +++ b/src/library/scala/Function2.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 2 parameters */ -trait Function2[-T0, -T1, +R] extends AnyRef { +mixin class Function2[-T0, -T1, +R] extends AnyRef { def apply(v0: T0, v1: T1): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function3.scala b/src/library/scala/Function3.scala index d161362d03..09d8633f7f 100644 --- a/src/library/scala/Function3.scala +++ b/src/library/scala/Function3.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 3 parameters */ -trait Function3[-T0, -T1, -T2, +R] extends AnyRef { +mixin class Function3[-T0, -T1, -T2, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function4.scala b/src/library/scala/Function4.scala index 7ddbed0031..3bae61ead6 100644 --- a/src/library/scala/Function4.scala +++ b/src/library/scala/Function4.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 4 parameters */ -trait Function4[-T0, -T1, -T2, -T3, +R] extends AnyRef { +mixin class Function4[-T0, -T1, -T2, -T3, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function5.scala b/src/library/scala/Function5.scala index 74fe7d1ca1..7bebfa5d5b 100644 --- a/src/library/scala/Function5.scala +++ b/src/library/scala/Function5.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 5 parameters */ -trait Function5[-T0, -T1, -T2, -T3, -T4, +R] extends AnyRef { +mixin class Function5[-T0, -T1, -T2, -T3, -T4, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3, v4: T4): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function6.scala b/src/library/scala/Function6.scala index a46f17bb61..d9709a0e46 100644 --- a/src/library/scala/Function6.scala +++ b/src/library/scala/Function6.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 6 parameters */ -trait Function6[-T0, -T1, -T2, -T3, -T4, -T5, +R] extends AnyRef { +mixin class Function6[-T0, -T1, -T2, -T3, -T4, -T5, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function7.scala b/src/library/scala/Function7.scala index 95bdb39275..0398c349ac 100644 --- a/src/library/scala/Function7.scala +++ b/src/library/scala/Function7.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 7 parameters */ -trait Function7[-T0, -T1, -T2, -T3, -T4, -T5, -T6, +R] extends AnyRef { +mixin class Function7[-T0, -T1, -T2, -T3, -T4, -T5, -T6, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function8.scala b/src/library/scala/Function8.scala index e0b87f00e2..0630402a3e 100644 --- a/src/library/scala/Function8.scala +++ b/src/library/scala/Function8.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 8 parameters */ -trait Function8[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends AnyRef { +mixin class Function8[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Function9.scala b/src/library/scala/Function9.scala index 87761c6f59..8e82ded993 100644 --- a/src/library/scala/Function9.scala +++ b/src/library/scala/Function9.scala @@ -15,7 +15,7 @@ package scala; /** * Function with 9 parameters */ -trait Function9[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends AnyRef { +mixin class Function9[-T0, -T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends AnyRef { def apply(v0: T0, v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8): R; override def toString() = "<function>"; } diff --git a/src/library/scala/Iterable.scala b/src/library/scala/Iterable.scala index b2b98d62df..501e158154 100644 --- a/src/library/scala/Iterable.scala +++ b/src/library/scala/Iterable.scala @@ -11,8 +11,7 @@ package scala; - -import Predef._; +import Predef.error; object Iterable { def view[A <% Ordered[A]](x: Iterable[A]): Ordered[Iterable[A]] = new Ordered[Iterable[A]] { @@ -58,14 +57,14 @@ object Iterable { } -/** Collection classes supporting this trait provide a method +/** Collection classes mixing in this class provide a method * <code>elements</code> which returns an iterator over all the * elements contained in the collection. * * @author Matthias Zenger * @version 1.1, 04/02/2004 */ -trait Iterable[+A] { +mixin class Iterable[+A] { /** Creates a new iterator over all elements contained in this * object. diff --git a/src/library/scala/IterableProxy.scala b/src/library/scala/IterableProxy.scala index 0b8ddc88df..ed45c58f5c 100644 --- a/src/library/scala/IterableProxy.scala +++ b/src/library/scala/IterableProxy.scala @@ -18,7 +18,7 @@ package scala; * @author Matthias Zenger * @version 1.0, 26/04/2004 */ -trait IterableProxy[+A] extends Iterable[A] with Proxy { +mixin class IterableProxy[+A] extends Iterable[A] with Proxy { def self: Iterable[A]; diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala index 1a4d641c48..1c813543d4 100644 --- a/src/library/scala/Iterator.scala +++ b/src/library/scala/Iterator.scala @@ -160,7 +160,7 @@ object Iterator { * @author Matthias Zenger * @version 1.2, 15/03/2004 */ -trait Iterator[+A] { +mixin class Iterator[+A] { /** Does this iterator provide another element? */ @@ -178,7 +178,7 @@ trait Iterator[+A] { def hasNext = remaining > 0 && Iterator.this.hasNext; def next: A = if (hasNext) { remaining = remaining - 1; Iterator.this.next } - else Predef.error("next on empty iterator"); + else error("next on empty iterator"); } /** Removes the first <code>n</code> elements from this iterator. diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 62486f972c..ea4bd0e273 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -84,7 +84,7 @@ object List { * @param elem the element composing the resulting list * @return a list composed of n elements all equal to elem */ - def make[a](n: int, elem: a): List[a] = { + def make[a](n: Int, elem: a): List[a] = { val b = new ListBuffer[a] var i = 0 while (i < n) { @@ -102,7 +102,7 @@ object List { * @return the list obtained by applying the maker function to successive * integers from 0 to n (exclusive). */ - def tabulate[a](n: int, maker: int => a): List[a] = { + def tabulate[a](n: Int, maker: Int => a): List[a] = { val b = new ListBuffer[a] var i = 0 while (i < n) { @@ -351,11 +351,11 @@ object List { /** Lists with ordered elements are ordered */ implicit def list2ordered[a <% Ordered[a]](x: List[a]): Ordered[List[a]] = new Ordered[List[a]] { - def compareTo [b >: List[a] <% Ordered[b]](y: b): int = y match { + def compareTo [b >: List[a] <% Ordered[b]](y: b): Int = y match { case y1: List[a] => compareLists(x, y1); case _ => -(y compareTo x) } - private def compareLists(xs: List[a], ys: List[a]): int = { + private def compareLists(xs: List[a], ys: List[a]): Int = { if (xs.isEmpty && ys.isEmpty) 0 else if (xs.isEmpty) -1 else if (ys.isEmpty) 1 @@ -369,7 +369,7 @@ object List { def view[a <% Ordered[a]](x: List[a]): Ordered[List[a]] = list2ordered(x); } -/** A trait representing an ordered collection of elements of type +/** A class representing an ordered collection of elements of type * <code>a</code>. This class comes with two implementing case * classes <code>scala.Nil</code> and <code>scala.::</code> that * implement the abstract members <code>isEmpty</code>, @@ -458,8 +458,8 @@ sealed abstract class List[+a] extends Seq[a] { * * @return a list of all indices in the list. */ - def indices: List[int] = { - val b = new ListBuffer[int] + def indices: List[Int] = { + val b = new ListBuffer[Int] var i = 0 var these = this while (!these.isEmpty) { diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala index d47fdc401a..0bd03599cf 100644 --- a/src/library/scala/Option.scala +++ b/src/library/scala/Option.scala @@ -12,9 +12,6 @@ package scala; -import Predef._; - - /** This class represents optional values. Instances of <code>Option</code> * are either instances of case class <code>Some</code> or it is case * object <code>None</code>. @@ -23,7 +20,7 @@ import Predef._; * @author Matthias Zenger * @version 1.0, 16/07/2003 */ -trait Option[+A] extends Iterable[A] { +abstract class Option[+A] extends Iterable[A] { def isEmpty: Boolean = this match { case None => true @@ -31,7 +28,7 @@ trait Option[+A] extends Iterable[A] { } def get: A = this match { - case None => error("None.get") + case None => Predef.error("None.get") case Some(x) => x } diff --git a/src/library/scala/Ordered.scala b/src/library/scala/Ordered.scala index 0df54eaffb..2c14369575 100644 --- a/src/library/scala/Ordered.scala +++ b/src/library/scala/Ordered.scala @@ -12,12 +12,12 @@ package scala; -/** A trait for totally ordered data. +/** A class for totally ordered data. * * @author Martin Odersky * @version 1.0, 23/04/2004 */ -trait Ordered[+a] { +mixin class Ordered[+a] { /** Result of comparing `this' with operand `that'. * returns `x' where diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index 8af05728f1..ed5d64ca1c 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -20,7 +20,7 @@ package scala; * @author Martin Odersky * @version 1.0, 16/07/2003 */ -trait PartialFunction[-A, +B] extends AnyRef with (A => B) { +mixin class PartialFunction[-A, +B] extends AnyRef with (A => B) { /** Checks if a value is contained in the functions domain. * diff --git a/src/library/scala/PartiallyOrdered.scala b/src/library/scala/PartiallyOrdered.scala index 7352c78c65..ab8c5ae997 100644 --- a/src/library/scala/PartiallyOrdered.scala +++ b/src/library/scala/PartiallyOrdered.scala @@ -12,12 +12,12 @@ package scala; -/** A trait for partially ordered data. +/** A class for partially ordered data. * * @author Martin Odersky * @version 1.0, 23/04/2004 */ -trait PartiallyOrdered[+a] { +mixin class PartiallyOrdered[+a] { /** Result of comparing `this' with operand `that'. * Returns `None' if operands are not comparable. diff --git a/src/library/scala/Proxy.scala b/src/library/scala/Proxy.scala index 64e2a333f8..4ccde24a23 100644 --- a/src/library/scala/Proxy.scala +++ b/src/library/scala/Proxy.scala @@ -20,7 +20,7 @@ package scala; * @author Matthias Zenger * @version 1.0, 26/04/2004 */ -trait Proxy { +mixin class Proxy { def self: Any; override def hashCode(): Int = self.hashCode(); override def equals(y: Any): Boolean = self.equals(y); diff --git a/src/library/scala/ScalaObject.scala b/src/library/scala/ScalaObject.scala index bbfe484152..017be3f44b 100644 --- a/src/library/scala/ScalaObject.scala +++ b/src/library/scala/ScalaObject.scala @@ -12,7 +12,7 @@ package scala; -trait ScalaObject extends AnyRef { +mixin class ScalaObject extends AnyRef { /** This method is needed for optimizing pattern matching expressions * which match on constructors of case classes. diff --git a/src/library/scala/Seq.scala b/src/library/scala/Seq.scala index 61228cd29e..fb262586e2 100644 --- a/src/library/scala/Seq.scala +++ b/src/library/scala/Seq.scala @@ -12,8 +12,6 @@ package scala; -import Predef._; - object Seq { /** builds a singleton sequence @@ -51,8 +49,7 @@ object Seq { * @author Matthias Zenger * @version 1.0, 16/07/2003 */ -[serializable] -trait Seq[+A] extends AnyRef with PartialFunction[Int, A] with Iterable[A] { +mixin class Seq[+A] extends AnyRef with PartialFunction[Int, A] with Iterable[A] { /** Returns the length of the sequence. * @@ -150,7 +147,7 @@ trait Seq[+A] extends AnyRef with PartialFunction[Int, A] with Iterable[A] { } } } else - error("cannot create subsequence"); + Predef.error("cannot create subsequence"); /** Fills the given array <code>xs</code> with the elements of * this sequence starting at position <code>start</code>. diff --git a/src/library/scala/SeqProxy.scala b/src/library/scala/SeqProxy.scala index 0828349deb..5c3aa26179 100644 --- a/src/library/scala/SeqProxy.scala +++ b/src/library/scala/SeqProxy.scala @@ -19,7 +19,7 @@ package scala; * @author Matthias Zenger * @version 1.0, 16/07/2003 */ -trait SeqProxy[+A] extends Seq[A] with IterableProxy[A] { +mixin class SeqProxy[+A] extends Seq[A] with IterableProxy[A] { def self: Seq[A]; diff --git a/src/library/scala/Some.scala b/src/library/scala/Some.scala index 19b275d52b..e8235f26e8 100644 --- a/src/library/scala/Some.scala +++ b/src/library/scala/Some.scala @@ -18,4 +18,4 @@ package scala; * @author Martin Odersky * @version 1.0, 16/07/2003 */ -final case class Some[+A1](x: A1) extends Option[A1]; +final case class Some[+A](x: A) extends Option[A]; diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala index 73547564ec..cfdc49f07b 100644 --- a/src/library/scala/Stream.scala +++ b/src/library/scala/Stream.scala @@ -124,7 +124,7 @@ object Stream { * @author Martin Odersky, Matthias Zenger * @version 1.1 08/08/03 */ -trait Stream[+a] extends Seq[a] { +mixin class Stream[+a] extends Seq[a] { def isEmpty: Boolean; def head: a; diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala index c67e762551..21d4bc9041 100644 --- a/src/library/scala/collection/Map.scala +++ b/src/library/scala/collection/Map.scala @@ -12,21 +12,24 @@ package scala.collection; -/** This trait defines the interface of collections that unambiguously map +/** This class defines the interface of collections that unambiguously map * keys to values (i.e. a key is mapped to at least one value). - * Trait <code>Map</code> may only be used for + * Class <code>Map</code> may only be used for * accessing elements from map implementations. Two different extensions - * of trait <code>Map</code> in the package <code>scala.collections.mutable</code> + * of class <code>Map</code> in the package <code>scala.collections.mutable</code> * and <code>scala.collections.immutable</code> provide functionality for - * adding new key/value mappings to a map. The trait in the first package is - * implemented by maps that are modified destructively, whereas the trait in + * adding new key/value mappings to a map. The class in the first package is + * implemented by maps that are modified destructively, whereas the class in * the second package is used by functional map implementations that rely on * immutable data structures. * * @author Matthias Zenger * @version 1.1, 02/05/2004 */ -trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A, B]] { +mixin class Map[A, +B] extends AnyRef + with PartialFunction[A, B] + with Iterable[Pair[A, B]] +{ /** Compute the number of key-to-value mappings. * diff --git a/src/library/scala/collection/MapProxy.scala b/src/library/scala/collection/MapProxy.scala index 819627546d..982deeab7e 100644 --- a/src/library/scala/collection/MapProxy.scala +++ b/src/library/scala/collection/MapProxy.scala @@ -19,7 +19,7 @@ package scala.collection; * @author Matthias Zenger * @version 1.0, 21/07/2003 */ -trait MapProxy[A, +B] extends Map[A, B] with IterableProxy[Pair[A, B]] { +mixin class MapProxy[A, +B] extends Map[A, B] with IterableProxy[Pair[A, B]] { def self: Map[A, B]; diff --git a/src/library/scala/collection/Set.scala b/src/library/scala/collection/Set.scala index fd8e1bed8c..66f571213e 100644 --- a/src/library/scala/collection/Set.scala +++ b/src/library/scala/collection/Set.scala @@ -12,20 +12,20 @@ package scala.collection; -/** This trait defines the interface of collections that do not contain - * duplicate elements. Trait <code>Set</code> may only be used for +/** This class defines the interface of collections that do not contain + * duplicate elements. Class <code>Set</code> may only be used for * accessing elements from set implementations. Two different extensions - * of trait <code>Set</code> in the package <code>scala.collections.mutable</code> + * of class <code>Set</code> in the package <code>scala.collections.mutable</code> * and <code>scala.collections.immutable</code> provide functionality for - * adding new elements to a set. The trait in the first package is implemented - * by sets the are modified destructively, whereas the trait in the second + * adding new elements to a set. The class in the first package is implemented + * by sets the are modified destructively, whereas the class in the second * package is used by functional set implementations that rely on immutable * data structures. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait Set[A] extends AnyRef with Function1[A, Boolean] with Iterable[A] { +mixin class Set[A] extends AnyRef with Function1[A, Boolean] with Iterable[A] { /** Returns the number of elements in this set. * diff --git a/src/library/scala/collection/SetProxy.scala b/src/library/scala/collection/SetProxy.scala index 5b0517551a..d4ce6a3d9d 100644 --- a/src/library/scala/collection/SetProxy.scala +++ b/src/library/scala/collection/SetProxy.scala @@ -19,7 +19,7 @@ package scala.collection; * @author Matthias Zenger * @version 1.0, 21/07/2003 */ -trait SetProxy[A] extends Set[A] with IterableProxy[A] { +mixin class SetProxy[A] extends Set[A] with IterableProxy[A] { def self: Set[A]; diff --git a/src/library/scala/collection/immutable/Map.scala b/src/library/scala/collection/immutable/Map.scala index 64f9fd2641..f98f5666c0 100644 --- a/src/library/scala/collection/immutable/Map.scala +++ b/src/library/scala/collection/immutable/Map.scala @@ -12,9 +12,9 @@ package scala.collection.immutable; -/** This trait extends the Map interface of collections that unambiguously map +/** This class extends the Map interface of collections that unambiguously map * keys to values (i.e. a key is mapped to at least one value). - * This trait defines the interface for functional map implementations + * This class defines the interface for functional map implementations * relying on immutable data structures. * Concrete map implementations have to provide functionality for the * abstract methods in scala.collection.Map as well as for @@ -24,7 +24,7 @@ package scala.collection.immutable; * @author Erik Stenman * @version 1.1, 22/03/2004 */ -trait Map[A, B] extends AnyRef with scala.collection.Map[A, B] { +mixin class Map[A, B] extends AnyRef with collection.Map[A, B] { /** This method returns a new map instance of the same class * mapping keys of the same type to values of type <code>C</code>. diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala index 640c7f039a..8f479d1b50 100644 --- a/src/library/scala/collection/immutable/Set.scala +++ b/src/library/scala/collection/immutable/Set.scala @@ -12,7 +12,7 @@ package scala.collection.immutable; -/** This trait represents immutable sets. Concrete set implementations +/** This class represents immutable sets. Concrete set implementations * just have to provide functionality for the abstract methods in * <code>scala.collection.Set</code> as well as for <code>+</code> and * <code>-</code>. @@ -20,7 +20,7 @@ package scala.collection.immutable; * @author Matthias Zenger * @version 1.1, 03/05/2004 */ -trait Set[A] extends AnyRef with scala.collection.Set[A] { +mixin class Set[A] extends AnyRef with collection.Set[A] { /** This method creates a new set with an additional element. */ diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala index 017237c73b..8f56d42447 100644 --- a/src/library/scala/collection/mutable/ArrayBuffer.scala +++ b/src/library/scala/collection/mutable/ArrayBuffer.scala @@ -14,7 +14,7 @@ package scala.collection.mutable; import Predef._; -/** An implementation of the Buffer trait using an array to +/** An implementation of the Buffer class using an array to * represent the assembled sequence internally. * * @author Matthias Zenger diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala index dcfa5daf28..4160e9ecbf 100644 --- a/src/library/scala/collection/mutable/BitSet.scala +++ b/src/library/scala/collection/mutable/BitSet.scala @@ -22,7 +22,7 @@ package scala.collection.mutable; */ [serializable] -class BitSet(initSize: Int) extends collection.BitSet with mutable.Set[Int] { +class BitSet(initSize: Int) extends collection.BitSet with Set[Int] { import scala.runtime.compat.Platform.arraycopy; diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala index babe8c60a7..f04c2dbe1e 100644 --- a/src/library/scala/collection/mutable/Buffer.scala +++ b/src/library/scala/collection/mutable/Buffer.scala @@ -23,7 +23,10 @@ import Predef._; * @version 1.1, 02/03/2004 */ [cloneable] -trait Buffer[A] extends AnyRef with Seq[A] with Scriptable[Message[Pair[Location, A]]] { +mixin class Buffer[A] extends AnyRef + with Seq[A] + with Scriptable[Message[Pair[Location, A]]] +{ /** Append a single element to this buffer and return * the identity of the buffer. diff --git a/src/library/scala/collection/mutable/BufferProxy.scala b/src/library/scala/collection/mutable/BufferProxy.scala index 762cdb1fe0..463f537841 100644 --- a/src/library/scala/collection/mutable/BufferProxy.scala +++ b/src/library/scala/collection/mutable/BufferProxy.scala @@ -19,7 +19,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 16/04/2004 */ -trait BufferProxy[A] extends Buffer[A] with Proxy { +mixin class BufferProxy[A] extends Buffer[A] with Proxy { def self: Buffer[A]; diff --git a/src/library/scala/collection/mutable/DefaultMapModel.scala b/src/library/scala/collection/mutable/DefaultMapModel.scala index 8d4d11393f..126b384aa2 100644 --- a/src/library/scala/collection/mutable/DefaultMapModel.scala +++ b/src/library/scala/collection/mutable/DefaultMapModel.scala @@ -12,14 +12,15 @@ package scala.collection.mutable; -/** This trait is used internally. It implements the mutable <code>Map</code> - * trait in terms of three functions: <code>findEntry</code>, <code>addEntry</code>, - * and <code>entries</code>. +/** This class is used internally. It implements the mutable <code>Map</code> + * class in terms of three functions: <code>findEntry</code>, + * <code>addEntry</code>, and <code>entries</code>. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait DefaultMapModel[A, B] extends AnyRef with scala.collection.mutable.Map[A, B] { +mixin class DefaultMapModel[A, B] extends AnyRef with Map[A, B] { + protected type Entry = DefaultEntry[A,B]; protected def findEntry(key: A): Option[Entry]; diff --git a/src/library/scala/collection/mutable/DoubleLinkedList.scala b/src/library/scala/collection/mutable/DoubleLinkedList.scala index fdad8582cb..4bc79652ca 100644 --- a/src/library/scala/collection/mutable/DoubleLinkedList.scala +++ b/src/library/scala/collection/mutable/DoubleLinkedList.scala @@ -20,9 +20,10 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -[serializable] -abstract class DoubleLinkedList[A, This >: AllRef <: DoubleLinkedList[A, This]] requires This - extends SingleLinkedList[A, This] { +abstract class DoubleLinkedList[A, This >: AllRef <: DoubleLinkedList[A, This]] + requires This + extends SingleLinkedList[A, This] +{ var prev: This = _; diff --git a/src/library/scala/collection/mutable/HashMap.scala b/src/library/scala/collection/mutable/HashMap.scala index db9adef9cf..8c63dd0ccb 100644 --- a/src/library/scala/collection/mutable/HashMap.scala +++ b/src/library/scala/collection/mutable/HashMap.scala @@ -18,9 +18,8 @@ package scala.collection.mutable; * @version 1.0, 08/07/2003 */ [serializable] -class HashMap[A, B] extends scala.collection.mutable.Map[A, B] - with HashTable[A] - with DefaultMapModel[A, B] { +class HashMap[A, B] extends Map[A,B] with HashTable[A] with DefaultMapModel[A,B] +{ def -=(key: A): Unit = removeEntry(key); diff --git a/src/library/scala/collection/mutable/HashSet.scala b/src/library/scala/collection/mutable/HashSet.scala index 5a2de50769..5003899c20 100644 --- a/src/library/scala/collection/mutable/HashSet.scala +++ b/src/library/scala/collection/mutable/HashSet.scala @@ -18,7 +18,7 @@ package scala.collection.mutable; * @version 1.0, 08/07/2003 */ [serializable] -class HashSet[A] extends scala.collection.mutable.Set[A] with HashTable[A] { +class HashSet[A] extends Set[A] with HashTable[A] { def contains(elem: A): Boolean = findEntry(elem) match { case None => false diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala index a53819d82b..8401cae46d 100644 --- a/src/library/scala/collection/mutable/HashTable.scala +++ b/src/library/scala/collection/mutable/HashTable.scala @@ -12,8 +12,6 @@ package scala.collection.mutable; -import Predef._; - /** This class can be used to construct data structures that are based * on hashtables. Class <code>HashTable[A]</code> implements a hashtable * that maps keys of type <code>A</code> to values of the fully abstract @@ -31,7 +29,7 @@ import Predef._; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -[_trait_] abstract class HashTable[A] extends AnyRef { +mixin class HashTable[A] extends AnyRef { /** The load factor for the hash table. */ diff --git a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala index f4a9874c6f..cd90a3e2d0 100644 --- a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala @@ -22,7 +22,7 @@ package scala.collection.mutable; * @version 1.0, 21/07/2003 */ [serializable] -class ImmutableMapAdaptor[A, B](m: scala.collection.immutable.Map[A, B]) extends Map[A, B] { +class ImmutableMapAdaptor[A, B](m: immutable.Map[A, B]) extends Map[A, B] { protected var imap = m; diff --git a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala index 847630cc6d..80db910c1c 100644 --- a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala @@ -22,7 +22,7 @@ package scala.collection.mutable; * @version 1.0, 21/07/2003 */ [serializable] -class ImmutableSetAdaptor[A](s: scala.collection.immutable.Set[A]) extends Set[A] { +class ImmutableSetAdaptor[A](s: immutable.Set[A]) extends Set[A] { protected var set = s; diff --git a/src/library/scala/collection/mutable/Location.scala b/src/library/scala/collection/mutable/Location.scala index b0d540dc8d..deaeb3f20a 100644 --- a/src/library/scala/collection/mutable/Location.scala +++ b/src/library/scala/collection/mutable/Location.scala @@ -18,7 +18,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 10/05/2004 */ -trait Location; +abstract class Location; case object NA extends Location; diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index 95ccf4ba10..0dc8bbb47a 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -12,7 +12,7 @@ package scala.collection.mutable; -/** This trait represents mutable maps. Concrete map implementations +/** This class represents mutable maps. Concrete map implementations * just have to provide functionality for the abstract methods in * <code>scala.collection.Map</code> as well as for <code>update</code>, * and <code>remove</code>. @@ -21,7 +21,10 @@ package scala.collection.mutable; * @version 1.1, 09/05/2004 */ [cloneable] -trait Map[A, B] extends AnyRef with scala.collection.Map[A, B] with Scriptable[Message[Pair[A, B]]] { +mixin class Map[A, B] extends AnyRef + with collection.Map[A, B] + with Scriptable[Message[Pair[A, B]]] +{ /** This method allows one to add a new mapping from <code>key</code> * to <code>value</code> to the map. If the map already contains a diff --git a/src/library/scala/collection/mutable/MapProxy.scala b/src/library/scala/collection/mutable/MapProxy.scala index a3631c7030..c59a983b41 100644 --- a/src/library/scala/collection/mutable/MapProxy.scala +++ b/src/library/scala/collection/mutable/MapProxy.scala @@ -19,7 +19,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 21/07/2003 */ -trait MapProxy[A, B] extends Map[A, B] with scala.collection.MapProxy[A, B] { +mixin class MapProxy[A, B] extends Map[A, B] with collection.MapProxy[A, B] { def self: Map[A, B]; diff --git a/src/library/scala/collection/mutable/Message.scala b/src/library/scala/collection/mutable/Message.scala index 92ae15e79e..f48e2d2bb4 100644 --- a/src/library/scala/collection/mutable/Message.scala +++ b/src/library/scala/collection/mutable/Message.scala @@ -12,9 +12,6 @@ package scala.collection.mutable; -import Predef._; - - /** Class <code>Message</code> represents messages that are issued by observable * collection classes whenever a data structure is changed. Class <code>Message</code> * has several subclasses for the various kinds of events: <code>Update</code> @@ -24,7 +21,7 @@ import Predef._; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait Message[+A]; +mixin class Message[+A]; /** This observable update refers to inclusion operations that add new elements * to collection classes. @@ -78,5 +75,6 @@ class Script[A] extends ArrayBuffer[Message[A]] with Message[A] { res + ")"; } - override def hashCode(): Int = error("scripts are not suitable as hash keys"); + override def hashCode(): Int = + Predef.error("scripts are not suitable as hash keys"); } diff --git a/src/library/scala/collection/mutable/MultiMap.scala b/src/library/scala/collection/mutable/MultiMap.scala index 1140d83e02..9ef34d5554 100644 --- a/src/library/scala/collection/mutable/MultiMap.scala +++ b/src/library/scala/collection/mutable/MultiMap.scala @@ -19,8 +19,8 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait MultiMap[A, B] extends scala.collection.mutable.Map[A, scala.collection.mutable.Set[B]] { - protected def makeSet: scala.collection.mutable.Set[B] = new HashSet[B]; +mixin class MultiMap[A, B] extends Map[A, Set[B]] { + protected def makeSet: Set[B] = new HashSet[B]; def add(key: A, value: B): Unit = get(key) match { case None => val set = makeSet; diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index 2c398d0111..3e46ff222f 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -19,7 +19,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -[_trait_] abstract class MutableList[A] extends Seq[A] with PartialFunction[Int, A] { +mixin class MutableList[A] extends Seq[A] with PartialFunction[Int, A] { protected var first: LinkedList[A] = null; protected var last: LinkedList[A] = null; diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala index e12f96fc82..8b977b656f 100644 --- a/src/library/scala/collection/mutable/ObservableBuffer.scala +++ b/src/library/scala/collection/mutable/ObservableBuffer.scala @@ -20,10 +20,11 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -mixin class ObservableBuffer[A, This <: ObservableBuffer[A, This]] - requires This - extends Buffer[A] - with Publisher[Message[Pair[Location, A]] with Undoable, This] { +mixin class ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This + extends Buffer[A] + with Publisher[Message[Pair[Location, A]] + with Undoable, This] +{ abstract override def +(element: A): Buffer[A] = { super.+(element); diff --git a/src/library/scala/collection/mutable/ObservableMap.scala b/src/library/scala/collection/mutable/ObservableMap.scala index 1533267ae3..2f47c2d6d3 100644 --- a/src/library/scala/collection/mutable/ObservableMap.scala +++ b/src/library/scala/collection/mutable/ObservableMap.scala @@ -20,10 +20,11 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -mixin class ObservableMap[A, B, This <: ObservableMap[A, B, This]] - requires This - extends scala.collection.mutable.Map[A, B] - with Publisher[Message[Pair[A, B]] with Undoable, This] { +mixin class ObservableMap[A, B, This <: ObservableMap[A, B, This]] requires This + extends Map[A, B] + with Publisher[Message[Pair[A, B]] + with Undoable, This] +{ abstract override def update(key: A, value: B): Unit = get(key) match { case None => super.update(key, value); diff --git a/src/library/scala/collection/mutable/ObservableSet.scala b/src/library/scala/collection/mutable/ObservableSet.scala index 7f3bf9bed6..65a1fd91e3 100644 --- a/src/library/scala/collection/mutable/ObservableSet.scala +++ b/src/library/scala/collection/mutable/ObservableSet.scala @@ -20,10 +20,11 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -mixin class ObservableSet[A, This <: ObservableSet[A, This]] - requires This - extends scala.collection.mutable.Set[A] - with Publisher[Message[A] with Undoable, This] { +mixin class ObservableSet[A, This <: ObservableSet[A, This]] requires This + extends Set[A] + with Publisher[Message[A] + with Undoable, This] +{ abstract override def +=(elem: A): Unit = if (!contains(elem)) { super.+=(elem); diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index 3dc2a5c088..fc29e9ca62 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -14,7 +14,7 @@ package scala.collection.mutable; /** This class implements priority queues using a heap. The * elements of the queue have to be ordered in terms of the - * <code>Ordered[T]</code> trait. + * <code>Ordered[T]</code> class. * * @author Matthias Zenger * @version 1.0, 03/05/2004 diff --git a/src/library/scala/collection/mutable/PriorityQueueProxy.scala b/src/library/scala/collection/mutable/PriorityQueueProxy.scala index 3e5b837f29..04340bd3b0 100644 --- a/src/library/scala/collection/mutable/PriorityQueueProxy.scala +++ b/src/library/scala/collection/mutable/PriorityQueueProxy.scala @@ -14,12 +14,14 @@ package scala.collection.mutable; /** This class implements priority queues using a heap. The * elements of the queue have to be ordered in terms of the - * <code>Ordered[T]</code> trait. + * <code>Ordered[T]</code> class. * * @author Matthias Zenger * @version 1.0, 03/05/2004 */ -abstract class PriorityQueueProxy[A <% Ordered[A]] extends PriorityQueue[A] with IterableProxy[A] { +abstract class PriorityQueueProxy[A <% Ordered[A]] extends PriorityQueue[A] + with IterableProxy[A] +{ def self: PriorityQueue[A]; diff --git a/src/library/scala/collection/mutable/QueueProxy.scala b/src/library/scala/collection/mutable/QueueProxy.scala index 0b927cd5e1..705094d954 100644 --- a/src/library/scala/collection/mutable/QueueProxy.scala +++ b/src/library/scala/collection/mutable/QueueProxy.scala @@ -18,7 +18,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.1, 03/05/2004 */ -trait QueueProxy[A] extends Queue[A] with SeqProxy[A] { +mixin class QueueProxy[A] extends Queue[A] with SeqProxy[A] { def self: Queue[A]; diff --git a/src/library/scala/collection/mutable/ResizableArray.scala b/src/library/scala/collection/mutable/ResizableArray.scala index b846280935..dd211d87b0 100644 --- a/src/library/scala/collection/mutable/ResizableArray.scala +++ b/src/library/scala/collection/mutable/ResizableArray.scala @@ -18,8 +18,7 @@ package scala.collection.mutable; * @author Matthias Zenger, Burak Emir * @version 1.0, 03/05/2004 */ -[serializable] -[_trait_] abstract class ResizableArray[A] extends AnyRef with Iterable[A] { +mixin class ResizableArray[A] extends AnyRef with Iterable[A] { import scala.runtime.compat.Platform.arraycopy; protected val initialSize: Int = 16; diff --git a/src/library/scala/collection/mutable/Scriptable.scala b/src/library/scala/collection/mutable/Scriptable.scala index e09be20bc8..32065f978d 100644 --- a/src/library/scala/collection/mutable/Scriptable.scala +++ b/src/library/scala/collection/mutable/Scriptable.scala @@ -12,13 +12,13 @@ package scala.collection.mutable; -/** Classes that implement the <code>Scriptable</code> trait allow +/** Classes that mix in the <code>Scriptable</code> class allow * messages to be sent to objects of that class. * * @author Matthias Zenger * @version 1.0, 09/05/2004 */ -trait Scriptable[A] { +mixin class Scriptable[A] { /** Send a message to this scriptable object. */ diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala index d3a4de9bbc..18375bd619 100644 --- a/src/library/scala/collection/mutable/Set.scala +++ b/src/library/scala/collection/mutable/Set.scala @@ -12,7 +12,7 @@ package scala.collection.mutable; -/** This trait represents mutable sets. Concrete set implementations +/** This class represents mutable sets. Concrete set implementations * just have to provide functionality for the abstract methods in * <code>scala.collection.Set</code> as well as for <code>add</code>, * <code>remove</code>, and <code>clear</code>. @@ -21,7 +21,9 @@ package scala.collection.mutable; * @version 1.1, 09/05/2004 */ [cloneable] -trait Set[A] extends AnyRef with scala.collection.Set[A] with Scriptable[Message[A]] { +mixin class Set[A] extends AnyRef with collection.Set[A] + with Scriptable[Message[A]] +{ /** This method allows one to add or remove an element <code>elem</code> * from this set depending on the value of parameter <code>included</code>. diff --git a/src/library/scala/collection/mutable/SetProxy.scala b/src/library/scala/collection/mutable/SetProxy.scala index a4888f0d17..ef0c0a6f43 100644 --- a/src/library/scala/collection/mutable/SetProxy.scala +++ b/src/library/scala/collection/mutable/SetProxy.scala @@ -19,7 +19,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.1, 09/05/2004 */ -trait SetProxy[A] extends Set[A] with scala.collection.SetProxy[A] { +mixin class SetProxy[A] extends Set[A] with collection.SetProxy[A] { def self: Set[A]; diff --git a/src/library/scala/collection/mutable/SingleLinkedList.scala b/src/library/scala/collection/mutable/SingleLinkedList.scala index 1ba3ad2c9f..67151cb29e 100644 --- a/src/library/scala/collection/mutable/SingleLinkedList.scala +++ b/src/library/scala/collection/mutable/SingleLinkedList.scala @@ -22,8 +22,9 @@ package scala.collection.mutable; */ [serializable] abstract class SingleLinkedList[A, This >: AllRef <: SingleLinkedList[A, This]] - requires This - extends AnyRef with Seq[A] { + requires This + extends AnyRef with Seq[A] +{ var elem: A = _; diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index 10fd038887..2f8c2fc836 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -18,7 +18,7 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 10/05/2004 */ -trait StackProxy[A] extends Stack[A] with SeqProxy[A] { +mixin class StackProxy[A] extends Stack[A] with SeqProxy[A] { def self: Stack[A]; diff --git a/src/library/scala/collection/mutable/Subscriber.scala b/src/library/scala/collection/mutable/Subscriber.scala index 8cd7e0af05..7f50543d7a 100644 --- a/src/library/scala/collection/mutable/Subscriber.scala +++ b/src/library/scala/collection/mutable/Subscriber.scala @@ -19,6 +19,6 @@ package scala.collection.mutable; * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait Subscriber[-A, -B] { +mixin class Subscriber[-A, -B] { def notify(pub: B, event: A): Unit; } diff --git a/src/library/scala/collection/mutable/SynchronizedBuffer.scala b/src/library/scala/collection/mutable/SynchronizedBuffer.scala index 5ea6eba670..5c41720732 100644 --- a/src/library/scala/collection/mutable/SynchronizedBuffer.scala +++ b/src/library/scala/collection/mutable/SynchronizedBuffer.scala @@ -12,13 +12,13 @@ package scala.collection.mutable; -/** This trait should be used as a mixin. It synchronizes the <code>Buffer</code> +/** This class should be used as a mixin. It synchronizes the <code>Buffer</code> * methods of the class into which it is mixed in. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait SynchronizedBuffer[A] extends Buffer[A] { +mixin class SynchronizedBuffer[A] extends Buffer[A] { abstract override def length: Int = synchronized { super.length; diff --git a/src/library/scala/collection/mutable/SynchronizedMap.scala b/src/library/scala/collection/mutable/SynchronizedMap.scala index 42ca258577..855cd0850c 100644 --- a/src/library/scala/collection/mutable/SynchronizedMap.scala +++ b/src/library/scala/collection/mutable/SynchronizedMap.scala @@ -12,13 +12,13 @@ package scala.collection.mutable; -/** This trait should be used as a mixin. It synchronizes the <code>Map</code> +/** This class should be used as a mixin. It synchronizes the <code>Map</code> * functions of the class into which it is mixed in. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait SynchronizedMap[A, B] extends scala.collection.mutable.Map[A, B] { +mixin class SynchronizedMap[A, B] extends Map[A, B] { abstract override def size: Int = synchronized { super.size; diff --git a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala index ad229d7df5..361cb7f38c 100644 --- a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala +++ b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala @@ -14,7 +14,7 @@ package scala.collection.mutable; /** This class implements synchronized priority queues using a heap. * The elements of the queue have to be ordered in terms of the - * <code>Ordered[T]</code> trait. + * <code>Ordered[T]</code> class. * * @author Matthias Zenger * @version 1.0, 03/05/2004 diff --git a/src/library/scala/collection/mutable/SynchronizedSet.scala b/src/library/scala/collection/mutable/SynchronizedSet.scala index ed741d67c1..a6df3a7edb 100644 --- a/src/library/scala/collection/mutable/SynchronizedSet.scala +++ b/src/library/scala/collection/mutable/SynchronizedSet.scala @@ -12,13 +12,13 @@ package scala.collection.mutable; -/** This trait should be used as a mixin. It synchronizes the <code>Set</code> +/** This class should be used as a mixin. It synchronizes the <code>Set</code> * functions of the class into which it is mixed in. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait SynchronizedSet[A] extends scala.collection.mutable.Set[A] { +mixin class SynchronizedSet[A] extends Set[A] { abstract override def size: Int = synchronized { super.size diff --git a/src/library/scala/collection/mutable/Undoable.scala b/src/library/scala/collection/mutable/Undoable.scala index 200898f69a..428d8086dd 100644 --- a/src/library/scala/collection/mutable/Undoable.scala +++ b/src/library/scala/collection/mutable/Undoable.scala @@ -12,13 +12,13 @@ package scala.collection.mutable; -/** Classes that implement the <code>Undoable</code> trait provide an operation +/** Classes that mix in the <code>Undoable</code> class provide an operation * <code>undo</code> which can be used to undo the last operation. * * @author Matthias Zenger * @version 1.0, 08/07/2003 */ -trait Undoable { +mixin class Undoable { /** Undo the last operation. */ diff --git a/src/library/scala/concurrent/MailBox.scala b/src/library/scala/concurrent/MailBox.scala index 4162d34fc3..e23d6adf4a 100644 --- a/src/library/scala/concurrent/MailBox.scala +++ b/src/library/scala/concurrent/MailBox.scala @@ -102,7 +102,7 @@ class MailBox extends AnyRef with ListQueueCreator { /** * Module for dealing with queues. */ -trait QueueModule[a] { +mixin class QueueModule[a] { /** Type of queues. */ type t; /** Create an empty queue. */ @@ -114,7 +114,7 @@ trait QueueModule[a] { } /** Inefficient but simple queue module creator. */ -trait ListQueueCreator { +mixin class ListQueueCreator { def queueCreate[a]: QueueModule[a] = new QueueModule[a] { type t = List[a]; def make: t = Nil; @@ -135,7 +135,7 @@ trait ListQueueCreator { } /** Efficient queue module creator based on linked lists. */ -trait LinkedListQueueCreator { +mixin class LinkedListQueueCreator { import scala.collection.mutable.LinkedList; def queueCreate[a >: AllRef <: AnyRef]: QueueModule[a] = new QueueModule[a] { type t = Pair[LinkedList[a], LinkedList[a]]; // fst = the list, snd = last elem diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala index f55d3ab7e6..4e334b6e13 100644 --- a/src/library/scala/concurrent/pilib.scala +++ b/src/library/scala/concurrent/pilib.scala @@ -33,7 +33,7 @@ object pilib { * Run several processes in parallel using the following syntax: * spawn < p_1 | ... | p_n > */ - trait Spawn { + abstract class Spawn { def <(p: => unit): Spawn def |(p: => unit): Spawn def > : unit diff --git a/src/library/scala/reflect/Symbol.scala b/src/library/scala/reflect/Symbol.scala index ad8aa4a218..17ea0bf14c 100644 --- a/src/library/scala/reflect/Symbol.scala +++ b/src/library/scala/reflect/Symbol.scala @@ -12,8 +12,6 @@ package scala.reflect; -import scala.Predef._; - abstract class Symbol { val owner: Symbol; val name: String; diff --git a/src/library/scala/reflect/Type.scala b/src/library/scala/reflect/Type.scala index 3518f1334b..db757844e7 100644 --- a/src/library/scala/reflect/Type.scala +++ b/src/library/scala/reflect/Type.scala @@ -12,7 +12,7 @@ package scala.reflect; -import Predef._; +import Predef.Pair; abstract class Type; diff --git a/src/library/scala/runtime/BoxedObjectArray.scala b/src/library/scala/runtime/BoxedObjectArray.scala index 91f1fce5a2..864108b5b1 100644 --- a/src/library/scala/runtime/BoxedObjectArray.scala +++ b/src/library/scala/runtime/BoxedObjectArray.scala @@ -12,6 +12,7 @@ package scala.runtime; +[serializable] final class BoxedObjectArray(val value: Array[Object]) extends BoxedArray { def length: Int = value.length; diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index b8d4a30edf..4c5236dd32 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -26,7 +26,7 @@ object ScalaRunTime { def isValueTag(tag: String) = tag.charAt(0) == '.' - trait Try[a] { + abstract class Try[a] { def Catch[b >: a](handler: PartialFunction[Throwable, b]): b; def Finally(handler: Unit): a; } diff --git a/src/library/scala/runtime/matching/TestAlphabet.scala b/src/library/scala/runtime/matching/TestAlphabet.scala index 9ef4698ebc..41675f3909 100644 --- a/src/library/scala/runtime/matching/TestAlphabet.scala +++ b/src/library/scala/runtime/matching/TestAlphabet.scala @@ -1,6 +1,6 @@ package scala.runtime.matching ; -trait TestAlphabet; +abstract class TestAlphabet; case class TestLabel(i: Int) extends TestAlphabet ; diff --git a/src/library/scala/testing/Benchmark.scala b/src/library/scala/testing/Benchmark.scala index 2db1954a0c..3a2af55010 100644 --- a/src/library/scala/testing/Benchmark.scala +++ b/src/library/scala/testing/Benchmark.scala @@ -30,7 +30,7 @@ package scala.testing; * This will run the benchmark 5 times and log the execution times in * a file called times.log */ -trait Benchmark { +mixin class Benchmark { /** this method should be implemented by the concrete benchmark */ def run: Unit; diff --git a/src/library/scala/testing/SUnit.scala b/src/library/scala/testing/SUnit.scala index bb2035636a..78df86ee13 100644 --- a/src/library/scala/testing/SUnit.scala +++ b/src/library/scala/testing/SUnit.scala @@ -39,7 +39,7 @@ package scala.testing; object SUnit { /** a Test can be run with its result being collected */ - trait Test { + mixin class Test { def run(r: TestResult):Unit; } @@ -131,8 +131,8 @@ object SUnit { "failed assertion:"+msg; } - /** this trait defined useful assert methods */ - trait Assert { + /** this class defined useful assert methods */ + mixin class Assert { /** equality */ def assertEquals[A](msg:String, expected:A, actual: => A): Unit = if( expected != actual ) fail(msg); diff --git a/src/library/scala/util/automata/Inclusion.scala b/src/library/scala/util/automata/Inclusion.scala index 4b155c7f06..d7d6a039fc 100644 --- a/src/library/scala/util/automata/Inclusion.scala +++ b/src/library/scala/util/automata/Inclusion.scala @@ -4,7 +4,7 @@ package scala.util.automata ; * inspired by the AMoRE automata library * @author Burak */ -trait Inclusion[A <: AnyRef] { +mixin class Inclusion[A <: AnyRef] { val labels: Seq[A]; diff --git a/src/library/scala/util/logging/ConsoleLogger.scala b/src/library/scala/util/logging/ConsoleLogger.scala index fabfa7a698..4219630495 100644 --- a/src/library/scala/util/logging/ConsoleLogger.scala +++ b/src/library/scala/util/logging/ConsoleLogger.scala @@ -3,9 +3,9 @@ package scala.util.logging; /** * A ConsoleLogger is mixed into a concrete class who has class Logged - * among its base traits. + * among its base classes. */ -trait ConsoleLogger { +mixin class ConsoleLogger { /** logs argument to Console using Console.println */ def log(msg:String): Unit = Console.println(msg); diff --git a/src/library/scala/util/logging/Logged.scala b/src/library/scala/util/logging/Logged.scala index a19429c1f6..0bd969665f 100644 --- a/src/library/scala/util/logging/Logged.scala +++ b/src/library/scala/util/logging/Logged.scala @@ -3,7 +3,7 @@ package scala.util.logging; /** - * Mixing in the trait Logged indicates that a class provides support + * Mixing in the class Logged indicates that a class provides support * for logging. For instance, a developer of a library writes * <code> class MyClass with Logged { ... do stuff, call log } @@ -15,7 +15,7 @@ package scala.util.logging; </code> * and the logging will be sent to the Console. */ -trait Logged { +mixin class Logged { /** this method should log the message given as argument somewhere * as a side-effect */ diff --git a/src/library/scala/util/parsing/Parsers.scala b/src/library/scala/util/parsing/Parsers.scala index e0064f12e5..6d743045e3 100644 --- a/src/library/scala/util/parsing/Parsers.scala +++ b/src/library/scala/util/parsing/Parsers.scala @@ -4,7 +4,7 @@ abstract class Parsers { type inputType; - trait Parser[a] { + abstract class Parser[a] { type Result = Option[Pair[a, inputType]]; diff --git a/src/library/scala/util/regexp/Base.scala b/src/library/scala/util/regexp/Base.scala index cfdaaac10f..5dce70e248 100644 --- a/src/library/scala/util/regexp/Base.scala +++ b/src/library/scala/util/regexp/Base.scala @@ -4,7 +4,7 @@ package scala.util.regexp ; /** basic regular expressions */ -trait Base { +abstract class Base { type _regexpT <: RegExp; diff --git a/src/library/scala/util/regexp/PointedHedgeExp.scala b/src/library/scala/util/regexp/PointedHedgeExp.scala index 27da6338db..4f9f589271 100644 --- a/src/library/scala/util/regexp/PointedHedgeExp.scala +++ b/src/library/scala/util/regexp/PointedHedgeExp.scala @@ -5,7 +5,7 @@ package scala.util.regexp ; /** pointed regular hedge expressions, a useful subclass of * regular hedge expressions. */ -trait PointedHedgeExp extends Base { +abstract class PointedHedgeExp extends Base { type _regexpT <: RegExp; type _labelT; diff --git a/src/library/scala/util/regexp/WordExp.scala b/src/library/scala/util/regexp/WordExp.scala index 63817e0151..b9d0c8c06c 100644 --- a/src/library/scala/util/regexp/WordExp.scala +++ b/src/library/scala/util/regexp/WordExp.scala @@ -4,9 +4,9 @@ package scala.util.regexp ; /** regular word expressions. */ -trait WordExp extends Base { +abstract class WordExp extends Base { - trait Label; + abstract class Label; type _regexpT <: RegExp ; type _labelT <: Label; diff --git a/src/library/scala/xml/Elem.scala b/src/library/scala/xml/Elem.scala index 6a6d70d1e6..237f941eb8 100644 --- a/src/library/scala/xml/Elem.scala +++ b/src/library/scala/xml/Elem.scala @@ -12,7 +12,7 @@ package scala.xml; import scala.collection.mutable.ArrayBuffer; -/** The case class <code>Elem</code> implements the Node trait, +/** The case class <code>Elem</code> extends the Node class, * providing an immutable data object representing an XML element. * * @param prefix (may be null) diff --git a/src/library/scala/xml/NamespaceBinding.scala b/src/library/scala/xml/NamespaceBinding.scala index 3ad7c49957..22425b37f4 100644 --- a/src/library/scala/xml/NamespaceBinding.scala +++ b/src/library/scala/xml/NamespaceBinding.scala @@ -10,7 +10,6 @@ package scala.xml; -import Predef._; /** The class <code>NamespaceBinding</code> represents namespace bindings * and scopes. The binding for the default namespace is treated as a null @@ -28,7 +27,7 @@ class NamespaceBinding(val prefix: String, private val serialVersionUID = 0 - 2518644165573446725L; if (null != prefix && 0 == prefix.length()) - error("zero length prefix not allowed"); + Predef.error("zero length prefix not allowed"); def getURI(_prefix: String): String = if (prefix == _prefix) uri else parent.getURI(_prefix); diff --git a/src/library/scala/xml/NodeTraverser.scala b/src/library/scala/xml/NodeTraverser.scala index 690c85534d..9aaba81d92 100644 --- a/src/library/scala/xml/NodeTraverser.scala +++ b/src/library/scala/xml/NodeTraverser.scala @@ -12,7 +12,7 @@ package scala.xml; import parsing.MarkupHandler; -trait NodeTraverser extends MarkupHandler { +abstract class NodeTraverser extends MarkupHandler { def traverse(n: Node): Unit = n match { case x:ProcInstr => procInstr(0, x.target, x.text) diff --git a/src/library/scala/xml/TypeSymbol.scala b/src/library/scala/xml/TypeSymbol.scala index 1d5fba7ae6..e0a3fab6cb 100644 --- a/src/library/scala/xml/TypeSymbol.scala +++ b/src/library/scala/xml/TypeSymbol.scala @@ -8,4 +8,8 @@ // $id: $ -package scala.xml; trait TypeSymbol {} + +package scala.xml; + + +abstract class TypeSymbol; diff --git a/src/library/scala/xml/dtd/DtdTypeSymbol.scala b/src/library/scala/xml/dtd/DtdTypeSymbol.scala index 633e11e646..a543c937c5 100644 --- a/src/library/scala/xml/dtd/DtdTypeSymbol.scala +++ b/src/library/scala/xml/dtd/DtdTypeSymbol.scala @@ -1 +1,3 @@ -package scala.xml.dtd; trait DtdTypeSymbol {} +package scala.xml.dtd; + +mixin class DtdTypeSymbol; diff --git a/src/library/scala/xml/factory/NodeFactory.scala b/src/library/scala/xml/factory/NodeFactory.scala index 7564659c1a..2f9093d0df 100644 --- a/src/library/scala/xml/factory/NodeFactory.scala +++ b/src/library/scala/xml/factory/NodeFactory.scala @@ -12,7 +12,7 @@ package scala.xml.factory; import scala.collection.Map ; import scala.collection.mutable ; -[_trait_] abstract class NodeFactory[A <: Node] { +mixin class NodeFactory[A <: Node] { val ignoreComments = false; val ignoreProcInstr = false; diff --git a/src/library/scala/xml/parsing/TokenTests.scala b/src/library/scala/xml/parsing/TokenTests.scala index 86560fc12f..c7ba1f8d1b 100644 --- a/src/library/scala/xml/parsing/TokenTests.scala +++ b/src/library/scala/xml/parsing/TokenTests.scala @@ -12,7 +12,7 @@ package scala.xml.parsing; /** * Helper functions for parsing XML fragments */ -trait TokenTests { +mixin class TokenTests { /** (#x20 | #x9 | #xD | #xA) */ final def isSpace( ch:Char ):Boolean = ch match { diff --git a/src/library/scala/xml/transform/BasicTransformer.scala b/src/library/scala/xml/transform/BasicTransformer.scala index 56bbc16201..437f4f1913 100644 --- a/src/library/scala/xml/transform/BasicTransformer.scala +++ b/src/library/scala/xml/transform/BasicTransformer.scala @@ -1,7 +1,7 @@ package scala.xml.transform ; -/** a trait for XML transformations */ -trait BasicTransformer extends Function1[Node,Node] { +/** a class for XML transformations */ +abstract class BasicTransformer extends Function1[Node,Node] { protected case class NeedsCopy(result:Seq[Node]) extends java.lang.Throwable; diff --git a/src/library/scala/xml/xsd/XsTypeSymbol.scala b/src/library/scala/xml/xsd/XsTypeSymbol.scala index b553ad9f29..a24eb8ad1c 100644 --- a/src/library/scala/xml/xsd/XsTypeSymbol.scala +++ b/src/library/scala/xml/xsd/XsTypeSymbol.scala @@ -8,9 +8,11 @@ // $id: $ + package scala.xml.xsd; -trait XsTypeSymbol extends scala.xml.TypeSymbol ; + +abstract class XsTypeSymbol extends xml.TypeSymbol; object xsdAny extends XsTypeSymbol ; @@ -22,7 +24,7 @@ class ComplexTypeSymbol(val name: String) extends XsTypeSymbol { var decl: ComplexTypeDecl = null; } -trait DerivSym; +abstract class DerivSym; case class Extends(sym:XsTypeSymbol) extends DerivSym; |