dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
+file.reference.jcoreee.jar=lib/jcoreee.jar
file.reference.jcountry-core.jar=lib/jcountry-core.jar
file.reference.jphone-core.jar=lib/jphone-core.jar
includes=**
javac.classpath=\
${file.reference.jcountry-core.jar}:\
${file.reference.jphone-core.jar}:\
+ ${file.reference.jcoreee.jar}:\
${libs.jpa20-persistence.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
+source.reference.jcoreee.jar=../jcoreee/src/
source.reference.jcountry-core.jar=../jcountry-core/src/
source.reference.jphone-core.jar=../jphone-core/src/
src.dir=src
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
+import org.mxchange.jcoreee.utils.Comparables;
+import org.mxchange.jcoreee.utils.StringUtils;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountryData;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
this.contactFamilyName = contactFamilyName;
}
+ @Override
+ public int compareTo (final Contact contact) {
+ // Checkparameter and return 0 if equal
+ if (null == contact) {
+ // Should not happen
+ throw new NullPointerException("contact is null"); //NOI18N
+ } else if (Objects.equals(this, contact)) {
+ // Same object
+ return 0;
+ }
+
+ // Init comparators
+ final int comparators[] = {
+ // First check country
+ this.getContactCountry().compareTo(contact.getContactCountry()),
+ // ... then ZIP code
+ Integer.compare(this.getContactZipCode(), contact.getContactZipCode()),
+ // ... and city
+ this.getContactCity().compareTo(contact.getContactCity()),
+ // ... street name
+ StringUtils.compareToIgnoreCase(this.getContactStreet(), contact.getContactStreet()),
+ // ... house number
+ Integer.compare(this.getContactHouseNumber(), contact.getContactHouseNumber()),
+ // ... extension
+ StringUtils.compareToIgnoreCase(this.getContactHouseNumberExtension(), contact.getContactHouseNumberExtension()),
+ // ... now it is sure that address is different/same, continue with personal title
+ this.getContactPersonalTitle().compareTo(contact.getContactPersonalTitle()),
+ // ... academical title
+ StringUtils.compareToIgnoreCase(this.getContactTitle(), contact.getContactTitle()),
+ // .. family name is next ...
+ this.getContactFamilyName().compareToIgnoreCase(contact.getContactFamilyName()),
+ // .. first name is second ...
+ this.getContactFirstName().compareToIgnoreCase(contact.getContactFirstName()),
+ // ... next is email address
+ StringUtils.compareToIgnoreCase(this.getContactEmailAddress(), contact.getContactEmailAddress()),};
+
+ // Check all values
+ final int comparison = Comparables.checkAll(comparators);
+
+ // Return value
+ return comparison;
+ }
+
@Override
public boolean equals (final Object object) {
if (this == object) {