|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| package edu.rice.cs.plt.tuple; |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| public class Octet<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple { |
|
42 |
| |
|
43 |
| protected final T1 _first; |
|
44 |
| protected final T2 _second; |
|
45 |
| protected final T3 _third; |
|
46 |
| protected final T4 _fourth; |
|
47 |
| protected final T5 _fifth; |
|
48 |
| protected final T6 _sixth; |
|
49 |
| protected final T7 _seventh; |
|
50 |
| protected final T8 _eighth; |
|
51 |
| |
|
52 |
0
| public Octet(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth) {
|
|
53 |
0
| _first = first;
|
|
54 |
0
| _second = second;
|
|
55 |
0
| _third = third;
|
|
56 |
0
| _fourth = fourth;
|
|
57 |
0
| _fifth = fifth;
|
|
58 |
0
| _sixth = sixth;
|
|
59 |
0
| _seventh = seventh;
|
|
60 |
0
| _eighth = eighth;
|
|
61 |
| } |
|
62 |
| |
|
63 |
0
| public T1 first() { return _first; }
|
|
64 |
0
| public T2 second() { return _second; }
|
|
65 |
0
| public T3 third() { return _third; }
|
|
66 |
0
| public T4 fourth() { return _fourth; }
|
|
67 |
0
| public T5 fifth() { return _fifth; }
|
|
68 |
0
| public T6 sixth() { return _sixth; }
|
|
69 |
0
| public T7 seventh() { return _seventh; }
|
|
70 |
0
| public T8 eighth() { return _eighth; }
|
|
71 |
| |
|
72 |
0
| public String toString() {
|
|
73 |
0
| return "(" + _first + ", " + _second + ", " + _third + ", " + _fourth + ", " + _fifth + ", " +
|
|
74 |
| _sixth + ", " + _seventh + ", " + _eighth + ")"; |
|
75 |
| } |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
0
| public boolean equals(Object o) {
|
|
82 |
0
| if (this == o) { return true; }
|
|
83 |
0
| else if (o == null || !getClass().equals(o.getClass())) { return false; }
|
|
84 |
| else { |
|
85 |
0
| Octet<?, ?, ?, ?, ?, ?, ?, ?> cast = (Octet<?, ?, ?, ?, ?, ?, ?, ?>) o;
|
|
86 |
0
| return
|
|
87 |
0
| (_first == null ? cast._first == null : _first.equals(cast._first)) &&
|
|
88 |
0
| (_second == null ? cast._second == null : _second.equals(cast._second)) &&
|
|
89 |
0
| (_third == null ? cast._third == null : _third.equals(cast._third)) &&
|
|
90 |
0
| (_fourth == null ? cast._fourth == null : _fourth.equals(cast._fourth)) &&
|
|
91 |
0
| (_fifth == null ? cast._fifth == null : _fifth.equals(cast._fifth)) &&
|
|
92 |
0
| (_sixth == null ? cast._sixth == null : _sixth.equals(cast._sixth)) &&
|
|
93 |
0
| (_seventh == null ? cast._seventh == null : _seventh.equals(cast._seventh)) &&
|
|
94 |
0
| (_eighth == null ? cast._eighth == null : _eighth.equals(cast._eighth));
|
|
95 |
| } |
|
96 |
| } |
|
97 |
| |
|
98 |
0
| protected int generateHashCode() {
|
|
99 |
0
| return
|
|
100 |
0
| (_first == null ? 0 : _first.hashCode()) ^
|
|
101 |
0
| (_second == null ? 0 : _second.hashCode() << 1) ^
|
|
102 |
0
| (_third == null ? 0 : _third.hashCode() << 2) ^
|
|
103 |
0
| (_fourth == null ? 0 : _fourth.hashCode() << 3) ^
|
|
104 |
0
| (_fifth == null ? 0 : _fifth.hashCode() << 4) ^
|
|
105 |
0
| (_sixth == null ? 0 : _sixth.hashCode() << 5) ^
|
|
106 |
0
| (_seventh == null ? 0 : _seventh.hashCode() << 6) ^
|
|
107 |
0
| (_eighth == null ? 0 : _eighth.hashCode() << 7) ^
|
|
108 |
| getClass().hashCode(); |
|
109 |
| } |
|
110 |
| |
|
111 |
| |
|
112 |
0
| public static <T1, T2, T3, T4, T5, T6, T7, T8>
|
|
113 |
| Octet<T1, T2, T3, T4, T5, T6, T7, T8> make(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, |
|
114 |
| T6 sixth, T7 seventh, T8 eighth) { |
|
115 |
0
| return new Octet<T1, T2, T3, T4, T5, T6, T7, T8>(first, second, third, fourth, fifth, sixth,
|
|
116 |
| seventh, eighth); |
|
117 |
| } |
|
118 |
| |
|
119 |
| } |