@@ -29,7 +29,7 @@ object BufferableGenerator {
2929 def typeList (cnt : Int ) =
3030 upperLetters.slice(0 , cnt) map { _.toString } mkString(" ," )
3131
32- def parensTypeList (cnt : Int ) = " ( " + typeList(cnt) + " ) "
32+ def tupleTypeList (cnt : Int ) = " Tuple " + cnt + " [ " + typeList(cnt) + " ] "
3333
3434 def reallocatingPut (idx : Int ) =
3535 " nextBb = reallocatingPut(nextBb) { b" + lowerLetters(idx) + " .put(_, tup._" + (idx+ 1 ) + " ) }"
@@ -46,15 +46,15 @@ object BufferableGenerator {
4646 def implicitTuple (cnt : Int ): String =
4747 " implicit def tuple" + cnt + " [" + typeList(cnt) + " ](implicit " +
4848 ((0 until cnt) map { bufferableParam(_) } mkString(" , " ) ) + " ):\n " +
49- " Bufferable[" + parensTypeList (cnt) + " ] = new AbstractBufferable[" + parensTypeList (cnt) + " ] {\n " +
50- " def put(bytebuf: ByteBuffer, tup: " + parensTypeList (cnt) + " ) = {\n " +
49+ " Bufferable[" + tupleTypeList (cnt) + " ] = new AbstractBufferable[" + tupleTypeList (cnt) + " ] {\n " +
50+ " def put(bytebuf: ByteBuffer, tup: " + tupleTypeList (cnt) + " ) = {\n " +
5151 " var nextBb = bytebuf\n " +
5252 " " + ((0 until cnt) map { reallocatingPut(_) }).mkString(" " ," \n " ," \n " ) +
5353 " nextBb\n " +
5454 " }\n " +
5555 " def get(bytebuf: ByteBuffer) = attempt(bytebuf) { bytebuf =>\n " +
5656 " " + ((0 until cnt) map { bufferGet(_) }).mkString(" " ," \n " ," \n " ) +
57- " val res = " + (0 until cnt).map { lowerLetters(_) }.mkString(" (" ," , " ," )" ) + " \n " +
57+ " val res = Tuple " + cnt + (0 until cnt).map { lowerLetters(_) }.mkString(" (" ," , " ," )" ) + " \n " +
5858 " (buf" + lowerLetters(cnt - 1 ) + " , res)\n " +
5959 " }\n " +
6060 " }"
@@ -69,7 +69,7 @@ object BufferableGenerator {
6969 b.append(" import com.twitter.bijection.Inversion.attempt\n " )
7070
7171 b.append(" \n trait GeneratedTupleBufferable {\n " )
72- (2 to 22 ).foreach { cnt => b.append(implicitTuple(cnt)).append(" \n " ) }
72+ (1 to 22 ).foreach { cnt => b.append(implicitTuple(cnt)).append(" \n " ) }
7373 b.append(" }" )
7474
7575 b.toString
0 commit comments