| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| NumberUtils |
|
| 3.3333333333333335;3.333 |
| 1 | /* | |
| 2 | * Copyright 2005-2008 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.kns.util; | |
| 17 | ||
| 18 | /** | |
| 19 | * | |
| 20 | */ | |
| 21 | 0 | public class NumberUtils extends org.apache.commons.lang.math.NumberUtils { |
| 22 | /** | |
| 23 | * @param i | |
| 24 | * @param defaultValue | |
| 25 | * @return intValue of i, or defaultValue if i is null | |
| 26 | */ | |
| 27 | public static int intValue(Integer i, int defaultValue) { | |
| 28 | 0 | int value = defaultValue; |
| 29 | ||
| 30 | 0 | if (i != null) { |
| 31 | 0 | value = i.intValue(); |
| 32 | } | |
| 33 | ||
| 34 | 0 | return value; |
| 35 | } | |
| 36 | ||
| 37 | ||
| 38 | /** | |
| 39 | * @param i | |
| 40 | * @param j | |
| 41 | * @return true if both of the integers are null, or point to instances with the same mathematical value | |
| 42 | */ | |
| 43 | public static boolean equals(Integer i, Integer j) { | |
| 44 | 0 | boolean equal = false; |
| 45 | ||
| 46 | 0 | if ((i == null) && (j == null)) { |
| 47 | 0 | equal = true; |
| 48 | } | |
| 49 | 0 | else if (i != null) { |
| 50 | 0 | equal = i.equals(j); |
| 51 | } | |
| 52 | ||
| 53 | 0 | return equal; |
| 54 | } | |
| 55 | ||
| 56 | ||
| 57 | /** | |
| 58 | * @param i | |
| 59 | * @param j | |
| 60 | * @return true if both of the given KualiDecimals are null, or point to instances with the same mathematical value | |
| 61 | */ | |
| 62 | public static boolean equals(KualiDecimal j, KualiDecimal k) { | |
| 63 | 0 | boolean equal = false; |
| 64 | ||
| 65 | 0 | if ((j == null) && (k == null)) { |
| 66 | 0 | equal = true; |
| 67 | } | |
| 68 | 0 | else if (j != null) { |
| 69 | 0 | equal = j.equals(k); |
| 70 | } | |
| 71 | ||
| 72 | 0 | return equal; |
| 73 | } | |
| 74 | } |