summaryrefslogtreecommitdiff
path: root/src/library/scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2009-09-08 16:24:42 +0000
committermichelou <michelou@epfl.ch>2009-09-08 16:24:42 +0000
commitb06d4eb4ec8921a1d4935bf83ee8ba9c0ad08d18 (patch)
tree57c46bf4138486eb3c944fe4bc212d8e635dfa50 /src/library/scala
parent2619f09ad0a5fc8900fcacc4d704a55b255f52e7 (diff)
downloadscala-b06d4eb4ec8921a1d4935bf83ee8ba9c0ad08d18.tar.gz
scala-b06d4eb4ec8921a1d4935bf83ee8ba9c0ad08d18.tar.bz2
scala-b06d4eb4ec8921a1d4935bf83ee8ba9c0ad08d18.zip
added a few @serializable annotations, added @S...
added a few @serializable annotations, added @SerialVersionUID to anonfuns, several cleanups
Diffstat (limited to 'src/library/scala')
-rw-r--r--src/library/scala/Enumeration.scala6
-rw-r--r--src/library/scala/Ordering.scala310
-rw-r--r--src/library/scala/collection/LinearSequence.scala3
-rw-r--r--src/library/scala/collection/generic/LinearSequenceTemplate.scala6
-rw-r--r--src/library/scala/collection/generic/SequenceFactory.scala2
-rw-r--r--src/library/scala/collection/immutable/BitSet.scala6
-rw-r--r--src/library/scala/collection/immutable/Vector.scala2
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala21
-rw-r--r--src/library/scala/collection/mutable/LinearSequence.scala13
-rw-r--r--src/library/scala/collection/mutable/MutableList.scala19
-rw-r--r--src/library/scala/collection/mutable/Queue.scala8
-rw-r--r--src/library/scala/collection/mutable/Vector.scala4
12 files changed, 217 insertions, 183 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index e49a09b96d..3c2cb67094 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -64,11 +64,13 @@ abstract class Enumeration(initial: Int, names: String*) {
/** The name of this enumeration.
*/
override def toString = {
- var string = this.getClass.getName
+ val name = this.getClass.getName
+ var string =
+ if (name endsWith "$") name.substring(0, name.length - 1) else name
val idx1 = string.lastIndexOf('.' : Int)
if (idx1 != -1) string = string.substring(idx1 + 1)
val idx2 = string.indexOf('$')
- if (idx2 != -1) string = string.substring(0, idx2)
+ if (idx2 != -1) string = string.substring(idx2 + 1)
string
}
diff --git a/src/library/scala/Ordering.scala b/src/library/scala/Ordering.scala
index 97ba58e37e..906a1dba81 100644
--- a/src/library/scala/Ordering.scala
+++ b/src/library/scala/Ordering.scala
@@ -40,7 +40,7 @@ import java.util.Comparator
* @version 0.9.5, 2008-04-15
* @since 2.7
*/
-
+@serializable
trait Ordering[T] extends Comparator[T] with PartialOrdering[T] {
outer =>
@@ -86,9 +86,9 @@ trait Ordering[T] extends Comparator[T] with PartialOrdering[T] {
/** Returns the argument which comes earlier in the ordering. */
def min(x: T, y: T): T = if (lteq(x, y)) x else y
- override def reverse : Ordering[T] = new Ordering[T]{
- override def reverse = outer;
- def compare(x : T, y : T) = outer.compare(y, x);
+ override def reverse: Ordering[T] = new Ordering[T]{
+ override def reverse = outer
+ def compare(x: T, y: T) = outer.compare(y, x)
}
class Ops(lhs: T) {
@@ -103,260 +103,260 @@ trait Ordering[T] extends Comparator[T] with PartialOrdering[T] {
implicit def mkOrderingOps(lhs: T): Ops = new Ops(lhs)
}
-object Ordering
-{
+object Ordering {
+
def apply[T](implicit ord : Ordering[T]) = ord
def fromLessThan[T](cmp: (T, T) => Boolean): Ordering[T] = new Ordering[T] {
def compare(x: T, y: T) = if (cmp(x, y)) -1 else if (cmp(y, x)) 1 else 0
}
- def ordered[A <: Ordered[A]] : Ordering[A] = new Ordering[A] {
- def compare(x : A, y : A) = x.compare(y);
+ def ordered[A <: Ordered[A]]: Ordering[A] = new Ordering[A] {
+ def compare(x: A, y: A) = x.compare(y)
}
trait UnitOrdering extends Ordering[Unit] {
- def compare(x : Unit, y : Unit) = 0;
+ def compare(x: Unit, y: Unit) = 0
}
implicit object Unit extends UnitOrdering
trait BooleanOrdering extends Ordering[Boolean] {
- def compare(x : Boolean, y : Boolean) = (x, y) match {
- case (false, true) => -1;
- case (true, false) => 1;
- case _ => 0;
+ def compare(x: Boolean, y: Boolean) = (x, y) match {
+ case (false, true) => -1
+ case (true, false) => 1
+ case _ => 0
}
}
implicit object Boolean extends BooleanOrdering
trait ByteOrdering extends Ordering[Byte] {
- def compare(x : Byte, y : Byte) = x.toInt - y.toInt;
+ def compare(x: Byte, y: Byte) = x.toInt - y.toInt
}
implicit object Byte extends ByteOrdering
trait CharOrdering extends Ordering[Char] {
- def compare(x : Char, y : Char) = x.toInt - y.toInt;
+ def compare(x: Char, y: Char) = x.toInt - y.toInt
}
implicit object Char extends CharOrdering
trait ShortOrdering extends Ordering[Short] {
- def compare(x : Short, y : Short) = x.toInt - y.toInt;
+ def compare(x: Short, y: Short) = x.toInt - y.toInt
}
implicit object Short extends ShortOrdering
trait IntOrdering extends Ordering[Int] {
- def compare(x : Int, y : Int) =
- if(x < y) -1;
- else if (x == y) 0;
+ def compare(x: Int, y: Int) =
+ if (x < y) -1
+ else if (x == y) 0
else 1
}
implicit object Int extends IntOrdering
trait LongOrdering extends Ordering[Long] {
- def compare(x : Long, y : Long) =
- if(x < y) -1;
- else if (x == y) 0;
+ def compare(x: Long, y: Long) =
+ if (x < y) -1
+ else if (x == y) 0
else 1
}
implicit object Long extends LongOrdering
trait FloatOrdering extends Ordering[Float] {
- def compare(x : Float, y : Float) =
- if(x < y) -1;
- else if (x == y) 0;
+ def compare(x: Float, y: Float) =
+ if (x < y) -1
+ else if (x == y) 0
else 1
}
implicit object Float extends FloatOrdering
trait DoubleOrdering extends Ordering[Double] {
- def compare(x : Double, y : Double) =
- if(x < y) -1;
- else if (x == y) 0;
+ def compare(x: Double, y: Double) =
+ if (x < y) -1
+ else if (x == y) 0
else 1
}
implicit object Double extends DoubleOrdering
trait BigIntOrdering extends Ordering[BigInt] {
- def compare(x : BigInt, y : BigInt) = x.compare(y);
+ def compare(x: BigInt, y: BigInt) = x.compare(y)
}
implicit object BigInt extends BigIntOrdering
trait BigDecimalOrdering extends Ordering[BigDecimal] {
- def compare(x : BigDecimal, y : BigDecimal) = x.compare(y);
+ def compare(x: BigDecimal, y: BigDecimal) = x.compare(y)
}
implicit object BigDecimal extends BigDecimalOrdering
trait StringOrdering extends Ordering[String] {
- def compare(x : String, y : String) = x.compareTo(y);
+ def compare(x: String, y: String) = x.compareTo(y)
}
implicit object String extends StringOrdering
- implicit def Option[T](implicit ord : Ordering[T]) : Ordering[Option[T]] =
+ implicit def Option[T](implicit ord: Ordering[T]) : Ordering[Option[T]] =
new Ordering[Option[T]] {
def compare(x : Option[T], y : Option[T]) = (x, y) match {
- case (None, None) => 0;
- case (None, _) => -1;
+ case (None, None) => 0
+ case (None, _) => -1
case (_, None) => 1
- case (Some(x), Some(y)) => ord.compare(x, y);
+ case (Some(x), Some(y)) => ord.compare(x, y)
}
}
- implicit def Iterable[T](implicit ord : Ordering[T]) : Ordering[Iterable[T]] =
+ implicit def Iterable[T](implicit ord: Ordering[T]): Ordering[Iterable[T]] =
new Ordering[Iterable[T]] {
- def compare(x : Iterable[T], y : Iterable[T]) : Int = {
- val xe = x.iterator;
- val ye = y.iterator;
+ def compare(x: Iterable[T], y: Iterable[T]): Int = {
+ val xe = x.iterator
+ val ye = y.iterator
- while (xe.hasNext && ye.hasNext){
- val res = ord.compare(xe.next, ye.next);
- if (res != 0) return res;
+ while (xe.hasNext && ye.hasNext) {
+ val res = ord.compare(xe.next, ye.next)
+ if (res != 0) return res
}
- Boolean.compare(xe.hasNext, ye.hasNext);
+ Boolean.compare(xe.hasNext, ye.hasNext)
}
}
- implicit def Tuple2[T1, T2](implicit ord1 : Ordering[T1], ord2 : Ordering[T2]) : Ordering[(T1, T2)] =
+ implicit def Tuple2[T1, T2](implicit ord1: Ordering[T1], ord2: Ordering[T2]): Ordering[(T1, T2)] =
new Ordering[(T1, T2)]{
- def compare(x : Tuple2[T1, T2], y : Tuple2[T1, T2]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- 0;
+ def compare(x: (T1, T2), y: (T1, T2)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ 0
}
}
- implicit def Tuple3[T1, T2, T3](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3]) : Ordering[(T1, T2, T3)] =
+ implicit def Tuple3[T1, T2, T3](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3]) : Ordering[(T1, T2, T3)] =
new Ordering[(T1, T2, T3)]{
- def compare(x : Tuple3[T1, T2, T3], y : Tuple3[T1, T2, T3]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- 0;
+ def compare(x: (T1, T2, T3), y: (T1, T2, T3)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ 0
}
}
- implicit def Tuple4[T1, T2, T3, T4](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4]) : Ordering[(T1, T2, T3, T4)] =
+ implicit def Tuple4[T1, T2, T3, T4](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4]) : Ordering[(T1, T2, T3, T4)] =
new Ordering[(T1, T2, T3, T4)]{
- def compare(x : Tuple4[T1, T2, T3, T4], y : Tuple4[T1, T2, T3, T4]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- 0;
+ def compare(x: (T1, T2, T3, T4), y: (T1, T2, T3, T4)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ 0
}
}
- implicit def Tuple5[T1, T2, T3, T4, T5](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4], ord5 : Ordering[T5]) : Ordering[(T1, T2, T3, T4, T5)] =
+ implicit def Tuple5[T1, T2, T3, T4, T5](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4], ord5: Ordering[T5]): Ordering[(T1, T2, T3, T4, T5)] =
new Ordering[(T1, T2, T3, T4, T5)]{
- def compare(x : Tuple5[T1, T2, T3, T4, T5], y : Tuple5[T1, T2, T3, T4, T5]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- val compare5 = ord5.compare(x._5, y._5);
- if (compare5 != 0) return compare5;
- 0;
+ def compare(x: (T1, T2, T3, T4, T5), y: Tuple5[T1, T2, T3, T4, T5]): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ val compare5 = ord5.compare(x._5, y._5)
+ if (compare5 != 0) return compare5
+ 0
}
}
- implicit def Tuple6[T1, T2, T3, T4, T5, T6](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4], ord5 : Ordering[T5], ord6 : Ordering[T6]) : Ordering[(T1, T2, T3, T4, T5, T6)] =
+ implicit def Tuple6[T1, T2, T3, T4, T5, T6](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4], ord5: Ordering[T5], ord6: Ordering[T6]): Ordering[(T1, T2, T3, T4, T5, T6)] =
new Ordering[(T1, T2, T3, T4, T5, T6)]{
- def compare(x : Tuple6[T1, T2, T3, T4, T5, T6], y : Tuple6[T1, T2, T3, T4, T5, T6]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- val compare5 = ord5.compare(x._5, y._5);
- if (compare5 != 0) return compare5;
- val compare6 = ord6.compare(x._6, y._6);
- if (compare6 != 0) return compare6;
- 0;
+ def compare(x: (T1, T2, T3, T4, T5, T6), y: (T1, T2, T3, T4, T5, T6)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ val compare5 = ord5.compare(x._5, y._5)
+ if (compare5 != 0) return compare5
+ val compare6 = ord6.compare(x._6, y._6)
+ if (compare6 != 0) return compare6
+ 0
}
}
- implicit def Tuple7[T1, T2, T3, T4, T5, T6, T7](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4], ord5 : Ordering[T5], ord6 : Ordering[T6], ord7 : Ordering[T7]) : Ordering[(T1, T2, T3, T4, T5, T6, T7)] =
+ implicit def Tuple7[T1, T2, T3, T4, T5, T6, T7](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4], ord5: Ordering[T5], ord6: Ordering[T6], ord7: Ordering[T7]): Ordering[(T1, T2, T3, T4, T5, T6, T7)] =
new Ordering[(T1, T2, T3, T4, T5, T6, T7)]{
- def compare(x : Tuple7[T1, T2, T3, T4, T5, T6, T7], y : Tuple7[T1, T2, T3, T4, T5, T6, T7]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- val compare5 = ord5.compare(x._5, y._5);
- if (compare5 != 0) return compare5;
- val compare6 = ord6.compare(x._6, y._6);
- if (compare6 != 0) return compare6;
- val compare7 = ord7.compare(x._7, y._7);
- if (compare7 != 0) return compare7;
- 0;
+ def compare(x: (T1, T2, T3, T4, T5, T6, T7), y: (T1, T2, T3, T4, T5, T6, T7)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ val compare5 = ord5.compare(x._5, y._5)
+ if (compare5 != 0) return compare5
+ val compare6 = ord6.compare(x._6, y._6)
+ if (compare6 != 0) return compare6
+ val compare7 = ord7.compare(x._7, y._7)
+ if (compare7 != 0) return compare7
+ 0
}
}
- implicit def Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4], ord5 : Ordering[T5], ord6 : Ordering[T6], ord7 : Ordering[T7], ord8 : Ordering[T8]) : Ordering[(T1, T2, T3, T4, T5, T6, T7, T8)] =
+ implicit def Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4], ord5: Ordering[T5], ord6: Ordering[T6], ord7: Ordering[T7], ord8: Ordering[T8]): Ordering[(T1, T2, T3, T4, T5, T6, T7, T8)] =
new Ordering[(T1, T2, T3, T4, T5, T6, T7, T8)]{
- def compare(x : Tuple8[T1, T2, T3, T4, T5, T6, T7, T8], y : Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- val compare5 = ord5.compare(x._5, y._5);
- if (compare5 != 0) return compare5;
- val compare6 = ord6.compare(x._6, y._6);
- if (compare6 != 0) return compare6;
- val compare7 = ord7.compare(x._7, y._7);
- if (compare7 != 0) return compare7;
- val compare8 = ord8.compare(x._8, y._8);
- if (compare8 != 0) return compare8;
- 0;
+ def compare(x: (T1, T2, T3, T4, T5, T6, T7, T8), y: (T1, T2, T3, T4, T5, T6, T7, T8)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ val compare5 = ord5.compare(x._5, y._5)
+ if (compare5 != 0) return compare5
+ val compare6 = ord6.compare(x._6, y._6)
+ if (compare6 != 0) return compare6
+ val compare7 = ord7.compare(x._7, y._7)
+ if (compare7 != 0) return compare7
+ val compare8 = ord8.compare(x._8, y._8)
+ if (compare8 != 0) return compare8
+ 0
}
}
- implicit def Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](implicit ord1 : Ordering[T1], ord2 : Ordering[T2], ord3 : Ordering[T3], ord4 : Ordering[T4], ord5 : Ordering[T5], ord6 : Ordering[T6], ord7 : Ordering[T7], ord8 : Ordering[T8], ord9 : Ordering[T9]) : Ordering[(T1, T2, T3, T4, T5, T6, T7, T8, T9)] =
+ implicit def Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](implicit ord1: Ordering[T1], ord2: Ordering[T2], ord3: Ordering[T3], ord4: Ordering[T4], ord5: Ordering[T5], ord6: Ordering[T6], ord7: Ordering[T7], ord8 : Ordering[T8], ord9: Ordering[T9]): Ordering[(T1, T2, T3, T4, T5, T6, T7, T8, T9)] =
new Ordering[(T1, T2, T3, T4, T5, T6, T7, T8, T9)]{
- def compare(x : Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9], y : Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) : Int = {
- val compare1 = ord1.compare(x._1, y._1);
- if (compare1 != 0) return compare1;
- val compare2 = ord2.compare(x._2, y._2);
- if (compare2 != 0) return compare2;
- val compare3 = ord3.compare(x._3, y._3);
- if (compare3 != 0) return compare3;
- val compare4 = ord4.compare(x._4, y._4);
- if (compare4 != 0) return compare4;
- val compare5 = ord5.compare(x._5, y._5);
- if (compare5 != 0) return compare5;
- val compare6 = ord6.compare(x._6, y._6);
- if (compare6 != 0) return compare6;
- val compare7 = ord7.compare(x._7, y._7);
- if (compare7 != 0) return compare7;
- val compare8 = ord8.compare(x._8, y._8);
- if (compare8 != 0) return compare8;
- val compare9 = ord9.compare(x._9, y._9);
- if (compare9 != 0) return compare9;
- 0;
+ def compare(x: (T1, T2, T3, T4, T5, T6, T7, T8, T9), y: (T1, T2, T3, T4, T5, T6, T7, T8, T9)): Int = {
+ val compare1 = ord1.compare(x._1, y._1)
+ if (compare1 != 0) return compare1
+ val compare2 = ord2.compare(x._2, y._2)
+ if (compare2 != 0) return compare2
+ val compare3 = ord3.compare(x._3, y._3)
+ if (compare3 != 0) return compare3
+ val compare4 = ord4.compare(x._4, y._4)
+ if (compare4 != 0) return compare4
+ val compare5 = ord5.compare(x._5, y._5)
+ if (compare5 != 0) return compare5
+ val compare6 = ord6.compare(x._6, y._6)
+ if (compare6 != 0) return compare6
+ val compare7 = ord7.compare(x._7, y._7)
+ if (compare7 != 0) return compare7
+ val compare8 = ord8.compare(x._8, y._8)
+ if (compare8 != 0) return compare8
+ val compare9 = ord9.compare(x._9, y._9)
+ if (compare9 != 0) return compare9
+ 0
}
}
diff --git a/src/library/scala/collection/LinearSequence.scala b/src/library/scala/collection/LinearSequence.scala
index fa7977d7eb..d2e170d9a0 100644
--- a/src/library/scala/collection/LinearSequence.scala
+++ b/src/library/scala/collection/LinearSequence.scala
@@ -11,10 +11,7 @@
package scala.collection
-import mutable.ListBuffer
-// import immutable.{List, Nil, ::}
import generic._
-import scala.util.control.Breaks._
/** <p>
* Class <code>Linear[A]</code> represents linear sequences of elements.
diff --git a/src/library/scala/collection/generic/LinearSequenceTemplate.scala b/src/library/scala/collection/generic/LinearSequenceTemplate.scala
index b0f68022b5..002ab6130e 100644
--- a/src/library/scala/collection/generic/LinearSequenceTemplate.scala
+++ b/src/library/scala/collection/generic/LinearSequenceTemplate.scala
@@ -177,7 +177,8 @@ trait LinearSequenceTemplate[+A, +This <: LinearSequenceTemplate[A, This] with L
else f(head, tail.foldRight(z)(f))
/** Combines the elements of this list together using the binary
- * operator <code>op</code>, from left to right
+ * operator <code>op</code>, from left to right.
+ *
* @param op The operator to apply
* @return <code>op(... op(a<sub>0</sub>,a<sub>1</sub>), ..., a<sub>n</sub>)</code>
if the list has elements
@@ -189,7 +190,8 @@ trait LinearSequenceTemplate[+A, +This <: LinearSequenceTemplate[A, This] with L
else tail.foldLeft[B](head)(f)
/** Combines the elements of this iterable object together using the binary
- * operator <code>op</code>, from right to left
+ * operator <code>op</code>, from right to left.
+ *
* @note Will not terminate for infinite-sized collections.
* @param op The operator to apply
*
diff --git a/src/library/scala/collection/generic/SequenceFactory.scala b/src/library/scala/collection/generic/SequenceFactory.scala
index acf0f0cfd1..4e5c7fba90 100644
--- a/src/library/scala/collection/generic/SequenceFactory.scala
+++ b/src/library/scala/collection/generic/SequenceFactory.scala
@@ -10,7 +10,7 @@
package scala.collection.generic
-import scala.collection._
+
import scala.collection._
/** A template for companion objects of Sequence and subclasses thereof.
diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala
index c645b30b56..bd790b777a 100644
--- a/src/library/scala/collection/immutable/BitSet.scala
+++ b/src/library/scala/collection/immutable/BitSet.scala
@@ -14,8 +14,9 @@ package scala.collection.immutable
import scala.collection.generic._
import BitSetTemplate.{LogWL, updateArray}
-/** a base class for immutable bit sets
+/** A base class for immutable bit sets.
*/
+@serializable @SerialVersionUID(1611436763290191562L)
abstract class BitSet extends Set[Int]
with collection.BitSet
with BitSetTemplate[BitSet] {
@@ -23,7 +24,8 @@ abstract class BitSet extends Set[Int]
def fromArray(elems: Array[Long]): BitSet = BitSet.fromArray(elems)
- /** Update word at index `idx`; enlarge set if `idx` outside range of set
+ /** Update word at index <code>idx</code>; enlarge set if <code>idx</code>
+ * outside range of set.
*/
protected def updateWord(idx: Int, w: Long): BitSet
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 27b69949c8..41b4be580a 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -17,7 +17,7 @@ trait Vector[+A] extends Sequence[A]
with collection.Vector[A]
with TraversableClass[A, Vector]
with VectorTemplate[A, Vector[A]] {
- override def companion: Companion[Vector] = Vector
+ override def companion: Companion[Vector] = Vector
}
object Vector extends SequenceFactory[Vector] {
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 383c6954cb..d3cb8a747e 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -1,11 +1,24 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+
package scala.collection.mutable
import scala.collection.generic._
import scala.collection.immutable
import BitSetTemplate.{LogWL, updateArray}
-/** A class for mutable bitsets */
-class BitSet (protected var elems: Array[Long]) extends Set[Int]
+/** A class for mutable bitsets.
+ */
+@serializable @SerialVersionUID(8483111450368547763L)
+class BitSet(protected var elems: Array[Long]) extends Set[Int]
with collection.BitSet
with BitSetTemplate[BitSet]
with MutableSetTemplate[Int, BitSet] {
@@ -36,7 +49,7 @@ class BitSet (protected var elems: Array[Long]) extends Set[Int]
/** Adds element to bitset,
* @return element was already present.
*/
- override def add (elem: Int): Boolean = {
+ override def add(elem: Int): Boolean = {
require(elem >= 0)
if (contains(elem)) false
else {
@@ -49,7 +62,7 @@ class BitSet (protected var elems: Array[Long]) extends Set[Int]
/** Removes element from bitset.
* @return element was already present.
*/
- override def remove (elem: Int): Boolean = {
+ override def remove(elem: Int): Boolean = {
require(elem >= 0)
if (contains(elem)) {
val idx = elem >> LogWL
diff --git a/src/library/scala/collection/mutable/LinearSequence.scala b/src/library/scala/collection/mutable/LinearSequence.scala
index 59bd14fead..e34d1a2504 100644
--- a/src/library/scala/collection/mutable/LinearSequence.scala
+++ b/src/library/scala/collection/mutable/LinearSequence.scala
@@ -1,8 +1,19 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: $
+
+
package scala.collection.mutable
import scala.collection.generic._
-/** A subtrait of collection.Sequence which represents sequences
+/** A subtrait of <code>collection.Sequence</code> which represents sequences
* that cannot be mutated.
*/
trait LinearSequence[A] extends Sequence[A]
diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala
index 2a001e187c..c1de157628 100644
--- a/src/library/scala/collection/mutable/MutableList.scala
+++ b/src/library/scala/collection/mutable/MutableList.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -12,19 +12,22 @@
package scala.collection.mutable
import scala.collection.generic._
-// import immutable.{List, Nil, ::}
-//import Predef.NoSuchElementException
-
-/** This class is used internally to represent mutable lists. It is the
- * basis for the implementation of the classes
- * <code>Stack</code>, and <code>Queue</code>.
+/** <p>
+ * This class is used internally to represent mutable lists. It is the
+ * basis for the implementation of the classes
+ * <code>Stack</code>, and <code>Queue</code>.
+ * </p>
* !!! todo: convert to LinkedListBuffer?
+ *
* @author Matthias Zenger
* @author Martin Odersky
* @version 2.8
*/
-class MutableList[A] extends LinearSequence[A] with LinearSequenceTemplate[A, MutableList[A]] with Builder[A, MutableList[A]] {
+@serializable @SerialVersionUID(5938451523372603072L)
+class MutableList[A] extends LinearSequence[A]
+ with LinearSequenceTemplate[A, MutableList[A]]
+ with Builder[A, MutableList[A]] {
override protected[this] def newBuilder = new MutableList[A]
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala
index 4c6d1a2320..f58a231364 100644
--- a/src/library/scala/collection/mutable/Queue.scala
+++ b/src/library/scala/collection/mutable/Queue.scala
@@ -42,7 +42,7 @@ class Queue[A] extends MutableList[A] with Cloneable[Queue[A]] {
val res = first0.elem
first0 = first0.next
if (first0 eq null) last0 = null
- len = len - 1
+ len -= 1
res
}
@@ -58,7 +58,7 @@ class Queue[A] extends MutableList[A] with Cloneable[Queue[A]] {
else if (p(first0.elem)) {
val res: Option[A] = Some(first0.elem)
first0 = first0.next
- len = len - 1
+ len -= 1
if (first0 eq null) {
last0 = null
} else if (first0.next eq null) {
@@ -86,7 +86,7 @@ class Queue[A] extends MutableList[A] with Cloneable[Queue[A]] {
while ((first0 ne null) && p(first0.elem)) {
res += first0.elem
first0 = first0.next
- len = len - 1
+ len -= 1
if (first0 eq null) {
last0 = null
} else if (first0.next eq null) {
@@ -116,7 +116,7 @@ class Queue[A] extends MutableList[A] with Cloneable[Queue[A]] {
cell.next = cell.next.next
if (cell.next eq null)
last0 = cell
- len = len - 1
+ len -= 1
res
}
}
diff --git a/src/library/scala/collection/mutable/Vector.scala b/src/library/scala/collection/mutable/Vector.scala
index 6bd5bf3fdb..97e144810c 100644
--- a/src/library/scala/collection/mutable/Vector.scala
+++ b/src/library/scala/collection/mutable/Vector.scala
@@ -5,6 +5,10 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
+
+// $Id: $
+
+
package scala.collection.mutable
import scala.collection.generic._