|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| EqualsUtility.java | 100% | 100% | 50% | 90,9% |
|
||||||||||||||
| 1 | /* $Id: EqualsUtility.java,v 1.4 2006/10/20 20:23:08 m31 Exp $ | |
| 2 | * | |
| 3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
| 4 | * | |
| 5 | * Copyright 2000-2006, Michael Meyling <mime@qedeq.org>. | |
| 6 | * | |
| 7 | * "Hilbert II" is free software; you can redistribute | |
| 8 | * it and/or modify it under the terms of the GNU General Public | |
| 9 | * License as published by the Free Software Foundation; either | |
| 10 | * version 2 of the License, or (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | */ | |
| 17 | ||
| 18 | package org.qedeq.kernel.utility; | |
| 19 | ||
| 20 | ||
| 21 | /** | |
| 22 | * A collection of useful static methods for equality. | |
| 23 | * | |
| 24 | * @version $Revision: 1.4 $ | |
| 25 | * @author Michael Meyling | |
| 26 | */ | |
| 27 | public final class EqualsUtility { | |
| 28 | ||
| 29 | /** | |
| 30 | * Constructor, should never be called. | |
| 31 | */ | |
| 32 | 0 | private EqualsUtility() { |
| 33 | // don't call me | |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Compare two objects, each of them could be <code>null</code>. | |
| 38 | * | |
| 39 | * @param a First parameter. | |
| 40 | * @param b Second parameter. | |
| 41 | * @return Are <code>a</code> and <code>b</code> equal? | |
| 42 | */ | |
| 43 | 3251177 | public static boolean equals(final Object a, final Object b) { |
| 44 | 3251177 | if (a == null) { |
| 45 | 1974 | if (b == null) { |
| 46 | 1797 | return true; |
| 47 | } | |
| 48 | 177 | return false; |
| 49 | } | |
| 50 | 3249203 | return a.equals(b); |
| 51 | } | |
| 52 | ||
| 53 | } |
|
||||||||||