]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 18 Mar 2018 21:47:10 +0000 (22:47 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 18 Mar 2018 21:57:04 +0000 (22:57 +0100)
- used new NumberUtils class for null-safe comparison

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java
src/org/mxchange/jcontactsbusiness/model/department/Departments.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarters.java
src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java

index 7054e4b2387050afc41685df96e57e9f477c9d39..122752661ec5795cc85e4e114d0148a3de935442 100644 (file)
@@ -52,7 +52,7 @@ public class BranchOffices implements Serializable {
                        throw new NullPointerException("branchOffice1 is null"); //NOI18N
                } else if (null == branchOffice2) {
                        // Second is null
-                       return -1;
+                       return 1;
                }
 
                // Invoke compareTo() method
index 9619c546473d6f40f1956e224568a405ff26eb72..7f3c91a2c075274514d7d32777fa600f0adf477a 100644 (file)
@@ -44,6 +44,7 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreee.utils.Comparables;
+import org.mxchange.jcoreee.utils.NumberUtils;
 import org.mxchange.jcoreee.utils.StringUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
@@ -302,9 +303,9 @@ public class BusinessBranchOffice implements BranchOffice {
                // Init comparisons
                final int[] comparators = {
                        // A different branch number is a clear indication ...
-                       Long.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
+                       NumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
                        // ... same with id ...
-                       Long.compare(this.getBranchId(), branchOffice.getBranchId()),
+                       NumberUtils.compare(this.getBranchId(), branchOffice.getBranchId()),
                        // ... then country
                        this.getBranchCountry().compareTo(branchOffice.getBranchCountry()),
                        // ... next city
@@ -316,13 +317,13 @@ public class BusinessBranchOffice implements BranchOffice {
                        // ... and house number
                        this.getBranchHouseNumber().compareTo(branchOffice.getBranchHouseNumber()),
                        // ... and house number
-                       Short.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
+                       NumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
                        // ... and extension
                        StringUtils.compareToIgnoreCase(this.getBranchHouseNumberExtension(), branchOffice.getBranchHouseNumberExtension()),
                        // ... store ...
-                       Short.compare(this.getBranchStore(), branchOffice.getBranchStore()),
+                       NumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
                        // ... suite number ...
-                       Short.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
+                       NumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
                };
 
                // Check all values
index 7786af356f1909f1646dd48fe325a4634b17ed7c..7aa9a869deff872345dbd70fd2516e58f1769da4 100644 (file)
@@ -55,7 +55,7 @@ public class Departments implements Serializable {
                        throw new NullPointerException("department1 is null"); //NOI18N
                } else if (null == department2) {
                        // Second is null
-                       return -1;
+                       return 1;
                }
 
                // Invoke compareTo() method
index 6391d47aa04b3f275b17614683d05ba082082101..04e225a864900cdda19522ba0ed98226e34386bb 100644 (file)
@@ -42,6 +42,7 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreee.utils.Comparables;
+import org.mxchange.jcoreee.utils.NumberUtils;
 import org.mxchange.jcoreee.utils.StringUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
@@ -287,21 +288,21 @@ public class BusinessHeadquarter implements Headquarter {
                        // ... next country
                        this.getHeadquarterCountry().compareTo(headquarter.getHeadquarterCountry()),
                        // ... then ZIP code
-                       Integer.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
+                       NumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
                        // ... and city
                        this.getHeadquarterCity().compareTo(headquarter.getHeadquarterCity()),
                        // ... street name
                        StringUtils.compareToIgnoreCase(this.getHeadquarterStreet(), headquarter.getHeadquarterStreet()),
                        // ... house number
-                       Integer.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
+                       NumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
                        // ... last house number
-                       Integer.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
+                       NumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
                        // ... extension
                        StringUtils.compareToIgnoreCase(this.getHeadquarterHouseNumberExtension(), headquarter.getHeadquarterHouseNumberExtension()),
                        // ... store number
-                       Integer.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
+                       NumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
                        // ... suite number
-                       Integer.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
+                       NumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
                        // ... last email address
                        StringUtils.compareToIgnoreCase(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())
                };
index 2d847b9e04d88f9ad75be3165e2b792396fd2805..598290fee094b861fadf92c9f210300e807f7951 100644 (file)
@@ -51,7 +51,7 @@ public class Headquarters implements Serializable {
                        throw new NullPointerException("headquarter1 is null"); //NOI18N
                } else if (null == headquarter2) {
                        // Second headquarter is null
-                       return -1;
+                       return 1;
                }
 
                // Now that both are not NULL, compare them
index b94b6f2317694e750a2ea1779e929967e50fa8ec..1b523a97a18d53ea98ee53676a27a3b367b3b3fe 100644 (file)
@@ -52,7 +52,7 @@ public class JobPositions implements Serializable {
                        throw new NullPointerException("jobPosition1 is null"); //NOI18N
                } else if (null == jobPosition2) {
                        // Second is null
-                       return -1;
+                       return 1;
                }
 
                // Invoke compareTo() method