diff options
author | Burak Emir <emir@epfl.ch> | 2006-11-05 02:53:14 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-11-05 02:53:14 +0000 |
commit | 1e23988361e85f275b44041207988ef9aa0099f2 (patch) | |
tree | 167c7224dfbec04561337d771226fd678a3d1ae0 /src/library/scala/Product1.scala | |
parent | 9d507e381c8c101a3edf16e0c065e9b8efd5feec (diff) | |
download | scala-1e23988361e85f275b44041207988ef9aa0099f2.tar.gz scala-1e23988361e85f275b44041207988ef9aa0099f2.tar.bz2 scala-1e23988361e85f275b44041207988ef9aa0099f2.zip |
caseclass->product
Diffstat (limited to 'src/library/scala/Product1.scala')
-rw-r--r-- | src/library/scala/Product1.scala | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala index 9f4860041c..944a49534b 100644 --- a/src/library/scala/Product1.scala +++ b/src/library/scala/Product1.scala @@ -7,12 +7,33 @@ ** |/ ** \* */ -// generated on Fri Oct 27 18:56:23 CEST 2006 +// generated on Sun Nov 05 03:50:36 CET 2006 package scala import Predef._ -trait Product1 [+T1] { +/** Product1 is a cartesian product of 1 components + */ +trait Product1 [+T1] extends Product { + + /** + * The arity of this product. + * @return 1 + */ + override def arity = 1 + + /** + * Returns the n-th projection of this product if 0<n<=arity, otherwise null + * @param n number of the projection to be returned + * @throws IndexOutOfBoundsException + */ + override def element(n: Int) = n match { + case 1 => _1 + case _ => throw new IndexOutOfBoundsException(n.toString()) + } + + /** projection of this product */ def _1:T1 + } |