1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.dbunit.ext.oracle;
23
24 import java.math.BigDecimal;
25
26
27
28
29
30
31
32
33
34
35 class OracleSdoHelper
36 {
37 public static boolean objectsEqual(Object object1, Object object2)
38 {
39 return
40 (object1 != null && object1.equals(object2)) ||
41 (object1 == null && object2 == null) ||
42
43 (object1 != null && object2 != null &&
44 object1 instanceof BigDecimal && object2 instanceof BigDecimal &&
45 ((BigDecimal)object1).compareTo((BigDecimal)object2) == 0);
46 }
47
48 public static boolean objectArraysEquals(Object [] objects1, Object [] objects2)
49 {
50 if (objects1 == objects2)
51 {
52 return true;
53 }
54
55 if (objects1 == null || objects2 == null || objects1.length != objects2.length)
56 {
57 return false;
58 }
59
60 for (int index = 0; index<objects1.length; index++)
61 {
62 if (! objectsEqual(objects1[index], objects2[index]))
63 {
64 return false;
65 }
66 }
67
68 return true;
69 }
70
71 public static int objectArrayHashCode(Object [] objects)
72 {
73 int hash = 7;
74 if (objects != null)
75 {
76 for (int index = 0; index<objects.length; index++)
77 {
78 hash = 31 * hash + (null == objects[index] ? 0 : objects[index].hashCode());
79 }
80 }
81 return hash;
82 }
83 }