1 package org.davidmoten.rx.jdbc.tuple;
2
3
4
5
6
7
8
9
10
11 public class Tuple4<T1, T2, T3, T4> {
12
13 private final T1 value1;
14 private final T2 value2;
15 private final T3 value3;
16 private final T4 value4;
17
18
19
20
21
22
23
24
25
26 public Tuple4(T1 value1, T2 value2, T3 value3, T4 value4) {
27 this.value1 = value1;
28 this.value2 = value2;
29 this.value3 = value3;
30 this.value4 = value4;
31 }
32
33 public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> create(T1 value1, T2 value2, T3 value3, T4 value4) {
34 return new Tuple4<T1, T2, T3, T4>(value1, value2, value3, value4);
35 }
36
37 public T1 value1() {
38 return value1;
39 }
40
41 public T2 value2() {
42 return value2;
43 }
44
45 public T3 value3() {
46 return value3;
47 }
48
49 public T4 value4() {
50 return value4;
51 }
52
53 public T1 _1() {
54 return value1;
55 }
56
57 public T2 _2() {
58 return value2;
59 }
60
61 public T3 _3() {
62 return value3;
63 }
64
65 public T4 _4() {
66 return value4;
67 }
68
69 @Override
70 public int hashCode() {
71 final int prime = 31;
72 int result = 1;
73 result = prime * result + ((value1 == null) ? 0 : value1.hashCode());
74 result = prime * result + ((value2 == null) ? 0 : value2.hashCode());
75 result = prime * result + ((value3 == null) ? 0 : value3.hashCode());
76 result = prime * result + ((value4 == null) ? 0 : value4.hashCode());
77 return result;
78 }
79
80 @Override
81 public boolean equals(Object obj) {
82 if (this == obj)
83 return true;
84 if (obj == null)
85 return false;
86 if (getClass() != obj.getClass())
87 return false;
88 Tuple4<?, ?, ?, ?> other = (Tuple4<?, ?, ?, ?>) obj;
89 if (value1 == null) {
90 if (other.value1 != null)
91 return false;
92 } else if (!value1.equals(other.value1))
93 return false;
94 if (value2 == null) {
95 if (other.value2 != null)
96 return false;
97 } else if (!value2.equals(other.value2))
98 return false;
99 if (value3 == null) {
100 if (other.value3 != null)
101 return false;
102 } else if (!value3.equals(other.value3))
103 return false;
104 if (value4 == null) {
105 if (other.value4 != null)
106 return false;
107 } else if (!value4.equals(other.value4))
108 return false;
109 return true;
110 }
111
112 @Override
113 public String toString() {
114 return "Tuple4 [value1=" + value1 + ", value2=" + value2 + ", value3=" + value3 + ", value4=" + value4 + "]";
115 }
116
117 }