summaryrefslogtreecommitdiff
path: root/src/library/scala/Product.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-11-24 14:13:22 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-11-24 14:13:22 +0000
commit46d1d8e55aa40037a536767f0ae8d98665c73617 (patch)
tree635ce305529fb8f8fee99ff953f48f8fa4fb1251 /src/library/scala/Product.scala
parent30b26d84b36af69738f2770069924b087736df09 (diff)
downloadscala-46d1d8e55aa40037a536767f0ae8d98665c73617.tar.gz
scala-46d1d8e55aa40037a536767f0ae8d98665c73617.tar.bz2
scala-46d1d8e55aa40037a536767f0ae8d98665c73617.zip
Applied patch from davetron5000, improving docu...
Applied patch from davetron5000, improving documentation on ProductN and FunctionN traits. Closes #4021.
Diffstat (limited to 'src/library/scala/Product.scala')
-rw-r--r--src/library/scala/Product.scala17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/library/scala/Product.scala b/src/library/scala/Product.scala
index b7dd6cf728..cf789ce176 100644
--- a/src/library/scala/Product.scala
+++ b/src/library/scala/Product.scala
@@ -6,12 +6,9 @@
** |/ **
\* */
-
-
package scala
-/** The trait <code>Product</code> defines access functions for instances
- * of products, in particular case classes.
+/** Base trait for all products. See [[scala.Product2]].
*
* @author Burak Emir
* @version 1.0
@@ -19,8 +16,9 @@ package scala
*/
trait Product extends Equals {
- /** For a product <code>A(x_1,...,x_k)</code>, returns <code>x_(n+1)</code>
- * for <code>0 &lt;= n &lt; k</code>
+ /** Returns the nth element of this product, 0-based. In other words, for a
+ * product <code>A(x_1,...,x_k)</code>, returns <code>x_(n+1)</code>
+ * where <code>0 &lt;= n &lt; k</code>
*
* @param n the index of the element to return
* @throws IndexOutOfBoundsException
@@ -28,7 +26,8 @@ trait Product extends Equals {
*/
def productElement(n: Int): Any
- /** return k for a product <code>A(x_1,...,x_k)</code>
+ /** Returns the size of this product.
+ * @return For a product <code>A(x_1,...,x_k)</code>, returns `k`
*/
def productArity: Int
@@ -44,9 +43,11 @@ trait Product extends Equals {
def productElements: Iterator[Any] = productIterator
/**
- * By default the empty string. Implementations may override this
+ * Returns a string that is used in the `toString` method of subtraits/classes.
+ * Implementations may override this
* method in order to prepend a string prefix to the result of the
* toString methods.
+ * @return the empty string
*/
def productPrefix = ""
}