diff options
author | michelou <michelou@epfl.ch> | 2009-07-07 10:54:34 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2009-07-07 10:54:34 +0000 |
commit | 1eda989ae9d36de1056711eaea93d6470ca400b6 (patch) | |
tree | 69231acbfa4f07807600e4ac11acd062a1f7a77e | |
parent | dbe0e2bc384fdf7eac0312859347aa62a4778390 (diff) | |
download | scala-1eda989ae9d36de1056711eaea93d6470ca400b6.tar.gz scala-1eda989ae9d36de1056711eaea93d6470ca400b6.tar.bz2 scala-1eda989ae9d36de1056711eaea93d6470ca400b6.zip |
minor change (Scala comments)
-rw-r--r-- | src/library/scala/collection/generic/MutableSetTemplate.scala | 39 | ||||
-rw-r--r-- | src/library/scala/collection/generic/SetTemplate.scala | 29 |
2 files changed, 40 insertions, 28 deletions
diff --git a/src/library/scala/collection/generic/MutableSetTemplate.scala b/src/library/scala/collection/generic/MutableSetTemplate.scala index f387b52de2..7ed515a4d6 100644 --- a/src/library/scala/collection/generic/MutableSetTemplate.scala +++ b/src/library/scala/collection/generic/MutableSetTemplate.scala @@ -13,20 +13,25 @@ package scala.collection.generic import script._ -/** A generic template for mutable sets of elements of type A. - * To implement a concrete mutable set, you need to provide implementations of the following methods: - * - * def contains(elem: A): Boolean - * def iterator: Iterator[A] - * def += (elem: A): this.type - * def -= (elem: A): this.type - * - * If you wish that methods like, take, drop, filter return the same kind of map, you should also - * override: - * - * def empty: This - * - * It is also good idea to override methods `foreach` and `size` for efficiency. +/** <p> + * A generic template for mutable sets of elements of type <code>A</code>. + * To implement a concrete mutable set, you need to provide implementations + * of the following methods: + * </p><pre> + * <b>def</b> contains(elem: A): Boolean + * <b>def</b> iterator: Iterator[A] + * <b>def</b> += (elem: A): <b>this.type</b> + * <b>def</b> -= (elem: A): <b>this.type</b></pre> + * <p> + * If you wish that methods <code>like</code>, <code>take</code>, + * <code>drop</code>, <code>filter</code> return the same kind of map, + * you should also override: + * </p><pre> + * <b>def</b> empty: This</pre> + * <p> + * It is also good idea to override methods <code>foreach</code> and + * <code>size</code> for efficiency. + * </p> * */ trait MutableSetTemplate[A, +This <: MutableSetTemplate[A, This] with mutable.Set[A]] @@ -38,8 +43,9 @@ trait MutableSetTemplate[A, +This <: MutableSetTemplate[A, This] with mutable.Se with Cloneable[This] { self => - /** A common implementation of `newBuilder` for all mutable sets in terms of `empty`. - * Overrides `SetTemplate` implementation for better efficiency. + /** A common implementation of <code>newBuilder</code> for all mutable sets + * in terms of <code>empty</code>. Overrides <code>SetTemplate</code> + * implementation for better efficiency. */ override protected[this] def newBuilder: Builder[A, This] = empty @@ -55,6 +61,7 @@ trait MutableSetTemplate[A, +This <: MutableSetTemplate[A, This] with mutable.Se } /** Removes a single element from a set. + * * @param elem The element to be removed. * @return true if the element was already present in the set. */ diff --git a/src/library/scala/collection/generic/SetTemplate.scala b/src/library/scala/collection/generic/SetTemplate.scala index 4b2e457ae0..f3f8bf3e2c 100644 --- a/src/library/scala/collection/generic/SetTemplate.scala +++ b/src/library/scala/collection/generic/SetTemplate.scala @@ -21,7 +21,6 @@ package scala.collection.generic * <b>def</b> iterator: Iterator[A] * <b>def</b> +(elem: A): This * <b>def</b> -(elem: A): This</pre> - * </pre> * <p> * If you wish that methods <code>like</code>, <code>take</code>, <code>drop</code>, * <code>filter</code> return the same kind of set, you should also override: @@ -42,8 +41,10 @@ self => /* The empty set of the dame type as this set */ def empty: This - /** A common implementation of `newBuilder` for all sets in terms of `empty`. - * Overridden for mutable sets in `MutableSetTemplate`. + /** A common implementation of <code>newBuilder</code> for all sets in terms + * of <code>empty</code>. Overridden for mutable sets in + * <a href="MutableSetTemplate.html" target="ContentFrame"> + * <code>MutableSetTemplate</code></a>. */ override protected[this] def newBuilder: Builder[A, This] = new AddingBuilder[A, This](empty) @@ -55,12 +56,16 @@ self => */ def contains(elem: A): Boolean - /** Creates a new set with an additional element, unless the element is already present. + /** Creates a new set with an additional element, unless the element is + * already present. + * * @param elem the element to be added */ def + (elem: A): This - /** Creates a new set with given element removed from this set, unless the element is not present. + /** Creates a new set with given element removed from this set, unless the + * element is not present. + * * @param elem the element to be removed */ def - (elem: A): This @@ -81,18 +86,18 @@ self => */ def apply(elem: A): Boolean = contains(elem) - /** Returns a new set consisting of all elements that are both in the current set - * and in the argument set. + /** Returns a new set consisting of all elements that are both in the current + * set and in the argument set. * * @param that the set to intersect with. */ def intersect(that: Set[A]): This = filter(that.contains) - /** Returns a new set consisting of all elements that are both in the current set - * and in the argument set. + /** Returns a new set consisting of all elements that are both in the current + * set and in the argument set. * * @param that the set to intersect with. - * @note same as `intersect` + * @note same as <code>intersect</code>. */ def &(that: Set[A]): This = intersect(that) @@ -117,7 +122,7 @@ self => * @param that the set of elements to add * @return a set containing the elements of this * set and those of the given set <code>that</code>. - * @note same as `union` + * @note same as <code>union</code>. */ def | (that: Set[A]): This = union(that) @@ -134,7 +139,7 @@ self => * @param that the set of elements to remove * @return a set containing those elements of this * set that are not also contained in the given set <code>that</code>. - * @note same as `diff`. + * @note same as <code>diff</code>. */ def &~(that: Set[A]): This = diff(that) |