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
36
37
38 package junitx.ddtunit.resources;
39
40 import java.util.Date;
41
42
43
44
45
46
47
48 public class SimpleVO {
49 private static final String LF = System.getProperty("line.separator");
50
51 private Integer integerValue;
52
53 private String stringValue;
54
55 private Double doubleValue;
56
57 private Date dateValue;
58
59 private SimpleVO simpleVO;
60
61 private Integer[] integerArray;
62
63
64
65
66 public SimpleVO() {
67
68 }
69
70
71
72
73
74 public SimpleVO(String text) {
75 this.stringValue = text;
76 }
77
78
79
80
81
82
83
84 public SimpleVO(String text, Integer intValue, Double doubleValue) {
85 this.stringValue = text;
86 this.integerValue = intValue;
87 this.doubleValue = doubleValue;
88 }
89
90
91
92
93 public String toString() {
94 StringBuffer sb = new StringBuffer("SimpleVO:");
95
96 sb.append(LF).append(" textValue=\"").append(stringValue).append("\"");
97 sb.append(LF).append(" integerValue=\"").append(integerValue).append(
98 "\"");
99 sb.append(LF).append(" doubleValue=\"").append(doubleValue).append(
100 "\"");
101
102 return sb.toString();
103 }
104
105
106
107
108 public boolean equals(Object object) {
109 boolean check = false;
110
111 if (SimpleVO.class.isInstance(object)) {
112 SimpleVO vo = (SimpleVO) object;
113
114 if ((((this.integerValue != null) && this.integerValue.equals(vo
115 .getIntegerValue())) || ((this.integerValue == null) && (vo
116 .getIntegerValue() == null)))
117 && (((this.doubleValue != null) && this.doubleValue
118 .equals(vo.getDoubleValue())) || ((this.doubleValue == null) && (vo
119 .getDoubleValue() == null)))
120 && (((this.stringValue != null) && this.stringValue
121 .equals(vo.getStringValue())) || ((this.stringValue == null) && (vo
122 .getStringValue() == null)))
123 && (((this.dateValue != null) && this.dateValue.equals(vo
124 .getDateValue())) || ((this.dateValue == null) && (vo
125 .getDateValue() == null)))) {
126 check = true;
127 }
128 }
129
130 return check;
131 }
132
133
134
135
136 public int hashCode() {
137 final int CONST_VAL = 42;
138 int hashVal = CONST_VAL;
139 if (this.stringValue != null) {
140 hashVal = hashVal + this.stringValue.hashCode();
141 }
142 if (this.integerValue != null) {
143 hashVal = (CONST_VAL * hashVal) + this.integerValue.intValue();
144 }
145 if (this.doubleValue != null) {
146 hashVal = (CONST_VAL * hashVal) + this.doubleValue.intValue();
147 }
148 if (this.dateValue != null) {
149 hashVal = (int) ((CONST_VAL * hashVal) + this.dateValue.getTime());
150 }
151 return hashVal;
152 }
153
154
155
156
157 public Double getDoubleValue() {
158 return doubleValue;
159 }
160
161
162
163
164 public void setDoubleValue(Double doubleValue) {
165 this.doubleValue = new Double(doubleValue.doubleValue() * 10.0);
166 }
167
168
169
170
171 public Integer getIntegerValue() {
172 return integerValue;
173 }
174
175
176
177
178 public void setIntegerValue(Integer integerValue) {
179 this.integerValue = new Integer(integerValue.intValue() * 10);
180 }
181
182
183
184
185 public String getStringValue() {
186 return stringValue;
187 }
188
189
190
191
192 public void setStringValue(String stringValue) {
193 this.stringValue = stringValue;
194 }
195
196 public Date getDateValue() {
197 return this.dateValue;
198 }
199
200 public void setDateValue(Date dateValue) {
201 this.dateValue = dateValue;
202 }
203 }