diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2007-10-19 12:53:52 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2007-10-19 12:53:52 +0000 |
commit | a49cbca4e93d573b0687023d3458bb8a1473e463 (patch) | |
tree | 8eb31f12568cad9e1d08a15b5d17024ad5edcc27 /src/library | |
parent | 7305b72eb8b11872613801b3ce5130b30e362a2d (diff) | |
download | scala-a49cbca4e93d573b0687023d3458bb8a1473e463.tar.gz scala-a49cbca4e93d573b0687023d3458bb8a1473e463.tar.bz2 scala-a49cbca4e93d573b0687023d3458bb8a1473e463.zip |
* Fixed array cast bug in Errasure.
* Tweaked GenerateIDEs to have more coverage
* Deprecated * in favor of ** for sets
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/jcl/ArrayList.scala | 18 | ||||
-rw-r--r-- | src/library/scala/collection/jcl/Buffer.scala | 25 | ||||
-rw-r--r-- | src/library/scala/collection/jcl/BufferIterator.scala | 1 | ||||
-rw-r--r-- | src/library/scala/collection/jcl/MutableIterable.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/jcl/Set.scala | 6 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/Map.scala | 1 | ||||
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 2 |
7 files changed, 26 insertions, 29 deletions
diff --git a/src/library/scala/collection/jcl/ArrayList.scala b/src/library/scala/collection/jcl/ArrayList.scala index 2b433cd059..166dcc7314 100644 --- a/src/library/scala/collection/jcl/ArrayList.scala +++ b/src/library/scala/collection/jcl/ArrayList.scala @@ -14,22 +14,6 @@ package scala.collection.jcl; * * @author Sean McDirmid */ -class ArrayList[A](override val underlying : java.util.ArrayList) extends RandomAccessSeq.Mutable[A] with BufferWrapper[A] { +class ArrayList[A](override val underlying : java.util.ArrayList) extends BufferWrapper[A] { def this() = this(new java.util.ArrayList); - override def elements = super[BufferWrapper].elements; - - trait Projection0[A] extends MutableSeq.Projection[A] with RandomAccessSeq.Projection[A] { - override def projection : Projection0[A] = this - override def elements : SeqIterator[Int,A] = new DefaultSeqIterator - - protected class MapProjection[B](f : A => B) extends super.MapProjection[B](f) with Projection0[B] { - override def projection = this - } - override def map[B](f: A => B) : Projection0[B] = new MapProjection[B](f) - } - class Projection extends Buffer.Projection[A] with RandomAccessSeq.MutableProjection[A] with Projection0[A] { - override def elements : BufferIterator[Int,A] = new DefaultBufferIterator - override def projection : Projection = this - } - override def projection : Projection = new Projection } diff --git a/src/library/scala/collection/jcl/Buffer.scala b/src/library/scala/collection/jcl/Buffer.scala index d6dd45c501..a0a3348d0a 100644 --- a/src/library/scala/collection/jcl/Buffer.scala +++ b/src/library/scala/collection/jcl/Buffer.scala @@ -14,7 +14,7 @@ package scala.collection.jcl; * * @author Sean McDirmid */ -trait Buffer[A] extends Ranged[Int,A] with MutableSeq[A] with Collection[A] { +trait Buffer[A] extends RandomAccessSeq.Mutable[A] with Ranged[Int,A] with MutableSeq[A] with Collection[A] { final protected type SortedSelf = Buffer[A]; override def projection : Buffer.Projection[A] = new Buffer.Projection[A] { @@ -200,13 +200,26 @@ trait Buffer[A] extends Ranged[Int,A] with MutableSeq[A] with Collection[A] { } } } - def replace(startOffset : Int, length : Int, added : Iterable[A]) : Unit = { - + /* + protected class Map[B](f : A => B) extends super.Map[B](f) with Buffer.Projection[B] { + override def elements = Buffer.this.elements.map[B](f); + //override def apply(idx : Int) = f(MutableSeq.this.apply(idx)); + //override def size = length; } - + */ } object Buffer { - trait Projection[A] extends MutableSeq.Projection[A] with Collection.Projection[A] with Buffer[A] { - override def projection = this + trait Projection0[A] extends MutableSeq.Projection[A] with RandomAccessSeq.Projection[A] { + override def projection : Projection0[A] = this + override def elements : SeqIterator[Int,A] = new DefaultSeqIterator + + protected class MapProjection[B](f : A => B) extends super.MapProjection[B](f) with Projection0[B] { + override def projection = this + } + override def map[B](f: A => B) : Projection0[B] = new MapProjection[B](f) + } + class Projection[A] extends Collection.Projection[A] with RandomAccessSeq.MutableProjection[A] with Projection0[A] with Buffer[A] { + override def elements : BufferIterator[Int,A] = new DefaultBufferIterator + override def projection : Buffer.Projection[A] = this } } diff --git a/src/library/scala/collection/jcl/BufferIterator.scala b/src/library/scala/collection/jcl/BufferIterator.scala index 3faeb0b354..bb7b79d099 100644 --- a/src/library/scala/collection/jcl/BufferIterator.scala +++ b/src/library/scala/collection/jcl/BufferIterator.scala @@ -28,5 +28,4 @@ trait BufferIterator[K,A] extends SeqIterator[K,A] { * If previous was last called, "a" is inserted before the element returned. */ def add(a: A): Unit; - } diff --git a/src/library/scala/collection/jcl/MutableIterable.scala b/src/library/scala/collection/jcl/MutableIterable.scala index 5683e6bd3e..0fed9954e5 100644 --- a/src/library/scala/collection/jcl/MutableIterable.scala +++ b/src/library/scala/collection/jcl/MutableIterable.scala @@ -42,7 +42,7 @@ trait MutableIterable[A] extends scala.Collection[A] { def -(t : A) : this.type = { remove(t); this; } /** retain only elements in the collection that predicate p is true for. */ - def retain(p : A => Boolean) : Unit = elements.retain(p); + def retainOnly(p : A => Boolean) : Unit = elements.retain(p); /** retain only elements that are also in that. */ def retainAll(that : Iterable[A]) : Boolean = elements.retain(s => that.exists(t => t == s)); diff --git a/src/library/scala/collection/jcl/Set.scala b/src/library/scala/collection/jcl/Set.scala index 604e647f52..85c5b11148 100644 --- a/src/library/scala/collection/jcl/Set.scala +++ b/src/library/scala/collection/jcl/Set.scala @@ -24,7 +24,7 @@ trait Set[A] extends scala.collection.mutable.Set[A] with Collection[A] { override def --(i: Iterable[A]) : this.type = super[Collection].--(i) override def +(t: A) : this.type = super[Collection].+(t) override def -(t: A) : this.type = super[Collection].-(t) - override def retain(f: A => Boolean) = super[Collection].retain(f) + override final def retain(f: A => Boolean) = retainOnly(f) override def isEmpty = super[Collection].isEmpty override def clear() = super.clear() override def subsetOf(set : scala.collection.Set[A]) = set match { @@ -46,8 +46,8 @@ trait Set[A] extends scala.collection.mutable.Set[A] with Collection[A] { } class Filter(pp : A => Boolean) extends super.Filter with Set.Projection[A] { override def p(a : A) = pp(a) - override def retain(p0 : A => Boolean): Unit = - Set.this.retain(e => !p(e) || p0(e)) + override def retainOnly(p0 : A => Boolean): Unit = + Set.this.retainOnly(e => !p(e) || p0(e)) override def add(a : A) = { if (!p(a)) throw new IllegalArgumentException else Set.this.add(a) diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index 1f065cb6eb..0b5504a5e8 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -202,6 +202,7 @@ trait Map[A, B] extends AnyRef * <code>p</code> returns <code>true</code>. * * @param p The test predicate + * @deprecated cannot be type inferred because if retain in Iterable. */ def retain(p: (A, B) => Boolean): Unit = toList foreach { case (key, value) => if (!p(key, value)) -=(key) diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 73e9bfa749..f631a2688a 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -28,7 +28,7 @@ object ScalaRunTime { val DoubleTag = ".Double" val BooleanTag = ".Boolean" - def isArray(x: AnyRef): Boolean = x != null && x.getClass.isArray + def isArray(x: AnyRef): Boolean = (x != null && x.getClass.isArray) || (x != null && x.isInstanceOf[BoxedArray]) def isValueTag(tag: String) = tag.charAt(0) == '.' def isValueClass(clazz: Class) = clazz.isPrimitive() |