summaryrefslogtreecommitdiff
path: root/src/dotnet-library/scala/Product.scala
blob: 75ffa84378a665e470e3385ca9346291cc03409c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002-2006, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$


package scala

/** The trait <code>Product</code> defines access functions for instances
 *  of products, in particular case classes.
 *
 *  @author  Burak Emir
 *  @version 1.0
 */
trait Product extends AnyRef {

  /** for a case class <code>A(x_1,...,x_k))</code>, returns <code>x_(i+1)</code>
   *  for <code>0 &lt;= i &lt; k</code>
   *
   *  @param  n the position of the n-th element
   *  @throws IndexOutOfBoundsException
   *  @return  ...
   */
  def element(n: Int): Any

  /** return k for a product <code>A(x_1,...,x_k))</code>
   */
  def arity: Int

  /**
   *  By default the empty string. Implementations may override this
   *  method in order to prepend a string prefix to the result of the
   *  toString methods.
   */
  def productPrefix = ""

}