Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
20   103   13   4
16   42   0.65   5
5     2.6  
1    
 
  EqualsUtility       Line # 26 20 13 97.6% 0.9756098
 
  (499)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.base.utility;
17   
18    import java.util.Arrays;
19   
20   
21    /**
22    * A collection of useful static methods for equality.
23    *
24    * @author Michael Meyling
25    */
 
26    public final class EqualsUtility {
27   
28    /**
29    * Constructor, should never be called.
30    */
 
31  0 toggle private EqualsUtility() {
32    // don't call me
33    }
34   
35    /**
36    * Compare two objects, each of them could be <code>null</code>.
37    *
38    * @param a First parameter.
39    * @param b Second parameter.
40    * @return Are <code>a</code> and <code>b</code> equal?
41    */
 
42  90409714 toggle public static boolean equals(final Object a, final Object b) {
43  90409714 if (a == null) {
44  3369 if (b == null) {
45  3019 return true;
46    }
47  350 return false;
48    }
49  90406345 return a.equals(b);
50    }
51   
52    /**
53    * Compare two objects, each of them could be <code>null</code>.
54    *
55    * @param a First parameter.
56    * @param b Second parameter.
57    * @return Are <code>a</code> and <code>b</code> equal?
58    */
 
59  42 toggle public static boolean equals(final Object[] a, final Object[] b) {
60  42 if (a == null) {
61  3 if (b == null) {
62  1 return true;
63    }
64  2 return false;
65    }
66  39 return Arrays.equals(a, b);
67    }
68   
69    /**
70    * Compare two objects, each of them could be <code>null</code>.
71    *
72    * @param a First parameter.
73    * @param b Second parameter.
74    * @return Are <code>a</code> and <code>b</code> equal?
75    */
 
76  14 toggle public static boolean equals(final byte[] a, final byte[] b) {
77  14 if (a == null) {
78  3 if (b == null) {
79  1 return true;
80    }
81  2 return false;
82    }
83  11 return Arrays.equals(a, b);
84    }
85   
86    /**
87    * Compare two objects, each of them could be <code>null</code>.
88    *
89    * @param a First parameter.
90    * @param b Second parameter.
91    * @return Are <code>a</code> and <code>b</code> equal?
92    */
 
93  13 toggle public static boolean equals(final int[] a, final int[] b) {
94  13 if (a == null) {
95  3 if (b == null) {
96  1 return true;
97    }
98  2 return false;
99    }
100  10 return Arrays.equals(a, b);
101    }
102   
103    }