|
| 1 | +package io.continuum.bokeh |
| 2 | + |
| 3 | +trait Row[R, V] { |
| 4 | + def toList(obj: R): List[V] |
| 5 | +} |
| 6 | +object Row { |
| 7 | + implicit def Tuple1Row[V]: Row[Tuple1[V], V] = new Row[Tuple1[V], V] { |
| 8 | + def toList(t: Tuple1[V]) = List(t._1) |
| 9 | + } |
| 10 | + implicit def Tuple2Row[V]: Row[Tuple2[V, V], V] = new Row[Tuple2[V, V], V] { |
| 11 | + def toList(t: Tuple2[V, V]) = List(t._1, t._2) |
| 12 | + } |
| 13 | + implicit def Tuple3Row[V]: Row[Tuple3[V, V, V], V] = new Row[Tuple3[V, V, V], V] { |
| 14 | + def toList(t: Tuple3[V, V, V]) = List(t._1, t._2, t._3) |
| 15 | + } |
| 16 | + implicit def Tuple4Row[V]: Row[Tuple4[V, V, V, V], V] = new Row[Tuple4[V, V, V, V], V] { |
| 17 | + def toList(t: Tuple4[V, V, V, V]) = List(t._1, t._2, t._3, t._4) |
| 18 | + } |
| 19 | + implicit def Tuple5Row[V]: Row[Tuple5[V, V, V, V, V], V] = new Row[Tuple5[V, V, V, V, V], V] { |
| 20 | + def toList(t: Tuple5[V, V, V, V, V]) = List(t._1, t._2, t._3, t._4, t._5) |
| 21 | + } |
| 22 | + implicit def Tuple6Row[V]: Row[Tuple6[V, V, V, V, V, V], V] = new Row[Tuple6[V, V, V, V, V, V], V] { |
| 23 | + def toList(t: Tuple6[V, V, V, V, V, V]) = List(t._1, t._2, t._3, t._4, t._5, t._6) |
| 24 | + } |
| 25 | + implicit def Tuple7Row[V]: Row[Tuple7[V, V, V, V, V, V, V], V] = new Row[Tuple7[V, V, V, V, V, V, V], V] { |
| 26 | + def toList(t: Tuple7[V, V, V, V, V, V, V]) = List(t._1, t._2, t._3, t._4, t._5, t._6, t._7) |
| 27 | + } |
| 28 | + implicit def Tuple8Row[V]: Row[Tuple8[V, V, V, V, V, V, V, V], V] = new Row[Tuple8[V, V, V, V, V, V, V, V], V] { |
| 29 | + def toList(t: Tuple8[V, V, V, V, V, V, V, V]) = List(t._1, t._2, t._3, t._4, t._5, t._6, t._7, t._8) |
| 30 | + } |
| 31 | + implicit def Tuple9Row[V]: Row[Tuple9[V, V, V, V, V, V, V, V, V], V] = new Row[Tuple9[V, V, V, V, V, V, V, V, V], V] { |
| 32 | + def toList(t: Tuple9[V, V, V, V, V, V, V, V, V]) = List(t._1, t._2, t._3, t._4, t._5, t._6, t._7, t._8, t._9) |
| 33 | + } |
| 34 | +} |
0 commit comments