summaryrefslogtreecommitdiff
path: root/sources/scala/SeqProxy.scala
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scala/SeqProxy.scala')
-rw-r--r--sources/scala/SeqProxy.scala24
1 files changed, 13 insertions, 11 deletions
diff --git a/sources/scala/SeqProxy.scala b/sources/scala/SeqProxy.scala
index cfb0d4ad6d..03f6031312 100644
--- a/sources/scala/SeqProxy.scala
+++ b/sources/scala/SeqProxy.scala
@@ -17,25 +17,27 @@ package scala;
* @author Matthias Zenger
* @version 1.0, 16/07/2003
*/
-class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
+trait SeqProxy[+A] extends Seq[A] with IterableProxy[A] {
+
+ def self: Seq[A];
/** Returns the length of the sequence.
*
* @return the sequence length.
*/
- def length: Int = x.length;
+ def length: Int = self.length;
/** Access element number <code>n</code>.
*
* @return the element at index <code>n</code>.
*/
- def apply(n: Int): A = x.apply(n);
+ def apply(n: Int): A = self.apply(n);
/** Is this partial function defined for the index <code>x</code>?
*
* @return true, iff <code>x</code> is a legal sequence index.
*/
- override def isDefinedAt(y: Int): Boolean = x.isDefinedAt(y);
+ override def isDefinedAt(y: Int): Boolean = self.isDefinedAt(y);
/** Returns the index of the first occurence of the specified
* object in this sequence.
@@ -44,7 +46,7 @@ class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
* @return the index in this sequence of the first occurence of the specified
* element, or -1 if the sequence does not contain this element.
*/
- override def indexOf[B >: A](elem: B): Int = x.indexOf(elem);
+ override def indexOf[B >: A](elem: B): Int = self.indexOf(elem);
/** Returns the index of the last occurence of the specified
* element in this sequence, or -1 if the sequence does not
@@ -55,21 +57,21 @@ class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
* specified element, or -1 if the sequence does not contain
* this element.
*/
- override def lastIndexOf[B >: A](elem: B): Int = x.lastIndexOf(elem);
+ override def lastIndexOf[B >: A](elem: B): Int = self.lastIndexOf(elem);
/** Returns the sub-sequence starting from index <code>n</code>.
*/
- override def take(n: Int): Seq[A] = x.take(n);
+ override def take(n: Int): Seq[A] = self.take(n);
/** Returns a new sub-sequence that drops the first <code>n</code>
* elements of this sequence.
*/
- override def drop(n: Int): Seq[A] = x.drop(n);
+ override def drop(n: Int): Seq[A] = self.drop(n);
/** Returns a subsequence starting from index <code>from</code>
* consisting of <code>len</code> elements.
*/
- override def subseq(from: Int, len: Int): Seq[A] = x.subseq(from, len);
+ override def subseq(from: Int, len: Int): Seq[A] = self.subseq(from, len);
/** Fills the given array <code>xs</code> with the elements of
* this sequence starting at position <code>start</code>.
@@ -79,11 +81,11 @@ class SeqProxy[+A](x: Seq[A]) extends Seq[A] with IterableProxy(x) {
* @return the given array <code>xs</code> filled with the elements
* of this sequence.
*/
- override def copyToArray[B >: A](xs: Array[B], start: Int): Array[B] = x.copyToArray(xs, start);
+ override def copyToArray[B >: A](xs: Array[B], start: Int): Array[B] = self.copyToArray(xs, start);
/** Transform this sequence into a list of all elements.
*
* @return a list which enumerates all elements of this sequence.
*/
- override def toList: List[A] = x.toList;
+ override def toList: List[A] = self.toList;
}