|
1 | 1 | package scala
|
2 | 2 | import java.util.Arrays.{deepEquals, deepHashCode}
|
3 | 3 |
|
4 |
| -final class TupleXXL private (es: Array[Object]) extends Product { |
| 4 | +final class TupleXXL private (es: IArray[Object]) extends Product { |
5 | 5 | assert(es.length > 22)
|
6 | 6 |
|
7 | 7 | def productElement(n: Int): Any = es(n)
|
8 | 8 | def productArity: Int = es.length
|
9 | 9 |
|
10 |
| - override def toString = elems.mkString("(", ",", ")") |
11 |
| - override def hashCode = getClass.hashCode * 41 + deepHashCode(elems) |
| 10 | + override def toString = elems.asInstanceOf[Array[Object]].mkString("(", ",", ")") |
| 11 | + override def hashCode = getClass.hashCode * 41 + deepHashCode(elems.asInstanceOf[Array[Object]]) |
12 | 12 | override def canEqual(that: Any): Boolean = that match {
|
13 | 13 | case that: TupleXXL => that.productArity == this.productArity
|
14 | 14 | case _ => false
|
15 | 15 | }
|
16 | 16 |
|
17 | 17 | override def equals(that: Any) = that match {
|
18 |
| - case that: TupleXXL => deepEquals(this.elems, that.elems) |
| 18 | + case that: TupleXXL => deepEquals(this.elems.asInstanceOf[Array[Object]], that.elems.asInstanceOf[Array[Object]]) |
19 | 19 | case _ => false
|
20 | 20 | }
|
21 |
| - def elems: Array[Object] = es |
| 21 | + def elems: IArray[Object] = es |
22 | 22 |
|
23 | 23 | def tailXXL: TupleXXL = {
|
24 | 24 | assert(es.length > 23)
|
25 |
| - new TupleXXL(es.tail) |
| 25 | + new TupleXXL(es.asInstanceOf[Array[Object]].tail.asInstanceOf[IArray[Object]]) |
26 | 26 | }
|
27 | 27 |
|
28 |
| - def toArray: Array[Object] = es.clone |
| 28 | + def toArray: Array[Object] = es.asInstanceOf[Array[Object]].clone |
29 | 29 | }
|
30 | 30 | object TupleXXL {
|
31 |
| - def fromIterator(elems: Iterator[Any]) = new TupleXXL(elems.map(_.asInstanceOf[Object]).toArray) |
32 |
| - def apply(elems: Array[Object]) = new TupleXXL(elems.clone) |
33 |
| - def apply(elems: Any*) = new TupleXXL(elems.asInstanceOf[Seq[Object]].toArray) |
34 |
| - def unapplySeq(x: TupleXXL): Option[Seq[Any]] = Some(x.elems.toSeq) |
| 31 | + def fromIterator(elems: Iterator[Any]) = new TupleXXL(elems.map(_.asInstanceOf[Object]).toArray.asInstanceOf[IArray[Object]]) |
| 32 | + def fromIArray(elems: IArray[Object]) = new TupleXXL(elems) |
| 33 | + def apply(elems: Array[Object]) = new TupleXXL(elems.clone.asInstanceOf[IArray[Object]]) |
| 34 | + def apply(elems: Any*) = new TupleXXL(elems.asInstanceOf[Seq[Object]].toArray.asInstanceOf[IArray[Object]]) |
| 35 | + def unapplySeq(x: TupleXXL): Option[Seq[Any]] = Some(x.elems.asInstanceOf[Array[Object]].toSeq) |
35 | 36 | }
|
0 commit comments