file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar
file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar
file.reference.jcontacts-core.jar=lib/jcontacts-core.jar
+file.reference.jcoreee.jar=lib/jcoreee.jar
file.reference.juser-core.jar=lib/juser-core.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
${file.reference.jcontacts-core.jar}:\
${file.reference.jcontacts-business-core.jar}:\
${file.reference.jaddressbook-core.jar}:\
+ ${file.reference.jcoreee.jar}:\
${libs.jpa20-persistence.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
source.reference.jaddressbook-core.jar=../jaddressbook-core/src/
source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/
source.reference.jcontacts-core.jar=../jcontacts-core/src/
+source.reference.jcoreee.jar=../jcoreee/src/
source.reference.juser-core.jar=../juser-core/src/
src.dir=src
test.src.dir=test
import javax.persistence.Transient;
import org.mxchange.jaddressbook.model.addressbook.Addressbook;
import org.mxchange.jaddressbook.model.addressbook.UserAddressbook;
+import org.mxchange.jcoreee.utils.Comparables;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
/**
* Constructor with address book and sharee instance. Both parameters must
- * not be null, their id numbers must be set and the adress book's user
+ * not be null, their id numbers must be set and the address book's user
* instance must be set and have a valid id set.
* <p>
* @param addressbook Address book instance
- * @param sharee User sharee instance
+ * @param sharee User sharee instance
*/
public AddressbookShare (final Addressbook addressbook, final User sharee) {
// Call default constructor
this.shareUserSharee = sharee;
}
+ @Override
+ public int compareTo (final ShareableAddressbook shareableAddressbook) {
+ // Checkparameter and return 0 if equal
+ if (null == shareableAddressbook) {
+ // Should not happen
+ throw new NullPointerException("shareableAddressbook is null"); //NOI18N
+ } else if (Objects.equals(this, shareableAddressbook)) {
+ // Same object
+ return 0;
+ }
+
+ // All comparators
+ final int comparators[] = {
+ // First address book
+ this.getShareAddressbook().compareTo(shareableAddressbook.getShareAddressbook()),
+ // ... next sharer
+ this.getShareUserOwner().compareTo(shareableAddressbook.getShareUserOwner()),
+ // ... next sharee
+ this.getShareUserSharee().compareTo(shareableAddressbook.getShareUserSharee()),
+ };
+
+ // Check all values
+ final int comparison = Comparables.checkAll(comparators);
+
+ // Return value
+ return comparison;
+ }
+
@Override
public boolean equals (final Object object) {
if (null == object) {
return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee());
}
- @Override
- public int hashCode () {
- int hash = 7;
- hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
- hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
- hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
- return hash;
- }
-
@Override
public Addressbook getShareAddressbook () {
return this.shareAddressbook;
this.shareUserSharee = shareUserSharee;
}
+ @Override
+ public int hashCode () {
+ int hash = 7;
+
+ hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
+ hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
+ hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
+
+ return hash;
+ }
+
}