44
55import org .jvnet .jaxb2_commons .locator .ObjectLocator ;
66
7- public class DefaultHashCodeStrategy implements HashCodeStrategy2 ,
8- HashCodeStrategy {
7+ public class DefaultHashCodeStrategy implements HashCodeStrategy2 , HashCodeStrategy {
98
109 private int iConstant ;
1110
@@ -16,12 +15,10 @@ public DefaultHashCodeStrategy() {
1615 public DefaultHashCodeStrategy (int multiplierNonZeroOddNumber ) {
1716
1817 if (multiplierNonZeroOddNumber == 0 ) {
19- throw new IllegalArgumentException (
20- "HashCodeStrategy requires a non zero multiplier." );
18+ throw new IllegalArgumentException ("HashCodeStrategy requires a non zero multiplier." );
2119 }
2220 if (multiplierNonZeroOddNumber % 2 == 0 ) {
23- throw new IllegalArgumentException (
24- "HashCodeStrategy requires an odd multiplier." );
21+ throw new IllegalArgumentException ("HashCodeStrategy requires an odd multiplier." );
2522 }
2623 this .iConstant = multiplierNonZeroOddNumber ;
2724 }
@@ -52,14 +49,11 @@ public int hashCode(ObjectLocator locator, int hashCode, Object object) {
5249 } else if (object instanceof boolean []) {
5350 return hashCode (locator , hashCode , (boolean []) object );
5451 } else if (object instanceof HashCode2 []) {
55- return hashCodeInternal (locator , hashCode ,
56- (HashCode2 []) object );
52+ return hashCodeInternal (locator , hashCode , (HashCode2 []) object );
5753 } else if (object instanceof HashCode []) {
58- return hashCodeInternal (locator , hashCode ,
59- (HashCode []) object );
54+ return hashCodeInternal (locator , hashCode , (HashCode []) object );
6055 } else if (object instanceof Enum []) {
61- return hashCodeInternal (locator , hashCode ,
62- (Enum <?>[]) object );
56+ return hashCodeInternal (locator , hashCode , (Enum <?>[]) object );
6357 } else {
6458 // Not an array of primitives
6559 return hashCode (locator , hashCode , (Object []) object );
@@ -68,8 +62,7 @@ public int hashCode(ObjectLocator locator, int hashCode, Object object) {
6862 }
6963 }
7064
71- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
72- Object value ) {
65+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , Object value ) {
7366 if (value == null ) {
7467 return hashCode * iConstant ;
7568 } else if (value instanceof HashCode2 ) {
@@ -83,8 +76,7 @@ protected int hashCodeInternal(ObjectLocator locator, int hashCode,
8376 }
8477 }
8578
86- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
87- Enum <?> value ) {
79+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , Enum <?> value ) {
8880 if (value == null ) {
8981 return hashCode * iConstant ;
9082 } else if (value instanceof HashCode2 ) {
@@ -96,17 +88,15 @@ protected int hashCodeInternal(ObjectLocator locator, int hashCode,
9688 }
9789 }
9890
99- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
100- HashCode2 object ) {
91+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , HashCode2 object ) {
10192 if (object == null ) {
10293 return hashCode * iConstant ;
10394 } else {
10495 return hashCode * iConstant + object .hashCode (locator , this );
10596 }
10697 }
10798
108- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
109- HashCode object ) {
99+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , HashCode object ) {
110100 if (object == null ) {
111101 return hashCode * iConstant ;
112102 } else {
@@ -120,50 +110,43 @@ public int hashCode(ObjectLocator locator, int hashCode, Object[] value) {
120110 } else {
121111 int currentHashCode = hashCode * iConstant + 1 ;
122112 for (int i = 0 ; i < value .length ; i ++) {
123- currentHashCode = hashCode (item (locator , i , value [i ]),
124- currentHashCode , value [i ]);
113+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
125114 }
126115 return currentHashCode ;
127116 }
128117 }
129118
130- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
131- Enum <?>[] value ) {
119+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , Enum <?>[] value ) {
132120 if (value == null ) {
133121 return hashCode * iConstant ;
134122 } else {
135123 int currentHashCode = hashCode * iConstant + 1 ;
136124 for (int i = 0 ; i < value .length ; i ++) {
137- currentHashCode = hashCodeInternal (item (locator , i , value [i ]),
138- currentHashCode , value [i ]);
125+ currentHashCode = hashCodeInternal (item (locator , i , value [i ]), currentHashCode , value [i ]);
139126 }
140127 return currentHashCode ;
141128 }
142129 }
143130
144- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
145- HashCode2 [] value ) {
131+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , HashCode2 [] value ) {
146132 if (value == null ) {
147133 return hashCode * iConstant ;
148134 } else {
149135 int currentHashCode = hashCode * iConstant + 1 ;
150136 for (int i = 0 ; i < value .length ; i ++) {
151- currentHashCode = hashCodeInternal (item (locator , i , value [i ]),
152- currentHashCode , value [i ]);
137+ currentHashCode = hashCodeInternal (item (locator , i , value [i ]), currentHashCode , value [i ]);
153138 }
154139 return currentHashCode ;
155140 }
156141 }
157142
158- protected int hashCodeInternal (ObjectLocator locator , int hashCode ,
159- HashCode [] value ) {
143+ protected int hashCodeInternal (ObjectLocator locator , int hashCode , HashCode [] value ) {
160144 if (value == null ) {
161145 return hashCode * iConstant ;
162146 } else {
163147 int currentHashCode = hashCode * iConstant + 1 ;
164148 for (int i = 0 ; i < value .length ; i ++) {
165- currentHashCode = hashCodeInternal (item (locator , i , value [i ]),
166- currentHashCode , value [i ]);
149+ currentHashCode = hashCodeInternal (item (locator , i , value [i ]), currentHashCode , value [i ]);
167150 }
168151 return currentHashCode ;
169152 }
@@ -214,8 +197,7 @@ public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) {
214197 } else {
215198 int currentHashCode = hashCode ;
216199 for (int i = 0 ; i < value .length ; i ++) {
217- currentHashCode = hashCode (item (locator , i , value [i ]),
218- currentHashCode , value [i ]);
200+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
219201 }
220202 return currentHashCode ;
221203 }
@@ -227,8 +209,7 @@ public int hashCode(ObjectLocator locator, int hashCode, byte[] value) {
227209 } else {
228210 int currentHashCode = hashCode ;
229211 for (int i = 0 ; i < value .length ; i ++) {
230- currentHashCode = hashCode (item (locator , i , value [i ]),
231- currentHashCode , value [i ]);
212+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
232213 }
233214 return currentHashCode ;
234215 }
@@ -241,8 +222,7 @@ public int hashCode(ObjectLocator locator, int hashCode, char[] value) {
241222 } else {
242223 int currentHashCode = hashCode ;
243224 for (int i = 0 ; i < value .length ; i ++) {
244- currentHashCode = hashCode (item (locator , i , value [i ]),
245- currentHashCode , value [i ]);
225+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
246226 }
247227 return currentHashCode ;
248228 }
@@ -255,8 +235,7 @@ public int hashCode(ObjectLocator locator, int hashCode, double[] value) {
255235 } else {
256236 int currentHashCode = hashCode ;
257237 for (int i = 0 ; i < value .length ; i ++) {
258- currentHashCode = hashCode (item (locator , i , value [i ]),
259- currentHashCode , value [i ]);
238+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
260239 }
261240 return currentHashCode ;
262241 }
@@ -269,8 +248,7 @@ public int hashCode(ObjectLocator locator, int hashCode, float[] value) {
269248 } else {
270249 int currentHashCode = hashCode ;
271250 for (int i = 0 ; i < value .length ; i ++) {
272- currentHashCode = hashCode (item (locator , i , value [i ]),
273- currentHashCode , value [i ]);
251+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
274252 }
275253 return currentHashCode ;
276254 }
@@ -283,8 +261,7 @@ public int hashCode(ObjectLocator locator, int hashCode, int[] value) {
283261 } else {
284262 int currentHashCode = hashCode ;
285263 for (int i = 0 ; i < value .length ; i ++) {
286- currentHashCode = hashCode (item (locator , i , value [i ]),
287- currentHashCode , value [i ]);
264+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
288265 }
289266 return currentHashCode ;
290267 }
@@ -297,8 +274,7 @@ public int hashCode(ObjectLocator locator, int hashCode, long[] value) {
297274 } else {
298275 int currentHashCode = hashCode ;
299276 for (int i = 0 ; i < value .length ; i ++) {
300- currentHashCode = hashCode (item (locator , i , value [i ]),
301- currentHashCode , value [i ]);
277+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
302278 }
303279 return currentHashCode ;
304280 }
@@ -311,137 +287,100 @@ public int hashCode(ObjectLocator locator, int hashCode, short[] value) {
311287 } else {
312288 int currentHashCode = hashCode ;
313289 for (int i = 0 ; i < value .length ; i ++) {
314- currentHashCode = hashCode (item (locator , i , value [i ]),
315- currentHashCode , value [i ]);
290+ currentHashCode = hashCode (item (locator , i , value [i ]), currentHashCode , value [i ]);
316291 }
317292 return currentHashCode ;
318293 }
319294 }
320295
321296 @ Override
322- public int hashCode (ObjectLocator locator , int hashCode , boolean value ,
323- boolean valueSet ) {
324- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
325- hashCode * iConstant , value );
297+ public int hashCode (ObjectLocator locator , int hashCode , boolean value , boolean valueSet ) {
298+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
326299 }
327300
328301 @ Override
329- public int hashCode (ObjectLocator locator , int hashCode , byte value ,
330- boolean valueSet ) {
331- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
332- hashCode * iConstant , value );
302+ public int hashCode (ObjectLocator locator , int hashCode , byte value , boolean valueSet ) {
303+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
333304 }
334305
335306 @ Override
336- public int hashCode (ObjectLocator locator , int hashCode , char value ,
337- boolean valueSet ) {
338- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
339- hashCode * iConstant , value );
307+ public int hashCode (ObjectLocator locator , int hashCode , char value , boolean valueSet ) {
308+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
340309 }
341310
342311 @ Override
343- public int hashCode (ObjectLocator locator , int hashCode , double value ,
344- boolean valueSet ) {
345- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
346- hashCode * iConstant , value );
312+ public int hashCode (ObjectLocator locator , int hashCode , double value , boolean valueSet ) {
313+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
347314 }
348315
349316 @ Override
350- public int hashCode (ObjectLocator locator , int hashCode , float value ,
351- boolean valueSet ) {
352- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
353- hashCode * iConstant , value );
317+ public int hashCode (ObjectLocator locator , int hashCode , float value , boolean valueSet ) {
318+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
354319 }
355320
356321 @ Override
357- public int hashCode (ObjectLocator locator , int hashCode , int value ,
358- boolean valueSet ) {
359- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
360- hashCode * iConstant , value );
322+ public int hashCode (ObjectLocator locator , int hashCode , int value , boolean valueSet ) {
323+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
361324 }
362325
363326 @ Override
364- public int hashCode (ObjectLocator locator , int hashCode , long value ,
365- boolean valueSet ) {
366- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
367- hashCode * iConstant , value );
327+ public int hashCode (ObjectLocator locator , int hashCode , long value , boolean valueSet ) {
328+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
368329 }
369330
370331 @ Override
371- public int hashCode (ObjectLocator locator , int hashCode , short value ,
372- boolean valueSet ) {
373- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
374- hashCode * iConstant , value );
332+ public int hashCode (ObjectLocator locator , int hashCode , short value , boolean valueSet ) {
333+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
375334 }
376335
377336 @ Override
378- public int hashCode (ObjectLocator locator , int hashCode , Object value ,
379- boolean valueSet ) {
380- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
381- hashCode * iConstant , value );
337+ public int hashCode (ObjectLocator locator , int hashCode , Object value , boolean valueSet ) {
338+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
382339 }
383340
384341 @ Override
385- public int hashCode (ObjectLocator locator , int hashCode , boolean [] value ,
386- boolean valueSet ) {
387- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
388- hashCode * iConstant , value );
342+ public int hashCode (ObjectLocator locator , int hashCode , boolean [] value , boolean valueSet ) {
343+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
389344 }
390345
391346 @ Override
392- public int hashCode (ObjectLocator locator , int hashCode , byte [] value ,
393- boolean valueSet ) {
394- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
395- hashCode * iConstant , value );
347+ public int hashCode (ObjectLocator locator , int hashCode , byte [] value , boolean valueSet ) {
348+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
396349 }
397350
398351 @ Override
399- public int hashCode (ObjectLocator locator , int hashCode , char [] value ,
400- boolean valueSet ) {
401- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
402- hashCode * iConstant , value );
352+ public int hashCode (ObjectLocator locator , int hashCode , char [] value , boolean valueSet ) {
353+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
403354 }
404355
405356 @ Override
406- public int hashCode (ObjectLocator locator , int hashCode , double [] value ,
407- boolean valueSet ) {
408- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
409- hashCode * iConstant , value );
357+ public int hashCode (ObjectLocator locator , int hashCode , double [] value , boolean valueSet ) {
358+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
410359 }
411360
412361 @ Override
413- public int hashCode (ObjectLocator locator , int hashCode , float [] value ,
414- boolean valueSet ) {
415- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
416- hashCode * iConstant , value );
362+ public int hashCode (ObjectLocator locator , int hashCode , float [] value , boolean valueSet ) {
363+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
417364 }
418365
419366 @ Override
420- public int hashCode (ObjectLocator locator , int hashCode , int [] value ,
421- boolean valueSet ) {
422- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
423- hashCode * iConstant , value );
367+ public int hashCode (ObjectLocator locator , int hashCode , int [] value , boolean valueSet ) {
368+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
424369 }
425370
426371 @ Override
427- public int hashCode (ObjectLocator locator , int hashCode , long [] value ,
428- boolean valueSet ) {
429- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
430- hashCode * iConstant , value );
372+ public int hashCode (ObjectLocator locator , int hashCode , long [] value , boolean valueSet ) {
373+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
431374 }
432375
433376 @ Override
434- public int hashCode (ObjectLocator locator , int hashCode , short [] value ,
435- boolean valueSet ) {
436- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
437- hashCode * iConstant , value );
377+ public int hashCode (ObjectLocator locator , int hashCode , short [] value , boolean valueSet ) {
378+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
438379 }
439380
440381 @ Override
441- public int hashCode (ObjectLocator locator , int hashCode , Object [] value ,
442- boolean valueSet ) {
443- return valueSet ? (hashCode * iConstant + 1 ) : hashCode (locator ,
444- hashCode * iConstant , value );
382+ public int hashCode (ObjectLocator locator , int hashCode , Object [] value , boolean valueSet ) {
383+ return valueSet ? hashCode (locator , hashCode * iConstant , value ) : (hashCode * iConstant + 1 );
445384 }
446385
447386 public static final DefaultHashCodeStrategy INSTANCE = new DefaultHashCodeStrategy ();
0 commit comments