Line | Hits | Source |
---|---|---|
1 | /* | |
2 | ||
3 | * Created on 08.01.2004 | |
4 | ||
5 | */ | |
6 | ||
7 | package net.sourceforge.demetrix.util; | |
8 | ||
9 | ||
10 | ||
11 | /** | |
12 | ||
13 | * @author Dimitri Pissarenko | |
14 | ||
15 | * | |
16 | ||
17 | */ | |
18 | ||
19 | ||
20 | ||
21 | import java.util.Collection; | |
22 | ||
23 | ||
24 | ||
25 | 0 | public class ObjectComparator { |
26 | ||
27 | public static boolean areEqual(Object obj1, Object obj2) { | |
28 | ||
29 | 1088 | boolean areEqual = false; |
30 | ||
31 | 1088 | if ((obj1 == null) && (obj2 == null)) { |
32 | ||
33 | 13 | areEqual = true; |
34 | ||
35 | 1075 | } else if ((obj1 == null) && (obj2 != null)) { |
36 | ||
37 | 0 | areEqual = false; |
38 | ||
39 | 1075 | } else if ((obj1 != null) && (obj2 == null)) { |
40 | ||
41 | 0 | areEqual = false; |
42 | ||
43 | 1075 | } else if (obj1.equals(obj2)) { |
44 | ||
45 | 695 | areEqual = true; |
46 | ||
47 | } | |
48 | ||
49 | 1088 | return areEqual; |
50 | ||
51 | } | |
52 | ||
53 | public static boolean areEqualIrrespectiveOfOrder( | |
54 | ||
55 | Collection obj1, | |
56 | ||
57 | Collection obj2) { | |
58 | ||
59 | 394 | boolean areEqual = false; |
60 | ||
61 | 394 | if ((obj1 == null) && (obj2 == null)) { |
62 | ||
63 | 0 | areEqual = true; |
64 | ||
65 | 394 | } else if ((obj1 == null) && (obj2 != null)) { |
66 | ||
67 | 0 | areEqual = false; |
68 | ||
69 | 394 | } else if ((obj1 != null) && (obj2 == null)) { |
70 | ||
71 | 0 | areEqual = false; |
72 | ||
73 | 394 | } else if (obj1.containsAll(obj2) && obj2.containsAll(obj1)) { |
74 | ||
75 | 68 | areEqual = true; |
76 | ||
77 | } | |
78 | ||
79 | 394 | return areEqual; |
80 | ||
81 | } | |
82 | ||
83 | ||
84 | ||
85 | } | |
86 |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |