@Override
public int compareTo (final BasicData basicData) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == basicData) {
// Should not happen
throw new NullPointerException("basicData is null"); //NOI18N
- } else if (Objects.equals(this, basicData)) {
+ } else if (basicData.equals(this)) {
// Same object
return 0;
}
import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcoreutils.Comparables;
-import org.mxchange.jcoreutils.CoreNumberUtils;
+import org.mxchange.jcoreutils.SafeNumberUtils;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountryData;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@Override
public int compareTo (final BranchOffice branchOffice) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == branchOffice) {
// Should not happen
throw new NullPointerException("branchOffice is null"); //NOI18N
- } else if (Objects.equals(this, branchOffice)) {
+ } else if (branchOffice.equals(this)) {
// Same object
return 0;
}
// First compare basic data
this.getBranchCompany().compareTo(branchOffice.getBranchCompany()),
// ... branch office number
- CoreNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
+ SafeNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
// ... contact person
Employees.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()),
// ... then country
// ... and house number
this.getBranchHouseNumber().compareTo(branchOffice.getBranchHouseNumber()),
// ... and house number
- CoreNumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
+ SafeNumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
// ... and extension
StringUtils.compareIgnoreCase(this.getBranchHouseNumberExtension(), branchOffice.getBranchHouseNumberExtension()),
// ... store ...
- CoreNumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
+ SafeNumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
// ... suite number ...
- CoreNumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
+ SafeNumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
};
// Check all values
@Override
public int compareTo (final Department department) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == department) {
// Should not happen
throw new NullPointerException("department is null"); //NOI18N
- } else if (Objects.equals(this, department)) {
+ } else if (department.equals(this)) {
// Same object
return 0;
}
@Override
public int compareTo (final Employable employable) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == employable) {
// Should not happen
throw new NullPointerException("employable is null"); //NOI18N
- } else if (Objects.equals(this, employable)) {
+ } else if (employable.equals(this)) {
// Same object
return 0;
}
import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcoreutils.Comparables;
-import org.mxchange.jcoreutils.CoreNumberUtils;
+import org.mxchange.jcoreutils.SafeNumberUtils;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountryData;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@Override
public int compareTo (final Headquarter headquarter) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == headquarter) {
// Should not happen
throw new NullPointerException("headquarter is null"); //NOI18N
- } else if (Objects.equals(this, headquarter)) {
+ } else if (headquarter.equals(this)) {
// Same object
return 0;
}
// ... next country
this.getHeadquarterCountry().compareTo(headquarter.getHeadquarterCountry()),
// ... then ZIP code
- CoreNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
+ SafeNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
// ... and city
this.getHeadquarterCity().compareTo(headquarter.getHeadquarterCity()),
// ... street name
StringUtils.compareIgnoreCase(this.getHeadquarterStreet(), headquarter.getHeadquarterStreet()),
// ... house number
- CoreNumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
+ SafeNumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
// ... last house number
- CoreNumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
+ SafeNumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
// ... extension
StringUtils.compareIgnoreCase(this.getHeadquarterHouseNumberExtension(), headquarter.getHeadquarterHouseNumberExtension()),
// ... store number
- CoreNumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
+ SafeNumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
// ... suite number
- CoreNumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
+ SafeNumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
// ... last email address
StringUtils.compareIgnoreCase(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())
};
@Override
public int compareTo (final JobPosition jobPosition) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == jobPosition) {
// Should not happen
throw new NullPointerException("jobPosition is null"); //NOI18N
- } else if (Objects.equals(this, jobPosition)) {
+ } else if (jobPosition.equals(this)) {
// Same object
return 0;
}
@Override
public int compareTo (final Logo logo) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == logo) {
// Should not happen
throw new NullPointerException("logo is null"); //NOI18N
- } else if (Objects.equals(this, logo)) {
+ } else if (logo.equals(this)) {
// Same object
return 0;
}
@Override
public int compareTo (final OpeningTime openingTime) {
- // For performance reasons
+ // Check parameter on null-reference and equality to this
if (null == openingTime) {
// Should not happen
throw new NullPointerException("openingTime is null"); //NOI18N
- } else if (Objects.equals(this, openingTime)) {
+ } else if (openingTime.equals(this)) {
// Same object
return 0;
}