summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2010-09-09 09:50:04 +0000
committermichelou <michelou@epfl.ch>2010-09-09 09:50:04 +0000
commitac499bec250987381df04c80700ba5d89f8f07ac (patch)
tree1008fbe0a41f9d29762d4aba77aa374e5c155f7a /src
parentf7751134d1c090d16e8121cc5fade6b9a1a17550 (diff)
downloadscala-ac499bec250987381df04c80700ba5d89f8f07ac.tar.gz
scala-ac499bec250987381df04c80700ba5d89f8f07ac.tar.bz2
scala-ac499bec250987381df04c80700ba5d89f8f07ac.zip
fixed some scaladoc comments
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/TraversableOnce.scala68
-rw-r--r--src/library/scala/collection/generic/GenericTraversableTemplate.scala29
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala18
-rw-r--r--src/library/scala/runtime/AnyValCompanion.scala18
4 files changed, 75 insertions, 58 deletions
diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala
index 6656b05083..e99206498c 100644
--- a/src/library/scala/collection/TraversableOnce.scala
+++ b/src/library/scala/collection/TraversableOnce.scala
@@ -31,8 +31,9 @@ import mutable.{ Buffer, ListBuffer, ArrayBuffer }
* @define coll traversable or iterator
* @define orderDependentFold
*
- * Note: might return different results for different runs, unless the underlying collection type is ordered
- * or the operator is associative and commutative.
+ * Note: might return different results for different runs, unless the
+ * underlying collection type is ordered or the operator is associative
+ * and commutative.
* @define willNotTerminateInf
*
* Note: will not terminate for infinite-sized collections.
@@ -120,9 +121,11 @@ trait TraversableOnce[+A] {
cnt
}
- /** Applies a binary operator to a start value and all elements of this $coll, going left to right.
+ /** Applies a binary operator to a start value and all elements of this $coll,
+ * going left to right.
*
- * Note: `/:` is alternate syntax for `foldLeft`; `z /: xs` is the same as `xs foldLeft z`.
+ * Note: `/:` is alternate syntax for `foldLeft`; `z /: xs` is the same as
+ * `xs foldLeft z`.
* $willNotTerminateInf
* $orderDependentFold
*
@@ -138,9 +141,11 @@ trait TraversableOnce[+A] {
*/
def /:[B](z: B)(op: (B, A) => B): B = foldLeft(z)(op)
- /** Applies a binary operator to all elements of this $coll and a start value, going right to left.
+ /** Applies a binary operator to all elements of this $coll and a start value,
+ * going right to left.
*
- * Note: `:\` is alternate syntax for `foldRight`; `xs :\ z` is the same as `xs foldRight z`.
+ * Note: `:\` is alternate syntax for `foldRight`; `xs :\ z` is the same as
+ * `xs foldRight z`.
* $willNotTerminateInf
* $orderDependentFold
*
@@ -156,7 +161,8 @@ trait TraversableOnce[+A] {
*/
def :\[B](z: B)(op: (A, B) => B): B = foldRight(z)(op)
- /** Applies a binary operator to a start value and all elements of this $coll, going left to right.
+ /** Applies a binary operator to a start value and all elements of this $coll,
+ * going left to right.
*
* $willNotTerminateInf
* $orderDependentFold
@@ -177,7 +183,8 @@ trait TraversableOnce[+A] {
result
}
- /** Applies a binary operator to all elements of this $coll and a start value, going right to left.
+ /** Applies a binary operator to all elements of this $coll and a start value,
+ * going right to left.
*
* $willNotTerminateInf
* $orderDependentFold
@@ -258,7 +265,8 @@ trait TraversableOnce[+A] {
def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] =
if (isEmpty) None else Some(reduceLeft(op))
- /** Optionally applies a binary operator to all elements of this $coll, going right to left.
+ /** Optionally applies a binary operator to all elements of this $coll, going
+ * right to left.
* $willNotTerminateInf
* $orderDependentFold
*
@@ -375,9 +383,9 @@ trait TraversableOnce[+A] {
/** Converts this $coll to an array.
* $willNotTerminateInf
*
- * @tparam B the type of the elements of the array. A `ClassManifest` for this type must
- * be available.
- * @return an array containing all elements of this $coll.
+ * @tparam B the type of the elements of the array. A `ClassManifest` for
+ * this type must be available.
+ * @return an array containing all elements of this $coll.
*
* @usecase def toArray: Array[A]
* @return an array containing all elements of this $coll.
@@ -436,15 +444,15 @@ trait TraversableOnce[+A] {
def toSet[B >: A]: immutable.Set[B] = immutable.Set() ++ self
/** Converts this $coll to a map. This method is unavailable unless
- * the elements are members of Tuple2, each ((K, V)) becoming a key-value
+ * the elements are members of Tuple2, each ((T, U)) becoming a key-value
* pair in the map. Duplicate keys will be overwritten by later keys:
* if this is an unordered collection, which key is in the resulting map
* is undefined.
* $willNotTerminateInf
- * @return a map containing all elements of this $coll.
- * @usecase def toMap: Map[K, V]
- * @return a map of type `immutable.Map[K, V]`
- * containing all key/value pairs of type `(K, V)` of this $coll.
+ * @return a map containing all elements of this $coll.
+ * @usecase def toMap[T, U]: Map[T, U]
+ * @return a map of type `immutable.Map[T, U]`
+ * containing all key/value pairs of type `(T, U)` of this $coll.
*/
def toMap[T, U](implicit ev: A <:< (T, U)): immutable.Map[T, U] = {
val b = immutable.Map.newBuilder[T, U]
@@ -454,15 +462,17 @@ trait TraversableOnce[+A] {
b.result
}
- /** Displays all elements of this $coll in a string using start, end, and separator strings.
+ /** Displays all elements of this $coll in a string using start, end, and
+ * separator strings.
*
* @param start the starting string.
* @param sep the separator string.
* @param end the ending string.
* @return a string representation of this $coll. The resulting string
* begins with the string `start` and ends with the string
- * `end`. Inside, the string representations (w.r.t. the method `toString`)
- * of all elements of this $coll are separated by the string `sep`.
+ * `end`. Inside, the string representations (w.r.t. the method
+ * `toString`) of all elements of this $coll are separated by
+ * the string `sep`.
*
* @example `List(1, 2, 3).mkString("(", "; ", ")") = "(1; 2; 3)"`
*/
@@ -481,13 +491,16 @@ trait TraversableOnce[+A] {
def mkString(sep: String): String = mkString("", sep, "")
/** Displays all elements of this $coll in a string.
+ *
* @return a string representation of this $coll. In the resulting string
* the string representations (w.r.t. the method `toString`)
- * of all elements of this $coll follow each other without any separator string.
+ * of all elements of this $coll follow each other without any
+ * separator string.
*/
def mkString: String = mkString("")
- /** Appends all elements of this $coll to a string builder using start, end, and separator strings.
+ /** Appends all elements of this $coll to a string builder using start, end,
+ * and separator strings.
* The written text begins with the string `start` and ends with the string
* `end`. Inside, the string representations (w.r.t. the method `toString`)
* of all elements of this $coll are separated by the string `sep`.
@@ -517,9 +530,10 @@ trait TraversableOnce[+A] {
b
}
- /** Appends all elements of this $coll to a string builder using a separator string.
- * The written text consists of the string representations (w.r.t. the method `toString`)
- * of all elements of this $coll, separated by the string `sep`.
+ /** Appends all elements of this $coll to a string builder using a separator
+ * string. The written text consists of the string representations (w.r.t.
+ * the method `toString`) of all elements of this $coll, separated by the
+ * string `sep`.
*
* @param b the string builder to which elements are appended.
* @param sep the separator string.
@@ -528,8 +542,8 @@ trait TraversableOnce[+A] {
def addString(b: StringBuilder, sep: String): StringBuilder = addString(b, "", sep, "")
/** Appends all elements of this $coll to a string builder.
- * The written text consists of the string representations (w.r.t. the method `toString`)
- * of all elements of this $coll without any separator string.
+ * The written text consists of the string representations (w.r.t. the method
+ * `toString`) of all elements of this $coll without any separator string.
*
* @param b the string builder to which elements are appended.
* @return the string builder `b` to which elements were appended.
diff --git a/src/library/scala/collection/generic/GenericTraversableTemplate.scala b/src/library/scala/collection/generic/GenericTraversableTemplate.scala
index d7f12cfa40..0c76e65abb 100644
--- a/src/library/scala/collection/generic/GenericTraversableTemplate.scala
+++ b/src/library/scala/collection/generic/GenericTraversableTemplate.scala
@@ -14,8 +14,9 @@ package generic
import mutable.Builder
import annotation.unchecked.uncheckedVariance
-/** A template class for companion objects of ``regular'' collection classes
+/** A template class for companion objects of ``regular`` collection classes
* that represent an unconstrained higher-kinded type.
+ *
* @tparam A The type of the collection elements.
* @tparam CC The type constructor representing the collection class.
* @author Martin Odersky
@@ -39,6 +40,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBui
def foreach[U](f: A => U): Unit
/** Selects the first element of this $coll.
+ *
* @return the first element of this $coll.
* @throws `NoSuchElementException` if the $coll is empty.
*/
@@ -65,13 +67,14 @@ trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBui
def genericBuilder[B]: Builder[B, CC[B]] = companion.newBuilder[B]
/** Converts this $coll of pairs into two collections of the first and second
- * halfs of each pair.
- * @param A1 the type of the first half of the element pairs
- * @param A2 the type of the second half of the element pairs
- * @param asPair an implicit conversion which asserts that the element type of this
- * $coll is a pair.
- * @return a pair ${coll}s, containing the first, respectively second half
- * of each element pair of this $coll.
+ * half of each pair.
+ *
+ * @param A1 the type of the first half of the element pairs
+ * @param A2 the type of the second half of the element pairs
+ * @param asPair an implicit conversion which asserts that the element type
+ * of this $coll is a pair.
+ * @return a pair ${coll}s, containing the first, respectively second
+ * half of each element pair of this $coll.
*/
def unzip[A1, A2](implicit asPair: A => /*<:<!!!*/ (A1, A2)): (CC[A1], CC[A2]) = {
val b1 = genericBuilder[A1]
@@ -86,9 +89,10 @@ trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBui
/** Converts this $coll of traversable collections into
* a $coll in which all element collections are concatenated.
+ *
* @tparam B the type of the elements of each traversable collection.
- * @param asTraversable an implicit conversion which asserts that the element type of this
- * $coll is a `Traversable`.
+ * @param asTraversable an implicit conversion which asserts that the element
+ * type of this $coll is a `Traversable`.
* @return a new $coll resulting from concatenating all element ${coll}s.
* @usecase def flatten[B]: $Coll[B]
*/
@@ -101,9 +105,10 @@ trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBui
/** Transposes this $coll of traversable collections into
* a $coll of ${coll}s.
+ *
* @tparam B the type of the elements of each traversable collection.
- * @param asTraversable an implicit conversion which asserts that the element type of this
- * $coll is a `Traversable`.
+ * @param asTraversable an implicit conversion which asserts that the
+ * element type of this $coll is a `Traversable`.
* @return a two-dimensional $coll of ${coll}s which has as ''n''th row
* the ''n''th column of this $coll.
*/
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index 6a166e365d..088d7e22cb 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -25,10 +25,9 @@ object ListMap extends ImmutableMapFactory[ListMap] {
def empty[A, B]: ListMap[A, B] = new ListMap
}
-/** This class implements immutable maps using a list-based data
- * structure. Instances of `ListMap` represent
- * empty maps; they can be either created by calling the constructor
- * directly, or by applying the function `ListMap.empty`.
+/** This class implements immutable maps using a list-based data structure.
+ * Instances of `ListMap` represent empty maps; they can be either created by
+ * calling the constructor directly, or by applying the function `ListMap.empty`.
*
* @tparam A the type of the keys in this list map.
* @tparam B the type of the values associated with the keys.
@@ -70,7 +69,8 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] {
* @param key the key element of the updated entry.
* @param value the value element of the updated entry.
*/
- override def updated [B1 >: B] (key: A, value: B1): ListMap[A, B1] = new Node[B1](key, value)
+ override def updated [B1 >: B] (key: A, value: B1): ListMap[A, B1] =
+ new Node[B1](key, value)
/** Add a key/value pair to this map.
* @param kv the key/value pair
@@ -155,11 +155,9 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] {
override def get(k: A): Option[B1] =
if (k == key) Some(value) else next.get(k)
- /** This method allows one to create a new map with an
- * additional mapping from <code>key</code>
- * to <code>value</code>. If the map contains already a
- * mapping for <code>key</code>, it will be overridden by this
- * function.
+ /** This method allows one to create a new map with an additional mapping
+ * from `key` to `value`. If the map contains already a mapping for `key`,
+ * it will be overridden by this function.
*
* @param k ...
* @param v ...
diff --git a/src/library/scala/runtime/AnyValCompanion.scala b/src/library/scala/runtime/AnyValCompanion.scala
index 0fba1cfd60..4b4fc59ae6 100644
--- a/src/library/scala/runtime/AnyValCompanion.scala
+++ b/src/library/scala/runtime/AnyValCompanion.scala
@@ -22,63 +22,63 @@ package scala.runtime
*/
sealed trait AnyValCompanion
-/** A object representing 'object scala.Unit'. It should never be used
+/** A object representing `object scala.Unit`. It should never be used
* directly.
*/
object Unit extends AnyValCompanion {
override def toString = "object scala.Unit"
}
-/** A object representing 'object scala.Boolean'. It should never be used
+/** A object representing `object scala.Boolean`. It should never be used
* directly.
*/
object Boolean extends AnyValCompanion {
override def toString = "object scala.Boolean"
}
-/** A object representing 'object scala.Byte'. It should never be used
+/** A object representing `object scala.Byte`. It should never be used
* directly.
*/
object Byte extends AnyValCompanion {
override def toString = "object scala.Byte"
}
-/** A object representing 'object scala.Short'. It should never be used
+/** A object representing `object scala.Short`. It should never be used
* directly.
*/
object Short extends AnyValCompanion {
override def toString = "object scala.Short"
}
-/** A object representing 'object scala.Char'. It should never be used
+/** A object representing `object scala.Char`. It should never be used
* directly.
*/
object Char extends AnyValCompanion {
override def toString = "object scala.Char"
}
-/** A object representing 'object scala.Int'. It should never be used
+/** A object representing `object scala.Int`. It should never be used
* directly.
*/
object Int extends AnyValCompanion {
override def toString = "object scala.Int"
}
-/** A object representing 'object scala.Long'. It should never be used
+/** A object representing `object scala.Long`. It should never be used
* directly.
*/
object Long extends AnyValCompanion {
override def toString = "object scala.Long"
}
-/** A object representing 'object scala.Float'. It should never be used
+/** A object representing `object scala.Float`. It should never be used
* directly.
*/
object Float extends AnyValCompanion {
override def toString = "object scala.Float"
}
-/** A object representing 'object scala.Double'. It should never be used
+/** A object representing `object scala.Double`. It should never be used
* directly.
*/
object Double extends AnyValCompanion {