From 5bb26aa18d774162828693bb8c4fcc246359ecf5 Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Thu, 12 Apr 2007 14:30:11 +0000 Subject: renamed arity=>productArity,element=>productEle... renamed arity=>productArity,element=>productElement --- src/build/genprod.scala | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/build/genprod.scala') diff --git a/src/build/genprod.scala b/src/build/genprod.scala index ae74e82f00..367809b847 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -26,6 +26,7 @@ object genprod { val SUP_PRODUCT_ARITY = 23 val SUP_TUPLE_ARITY = 23 val SUP_FUNCTION_ARITY = 9 + val SUP_CHOICE_ARITY = 9 // not implemented yet def productClassname(i: Int) = "Product"+i @@ -39,6 +40,10 @@ object genprod { def functionFilename(i: Int) = functionClassname(i)+".scala" + def choiceClassname(i: Int) = "Choice"+i + + def choiceFilename(i: Int) = choiceClassname(i)+".scala" + def targs(i: Int) = for (val j <- List.range(1, i+1)) yield "T" + j @@ -82,6 +87,9 @@ object genprod { def functionFiles = for(val i <- List.range(0, SUP_FUNCTION_ARITY)) yield FunctionFile.make(i) + //def choiceFiles = + // for(val i <- List.range(2, SUP_CHOICE_ARITY)) yield ChoiceFile.make(i) + def allfiles = productFiles ::: tupleFiles ::: functionFiles @@ -303,7 +311,23 @@ trait {productClassname(i)}{__typeArgs__} extends Product {{ * The arity of this product. * @return {i} */ - override def arity = {i} + @deprecated override def arity = productArity + + /** + * The arity of this product. + * @return {i} + */ + override def productArity = {i} + + /** + * Returns the n-th projection of this product if 0&lt;=n&lt;arity, + * otherwise null. + * + * @param n number of the projection to be returned + * @return same as _(n+1) + * @throws IndexOutOfBoundsException + */ + @deprecated override def element(n: Int) = productElement(n) /** * Returns the n-th projection of this product if 0&lt;=n&lt;arity, @@ -313,7 +337,7 @@ trait {productClassname(i)}{__typeArgs__} extends Product {{ * @return same as _(n+1) * @throws IndexOutOfBoundsException */ - override def element(n: Int) = n match {{ + override def productElement(n: Int) = n match {{ {for(val Tuple2(m, j) <- mdefs(i).zip(List.range(0, i))) yield "case "+j+" => "+m+"\n "}case _ => throw new IndexOutOfBoundsException(n.toString()) }} -- cgit v1.2.3