diff options
author | michelou <michelou@epfl.ch> | 2003-07-16 07:52:39 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2003-07-16 07:52:39 +0000 |
commit | 81dbbfa8d6d6a6b1925045e066e2b276fbc914b2 (patch) | |
tree | 0c05d894fb4a826426a56f1700630b46027331f4 /sources | |
parent | db2914e723a5aae3b32520cdbad333b6db00a6a1 (diff) | |
download | scala-81dbbfa8d6d6a6b1925045e066e2b276fbc914b2.tar.gz scala-81dbbfa8d6d6a6b1925045e066e2b276fbc914b2.tar.bz2 scala-81dbbfa8d6d6a6b1925045e066e2b276fbc914b2.zip |
indentation
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/PartialFunction.scala | 5 | ||||
-rw-r--r-- | sources/scala/Seq.scala | 31 | ||||
-rw-r--r-- | sources/scala/SeqTrace.scala | 75 |
3 files changed, 61 insertions, 50 deletions
diff --git a/sources/scala/PartialFunction.scala b/sources/scala/PartialFunction.scala index 3959a5c3f5..82edad02cc 100644 --- a/sources/scala/PartialFunction.scala +++ b/sources/scala/PartialFunction.scala @@ -1,12 +1,13 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2003, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -** $Id$ \* */ +// $Id$ + package scala; diff --git a/sources/scala/Seq.scala b/sources/scala/Seq.scala index 4a7f7ae5e6..f97f4439dc 100644 --- a/sources/scala/Seq.scala +++ b/sources/scala/Seq.scala @@ -1,12 +1,13 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2003, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -** $Id$ \* */ +// $Id$ + package scala; trait Seq[+A] with Function1[Int, A] with Iterable[A] { @@ -14,16 +15,18 @@ trait Seq[+A] with Function1[Int, A] with Iterable[A] { def length: Int; override def toString() = { - def toString1( it:Iterator[ A ] ):String = { - if( it.hasNext ) { - ",".concat( it.next.toString() ) - .concat( toString1( it ) ) - } else ")"; - } - val it = elements; - if( it.hasNext ) - "Seq(" + it.next.toString() + toString1( it ) ; - else - "Seq()" - } + def toString1(it: Iterator[A]):String = { + if (it.hasNext) { + ",".concat(it.next.toString()) + .concat(toString1(it)) + } else + ")" + } + val it = elements; + if (it.hasNext) + "Seq(" + it.next.toString() + toString1(it) + else + "Seq()" + } + } diff --git a/sources/scala/SeqTrace.scala b/sources/scala/SeqTrace.scala index bf4abf8649..ceec585560 100644 --- a/sources/scala/SeqTrace.scala +++ b/sources/scala/SeqTrace.scala @@ -1,57 +1,64 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2003, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + // needed for variable binding in pattern matching package scala; - // special sequence list +// special sequence list - // run of a left-transducer that tags its input with states +// run of a left-transducer that tags its input with states - // needed for variable binding during matching +// needed for variable binding during matching - abstract class SeqTrace[ a ] extends List[ Tuple2[ Int, a ] ] { +abstract class SeqTrace[A] extends List[Pair[Int,A]] { - /*abstract*/ def isEmpty:boolean ; + /*abstract*/ def isEmpty: Boolean; - /*abstract*/ def head:Tuple2[ Int, a ]; + /*abstract*/ def head: Pair[Int, A]; - /*abstract*/ def headState:Int; + /*abstract*/ def headState: Int; - /*abstract*/ def headElem:a; + /*abstract*/ def headElem: A; + /*abstract*/ def tail: SeqTrace[A]; - /*abstract*/ def tail:SeqTrace[ a ]; - - /* - override def ::(zI:Int, za:a): SeqTrace[ a ] = - new SeqTraceCons (zI, za, this ) ; +/* + override def ::(zI: Int, za: A): SeqTrace[A] = + new SeqTraceCons(zI, za, this); */ - // why the f&&k do I need the .as cast ? + // why the f&&k do I need the .as cast ? - def add[ a ]( state:Int, value:a ):SeqTraceCons[ a ] = - SeqTraceCons[a](state, value, this as SeqTrace[ a ] ); + def add[A](state: Int, value: A): SeqTraceCons[A] = + SeqTraceCons[A](state, value, this as SeqTrace[A]); - // this is copied verbatim from List... and SeqList + // this is copied verbatim from List... and SeqList /* - def mkString2(start: java.lang.String, - sep: java.lang.String, - end: java.lang.String): java.lang.String = - start + - (if (isEmpty) end - else if (tail.isEmpty) head.toString() + end - else head.toString().concat(sep).concat( - tail.mkString2("", sep, end))); + def mkString2(start: java.lang.String, + sep: java.lang.String, + end: java.lang.String): java.lang.String = + start + + (if (isEmpty) end + else if (tail.isEmpty) head.toString() + end + else head.toString().concat(sep).concat( + tail.mkString2("", sep, end))); */ /* BUG -override def mkString(start: java.lang.String, + override def mkString(start: java.lang.String, sep: java.lang.String, end: java.lang.String): java.lang.String = - start + - (if (isEmpty) end - else if (tail.isEmpty) head.toString() + end - else head.toString().concat(sep).concat( - tail.mkString("", sep, end))); + start + + (if (isEmpty) end + else if (tail.isEmpty) head.toString() + end + else head.toString().concat(sep).concat( + tail.mkString("", sep, end))); */ - } - - +} |