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/Product5.scala | |
parent | 9d507e381c8c101a3edf16e0c065e9b8efd5feec (diff) | |
download | scala-1e23988361e85f275b44041207988ef9aa0099f2.tar.gz scala-1e23988361e85f275b44041207988ef9aa0099f2.tar.bz2 scala-1e23988361e85f275b44041207988ef9aa0099f2.zip |
caseclass->product
Diffstat (limited to 'src/library/scala/Product5.scala')
-rw-r--r-- | src/library/scala/Product5.scala | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala index 0229c9f495..ffd29713d1 100644 --- a/src/library/scala/Product5.scala +++ b/src/library/scala/Product5.scala @@ -7,16 +7,49 @@ ** |/ ** \* */ -// 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 Product5 [+T1, +T2, +T3, +T4, +T5] { +/** Product5 is a cartesian product of 5 components + */ +trait Product5 [+T1, +T2, +T3, +T4, +T5] extends Product { + + /** + * The arity of this product. + * @return 5 + */ + override def arity = 5 + + /** + * 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 2 => _2 + case 3 => _3 + case 4 => _4 + case 5 => _5 + case _ => throw new IndexOutOfBoundsException(n.toString()) + } + + /** projection of this product */ def _1:T1 + + /** projection of this product */ def _2:T2 + + /** projection of this product */ def _3:T3 + + /** projection of this product */ def _4:T4 + + /** projection of this product */ def _5:T5 + } |