From 1eda989ae9d36de1056711eaea93d6470ca400b6 Mon Sep 17 00:00:00 2001 From: michelou Date: Tue, 7 Jul 2009 10:54:34 +0000 Subject: minor change (Scala comments) --- .../collection/generic/MutableSetTemplate.scala | 39 +++++++++++++--------- .../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. +/**

+ * 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. + *

* */ 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 newBuilder for all mutable sets + * in terms of empty. Overrides SetTemplate + * 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 * def iterator: Iterator[A] * def +(elem: A): This * def -(elem: A): This - * *

* If you wish that methods like, take, drop, * filter 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 newBuilder for all sets in terms + * of empty. Overridden for mutable sets in + * + * MutableSetTemplate. */ 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 intersect. */ 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 that. - * @note same as `union` + * @note same as union. */ 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 that. - * @note same as `diff`. + * @note same as diff. */ def &~(that: Set[A]): This = diff(that) -- cgit v1.2.3