diff options
author | michelou <michelou@epfl.ch> | 2007-02-27 09:52:03 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-02-27 09:52:03 +0000 |
commit | e30503f10056bdff6eb066122607c5e42e2cabb9 (patch) | |
tree | f95355f81a307acbb5bd07e602a97d85b290ddda /src | |
parent | 9f926a9e1ec7d6731fb30022d8ec770d1c5402d0 (diff) | |
download | scala-e30503f10056bdff6eb066122607c5e42e2cabb9.tar.gz scala-e30503f10056bdff6eb066122607c5e42e2cabb9.tar.bz2 scala-e30503f10056bdff6eb066122607c5e42e2cabb9.zip |
updated svn:keywords and scaladoc comments
Diffstat (limited to 'src')
16 files changed, 104 insertions, 72 deletions
diff --git a/src/library/scala/collection/immutable/EmptyMap.scala b/src/library/scala/collection/immutable/EmptyMap.scala index 75b71338ee..dd6819b18b 100755 --- a/src/library/scala/collection/immutable/EmptyMap.scala +++ b/src/library/scala/collection/immutable/EmptyMap.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/EmptySet.scala b/src/library/scala/collection/immutable/EmptySet.scala index b70fe38f05..afb70568d4 100755 --- a/src/library/scala/collection/immutable/EmptySet.scala +++ b/src/library/scala/collection/immutable/EmptySet.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index 34a4a5ed1c..a87b473f7a 100755 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: HashMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ package scala.collection.immutable diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index 9adf05567f..5bc8054a0d 100755 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: HashSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ package scala.collection.immutable diff --git a/src/library/scala/collection/immutable/ImmutableIterator.scala b/src/library/scala/collection/immutable/ImmutableIterator.scala index 0218198263..745483d139 100644 --- a/src/library/scala/collection/immutable/ImmutableIterator.scala +++ b/src/library/scala/collection/immutable/ImmutableIterator.scala @@ -6,19 +6,24 @@ ** |/ ** \* */ - package scala.collection.immutable; +// $Id$ + +package scala.collection.immutable /** An object for creating immutable iterators. */ object ImmutableIterator { + object Empty extends ImmutableIterator[Nothing] { - def hasNext = false; - def next = throw new NoSuchElementException; + def hasNext = false + def next = throw new NoSuchElementException } - private case class NonEmpty[+A](item : A, right : () => ImmutableIterator[A]) extends ImmutableIterator[A] { - def hasNext = true; - def next = Tuple2(item, right()); + + private case class NonEmpty[+A](item: A, right: () => ImmutableIterator[A]) extends ImmutableIterator[A] { + def hasNext = true + def next = Tuple2(item, right()) } + /** Creates an empty immutable iterator. */ def empty : ImmutableIterator[Nothing] = Empty; @@ -27,52 +32,80 @@ object ImmutableIterator { def apply[A](item : A) : ImmutableIterator[A] = NonEmpty(item, () => Empty); /** Prepends a lazy immutable iterator (right) with an element (item). */ - def apply[A](item : A, right : () => ImmutableIterator[A]) : () => ImmutableIterator[A] = () => NonEmpty(item, right); - /** Appends an immutable iterator (left) with an element (item) followed by a lazy immutable iterator (right). - */ - def apply[A](left : ImmutableIterator[A], item : A, right : () => ImmutableIterator[A]) : ImmutableIterator[A] = left match { - case Empty => NonEmpty(item, right); - case NonEmpty(first, middle) => - val rest = NonEmpty(item,right); - NonEmpty(first, apply(middle, () => rest)); + def apply[A](item : A, right : () => ImmutableIterator[A]) : () => ImmutableIterator[A] = () => NonEmpty(item, right) + + /** Appends an immutable iterator (left) with an element (item) followed + * by a lazy immutable iterator (right). + * + * @param left ... + * @param item ... + * @param right ... + * @return ... + */ + def apply[A](left: ImmutableIterator[A], item: A, right: () => ImmutableIterator[A]) : ImmutableIterator[A] = left match { + case Empty => + NonEmpty(item, right) + case NonEmpty(first, middle) => + val rest = NonEmpty(item,right) + NonEmpty(first, apply(middle, () => rest)) } - /** Concats a lazy immutable iterator (left) with another lazy immutable iterator (right). + + /** Concats a lazy immutable iterator (left) with another lazy immutable + * iterator (right). */ - def apply[A](left : () => ImmutableIterator[A], right : () => ImmutableIterator[A]) : () => ImmutableIterator[A] = () => (left() match { - case Empty => right(); - case NonEmpty(item, middle) => NonEmpty(item, apply(middle, right)); + def apply[A](left: () => ImmutableIterator[A], right: () => ImmutableIterator[A]): () => ImmutableIterator[A] = () => (left() match { + case Empty => right() + case NonEmpty(item, middle) => NonEmpty(item, apply(middle, right)) }); } -/** A stateless iterator. */ +/** A stateless iterator. + * + * @author Sean McDirmid + * @version 1.0 + */ sealed abstract class ImmutableIterator[+A] { /** queries if this iterator has an element to return. */ def hasNext : Boolean; /** returns the next element and immutable iterator as a pair. */ - def next : Tuple2[A,ImmutableIterator[A]]; - /** Creates a new immutable iterator that appends item to this immutable iterator. - */ - def append[B >: A](item : B) : ImmutableIterator[B] = append(item, () => ImmutableIterator.Empty); - /** Creates a new immutable iterator that appends item and a lazy immutable iterator (right) to this immutable iterator. - */ - def append[B >: A](item : B, right : () => ImmutableIterator[B]) : ImmutableIterator[B] = ImmutableIterator[B](this, item, right); - /** Creates a new immutable iterator that appends a lazy immutable iterator (right) to this immutable iterator. - */ - def append[B >: A](right : () => ImmutableIterator[B]) = ImmutableIterator(() => this,right)(); + def next : Tuple2[A,ImmutableIterator[A]] + + /** Creates a new immutable iterator that appends item to this immutable + * iterator. + */ + def append[B >: A](item: B): ImmutableIterator[B] = append(item, () => ImmutableIterator.Empty) + + /** Creates a new immutable iterator that appends item and a lazy immutable + * iterator (right) to this immutable iterator. + * + * @param item ... + * @param right ... + * @return ... + */ + def append[B >: A](item: B, right: () => ImmutableIterator[B]): ImmutableIterator[B] = + ImmutableIterator[B](this, item, right) + + /** Creates a new immutable iterator that appends a lazy immutable + * iterator (right) to this immutable iterator. + */ + def append[B >: A](right: () => ImmutableIterator[B]) = + ImmutableIterator(() => this, right)() + private class Elements extends Iterator[A] { - private[this] var cursor : ImmutableIterator[A] = ImmutableIterator.this; - def hasNext = cursor.hasNext; + private[this] var cursor: ImmutableIterator[A] = ImmutableIterator.this + def hasNext = cursor.hasNext def next = { - val Tuple2(ret,cursor0) = cursor.next; - cursor = cursor0; - ret; + val Tuple2(ret,cursor0) = cursor.next + cursor = cursor0 + ret } } + /** Converts this immutable iterator into a conventional iterator. - */ - def elements : Iterator[A] = new Elements; + */ + def elements: Iterator[A] = new Elements } diff --git a/src/library/scala/collection/immutable/Map1.scala b/src/library/scala/collection/immutable/Map1.scala index 54767c464d..c9942c5feb 100755 --- a/src/library/scala/collection/immutable/Map1.scala +++ b/src/library/scala/collection/immutable/Map1.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Map2.scala b/src/library/scala/collection/immutable/Map2.scala index 7ff45271fa..9af038f3ca 100755 --- a/src/library/scala/collection/immutable/Map2.scala +++ b/src/library/scala/collection/immutable/Map2.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Map3.scala b/src/library/scala/collection/immutable/Map3.scala index a4a85b22a8..007f142c07 100755 --- a/src/library/scala/collection/immutable/Map3.scala +++ b/src/library/scala/collection/immutable/Map3.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Map4.scala b/src/library/scala/collection/immutable/Map4.scala index 72aeed36b9..17507495d4 100755 --- a/src/library/scala/collection/immutable/Map4.scala +++ b/src/library/scala/collection/immutable/Map4.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListMap.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ package scala.collection.immutable diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala index 3df5a37ee3..6940aa32d9 100755 --- a/src/library/scala/collection/immutable/RedBlack.scala +++ b/src/library/scala/collection/immutable/RedBlack.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.collection.immutable @serializable diff --git a/src/library/scala/collection/immutable/Set1.scala b/src/library/scala/collection/immutable/Set1.scala index 423acc68be..eb88495ee0 100755 --- a/src/library/scala/collection/immutable/Set1.scala +++ b/src/library/scala/collection/immutable/Set1.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Set2.scala b/src/library/scala/collection/immutable/Set2.scala index 5e15f34d68..5c8a5d5d76 100755 --- a/src/library/scala/collection/immutable/Set2.scala +++ b/src/library/scala/collection/immutable/Set2.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Set3.scala b/src/library/scala/collection/immutable/Set3.scala index b4f3a697d8..f4071ae12b 100755 --- a/src/library/scala/collection/immutable/Set3.scala +++ b/src/library/scala/collection/immutable/Set3.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/Set4.scala b/src/library/scala/collection/immutable/Set4.scala index 7d83277bf8..18283bb3eb 100755 --- a/src/library/scala/collection/immutable/Set4.scala +++ b/src/library/scala/collection/immutable/Set4.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: ListSet.scala 9554 2007-01-04 16:30:16 +0000 (Thu, 04 Jan 2007) odersky $ +// $Id$ diff --git a/src/library/scala/collection/immutable/UnbalancedTreeMap.scala b/src/library/scala/collection/immutable/UnbalancedTreeMap.scala index a0679168ab..433ff899c0 100755 --- a/src/library/scala/collection/immutable/UnbalancedTreeMap.scala +++ b/src/library/scala/collection/immutable/UnbalancedTreeMap.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: TreeMap.scala 8997 2006-10-19 20:52:30Z odersky $ +// $Id$ // todo: make balanced once Tree.scala is updated to be covariant. diff --git a/src/library/scala/reflect/BeanProperty.scala b/src/library/scala/reflect/BeanProperty.scala index 3e7084fe77..4a09578df9 100644 --- a/src/library/scala/reflect/BeanProperty.scala +++ b/src/library/scala/reflect/BeanProperty.scala @@ -1,34 +1,33 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -*/ +\* */ // $Id$ package scala.reflect -/** - * This attribute adds a setter and a getter method, following the - Java Bean convention (first letter of the property is capitalized) used -by popular Java web frameworks. -For example -<pre> - [BeanProperty] - var status = "" -</pre> -<p> adds the following methods to the <b>generated</b> code </p> -<pre> - def setStatus(s:String): Unit = { this.status = s } - def getStatus: String = { this.status } -</pre> - * - <p> - However, you cannot call <code>setStatus</code> from Scala, you should - use the normal Scala access and assignment. - </p> +/** <p> + * This attribute adds a setter and a getter method, following the + * Java Bean convention (first letter of the property is capitalized) + * used by popular Java web frameworks. For example: + * </p><pre> + * @BeanProperty + * <b>var</b> status = ""</pre> + * <p> + * adds the following methods to the <b>generated</b> code + * </p><pre> + * <b>def</b> setStatus(s: String) { <b>this</b>.status = s } + * <b>def</b> getStatus: String = <b>this</b>.status + * </pre> + * <p> + * However, you cannot call <code>setStatus</code> from + * <a href="http://scala-lang.org/" target="_top">Scala</a>, + * you should use the normal Scala access and assignment. + * </p> */ class BeanProperty extends Annotation |