summaryrefslogtreecommitdiff
path: root/src/library/scalax/collection/generic/mutable
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scalax/collection/generic/mutable')
-rw-r--r--src/library/scalax/collection/generic/mutable/Growable.scala94
-rw-r--r--src/library/scalax/collection/generic/mutable/Shrinkable.scala82
-rw-r--r--src/library/scalax/collection/generic/mutable/VectorTemplate.scala55
-rw-r--r--src/library/scalax/collection/generic/mutable/VectorView.scala95
4 files changed, 0 insertions, 326 deletions
diff --git a/src/library/scalax/collection/generic/mutable/Growable.scala b/src/library/scalax/collection/generic/mutable/Growable.scala
deleted file mode 100644
index 4d585129ad..0000000000
--- a/src/library/scalax/collection/generic/mutable/Growable.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
-
-package scalax.collection.generic.mutable
-
-/** This class represents collections that can be augmented using a += operator.
- *
- * @autor Martin Odersky
- * @owner Martin Odersky
- * @version 2.8
- */
-trait Growable[A] {
-
- /** Add a single element to this collection.
- *
- * @param elem the element to add.
- */
- def +=(elem: A): Unit
-
- /** Add a two or more elements to this collection.
- *
- * @param elem1 the first element to add.
- * @param elem2 the second element to add.
- * @param elems the remaining elements to add.
- */
- def +=(elem1: A, elem2: A, elems: A*) {
- this += elem1
- this += elem2
- this ++= elems.asInstanceOf[Iterable[A]] // !@!
- }
-
- /** Adds a number of elements provided by an iterator
- *
- * @param iter the iterator.
- */
- def ++=(iter: collection.Iterator[A]) { iter foreach += }
-
- /** Adds a number of elements provided by an iterable object
- * via its <code>elements</code> method.
- *
- * @param iter the iterable object.
- */
- def ++=(iter: collection.Iterable[A]) { iter foreach += }
-
- /** Add a single element to this collection and return
- * the identity of the collection.
- *
- * @param elem the element to add.
- */
- def +(elem: A): this.type = { this += elem; this }
-
- /** Add two or more elements to this collection and return
- * the identity of the collection.
- *
- * @param elem1 the first element to add.
- * @param elem2 the second element to add.
- * @param elems the remaining elements to add.
- */
- def +(elem1: A, elem2: A, elems: A*): this.type =
- this + elem1 + elem2 ++ elems.asInstanceOf[Iterable[A]] // !@!
-
- /** Adds a number of elements provided by an iterable object
- * via its <code>elements</code> method. The identity of the
- * collection is returned.
- *
- * @param iter the iterable object.
- * @return the updated collection.
- */
- def ++(iter: Iterable[A]): this.type = { this ++= iter; this }
-
- /** Adds a number of elements provided by an iterator
- * via its <code>elements</code> method. The identity of the
- * collection is returned.
- *
- * @param iter the iterator
- * @return the updated collection.
- */
- def ++(iter: Iterator[A]): this.type = { this ++= iter; this }
-
- /** Clears the collection contents.
- */
- def clear()
-}
-
-
-
-
diff --git a/src/library/scalax/collection/generic/mutable/Shrinkable.scala b/src/library/scalax/collection/generic/mutable/Shrinkable.scala
deleted file mode 100644
index 49e1b57eb6..0000000000
--- a/src/library/scalax/collection/generic/mutable/Shrinkable.scala
+++ /dev/null
@@ -1,82 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
-
-package scalax.collection.generic.mutable
-
-/** This class represents collections that can be shrunk using a -= operator.
- *
- * @autor Martin Odersky
- * @owner Martin Odersky
- * @version 2.8
- */
-trait Shrinkable[A] {
-
- /** Remove a single element from this collection.
- *
- * @param elem the element to append.
- */
- def -=(elem: A): Unit
-
- /** Remove two or more elements from this collection.
- * @param elem1 the first element.
- * @param elem2 the second element.
- * @param elems the remaining elements.
- */
- def -= (elem1: A, elem2: A, elems: A*) {
- this -= elem1
- this -= elem2
- this --= elems.asInstanceOf[Iterable[A]] // !@!
- }
-
- /** Remove all the elements provided by an iterable
- * <code>elems</code> from the collection.
- */
- def --=(elems: Iterable[A]) { elems foreach -= }
-
- /** Remove all the elements provided by an iterator
- * <code>elems</code> from the collection.
- */
- def --=(elems: Iterator[A]) { elems foreach -= }
- /** Remove a single element from the collection.
- * @return the collection itself with the element removed.
- *
- * @param elem the element to be removed
- */
- def - (elem: A): this.type = { -=(elem); this }
-
- /** Remove two or more elements from this collection.
- *
- * @param elem1 the first element.
- * @param elem2 the second element.
- * @param elems the remaining elements.
- * @return the collection itself with the elements removed.
- */
- def - (elem1: A, elem2: A, elems: A*): this.type = { -=(elem1, elem2, elems: _*); this }
-
- /** Remove all the elements provided by an iterator
- * <code>elems</code> from the collection.
- *
- * @param elems An iterator containing the elements to remove from the collection.
- * @return the collection itself with the elements removed.
- */
- def -- (elems: Iterable[A]): this.type = { this --= elems; this }
-
- /** Remove all the elements provided by an iterator
- * <code>elems</code> from the collection.
- *
- * @param elems An iterator containing the elements to remove from the collection.
- * @return the collection itself with the elements removed.
- */
- def -- (elems: Iterator[A]): this.type = { this --= elems; this }
-}
-
-
-
-
diff --git a/src/library/scalax/collection/generic/mutable/VectorTemplate.scala b/src/library/scalax/collection/generic/mutable/VectorTemplate.scala
deleted file mode 100644
index 4d748a79d1..0000000000
--- a/src/library/scalax/collection/generic/mutable/VectorTemplate.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2006-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Vector.scala 15437 2008-06-25 16:22:45Z stepancheg $
-
-package scalax.collection.generic.mutable
-
-import collection.mutable.Vector
-import collection.mutable.Vector._
-
-/** Sequences that support O(1) element access and O(1) length computation.
- * @author Sean McDirmid
- * @author Martin Odersky
- * @version 2.8
- */
-trait VectorTemplate[+CC[B] <: VectorTemplate[CC, B] with Vector[B], A] extends generic.VectorTemplate[CC, A] {
-self =>
-
- def update(idx: Int, elem: A)
-
- /** Creates a view of this iterable @see OrderedIterable.View
- */
- override def view: VectorView[CC, A] = new VectorView[CC, A] { // !!! Martin: We should maybe infer the type parameters here?
- val origin: Vector[_] = thisCC
- val length: Int = self.length
- def apply(idx: Int): A = self.apply(idx)
- def update(idx: Int, elem: A) = self.update(idx, elem)
- }
-
- /** A sub-sequence view starting at index `from`
- * and extending up to (but not including) index `until`.
- *
- * @param from The index of the first element of the slice
- * @param until The index of the element following the slice
- * @note The difference between `view` and `slice` is that `view` produces
- * a view of the current sequence, whereas `slice` produces a new sequence.
- *
- * @note view(from, to) is equivalent to view.slice(from, to)
- */
- override def view(from: Int, until: Int): VectorView[CC, A] = view.slice(from, until)
-
- def readOnly: collection.Vector[A] = new collection.Vector[A] { //!!! just use a VectorProxy?
- def length = self.length
- def apply(idx : Int) = self.apply(idx)
- def newBuilder[B]: Builder[collection.Vector, B] = self.newBuilder[B] //mapResult (_.readOnly)
- override def foreach(f: A => Unit) = self.foreach(f)
- override def stringPrefix = self.stringPrefix+"RO"
- }
-}
-
diff --git a/src/library/scalax/collection/generic/mutable/VectorView.scala b/src/library/scalax/collection/generic/mutable/VectorView.scala
deleted file mode 100644
index 05d2ad8152..0000000000
--- a/src/library/scalax/collection/generic/mutable/VectorView.scala
+++ /dev/null
@@ -1,95 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
-
-
-package scalax.collection.generic.mutable
-
-import collection.mutable.Vector
-import collection.mutable.Vector._
-
-/** A non-strict projection of an iterable.
- * @author Sean McDirmid
- * @author Martin Odersky
- * @note this should really be a virtual class of SequenceFactory
- */
-trait VectorView[+UC[B] <: Vector[B], A] extends SequenceView[UC, A] with Vector[A] {
-self =>
-
- /** refined from Iterable.View */
- val origin: Vector[_]
-
- trait Transformed[B] extends super.Transformed[B] with VectorView[UC, B] {
- override val origin = self
- override def elements: Iterator[B] = new Elements(0, length)
- override protected def asCC = asInstanceOf[VectorView[UC, B]]
- }
-
- class Appended(that: Vector[A]) extends super.Appended[A](that) with Transformed[A] {
- override def update(idx: Int, elem: A) {
- val ll = self.length
- if (idx < ll) self.update(idx, elem) else that.update(idx - ll, elem)
- }
- }
-
- class Sliced(from: Int, to: Int) extends super.Sliced(from, to) with Transformed[A] {
- override def update(idx: Int, elem: A) {
- if (idx >= 0 && idx < length) self.update(idx + from, elem)
- else throw new IndexOutOfBoundsException(idx.toString)
- }
- override def slice(from1: Int, to1: Int) =
- new self.Sliced(from + (from1 min length max 0) , to + (to1 min length max 0))
- }
-
- class Reversed extends super.Reversed with Transformed[A] {
- override def update(idx: Int, elem: A) {
- self.update(length - 1 - idx, elem)
- }
- }
-
- class Zipped[B](that: Vector[B]) extends super.Zipped[B](that) with Transformed[(A, B)] {
- override def update(idx: Int, elem: (A, B)) {
- self.update(idx, elem._1)
- that.update(idx, elem._2)
- }
- }
-
- def ++(that: Vector[A]): VectorView[UC, A] =
- new Appended(that).asCC
-
- override def reverse: VectorView[UC, A] =
- (new Reversed).asCC
-
- private def toVector[B](xs: Iterable[B]): Vector[B] = xs match {
- case ras: Vector[_] => ras.asInstanceOf[Vector[B]]
- case _ => Vector() ++ xs
- }
-
- override def zip[B](that: Iterable[B]): VectorView[UC, (A, B)] =
- new Zipped(toVector(that)).asCC
-
- override def zipWithIndex: VectorView[UC, (A, Int)] =
- zip((0 until length).asInstanceOf[Null]) // !@!
- override def take(n: Int): VectorView[UC, A] =
- slice(0, n)
- override def drop(n: Int): VectorView[UC, A] =
- slice(n, Math.MAX_INT)
- override def splitAt(n: Int): (VectorView[UC, A], VectorView[UC, A]) = (take(n), drop(n))
- override def slice(from: Int, until: Int): VectorView[UC, A] =
- new Sliced(from, until).asCC
- override def takeWhile(p: A => Boolean): VectorView[UC, A] =
- take(prefixLength(p))
- override def dropWhile(p: A => Boolean): VectorView[UC, A] =
- drop(prefixLength(p))
- override def span(p: A => Boolean): (VectorView[UC, A], VectorView[UC, A]) = {
- val n = prefixLength(p)
- (take(n), drop(n))
- }
-}
-