diff --git a/core/src/main/java/io/bitsquare/arbitration/DisputeResult.java b/core/src/main/java/io/bitsquare/arbitration/DisputeResult.java index 84fb8d5c6a..7245cb4228 100644 --- a/core/src/main/java/io/bitsquare/arbitration/DisputeResult.java +++ b/core/src/main/java/io/bitsquare/arbitration/DisputeResult.java @@ -57,7 +57,8 @@ public final class DisputeResult implements Payload { public final String tradeId; public final int traderId; private DisputeFeePolicy disputeFeePolicy; - + private Winner winner; + private Reason reason; private boolean tamperProofEvidence; private boolean idVerification; private boolean screenCast; @@ -70,8 +71,6 @@ public final class DisputeResult implements Payload { private String arbitratorAddressAsString; private byte[] arbitratorPubKey; private long closeDate; - private Winner winner; - private Reason reason; transient private BooleanProperty tamperProofEvidenceProperty = new SimpleBooleanProperty(); transient private BooleanProperty idVerificationProperty = new SimpleBooleanProperty(); @@ -251,6 +250,22 @@ public final class DisputeResult implements Payload { if (tradeId != null ? !tradeId.equals(that.tradeId) : that.tradeId != null) return false; if (disputeFeePolicy != that.disputeFeePolicy) return false; if (reason != that.reason) return false; + + if (disputeFeePolicy != null && that.disputeFeePolicy != null && disputeFeePolicy.ordinal() != that.disputeFeePolicy.ordinal()) + return false; + else if ((disputeFeePolicy == null && that.disputeFeePolicy != null) || disputeFeePolicy != null) + return false; + + if (reason != null && that.reason != null && reason.ordinal() != that.reason.ordinal()) + return false; + else if ((reason == null && that.reason != null) || reason != null) + return false; + + if (winner != null && that.winner != null && winner.ordinal() != that.winner.ordinal()) + return false; + else if ((winner == null && that.winner != null) || winner != null) + return false; + if (summaryNotes != null ? !summaryNotes.equals(that.summaryNotes) : that.summaryNotes != null) return false; if (disputeCommunicationMessage != null ? !disputeCommunicationMessage.equals(that.disputeCommunicationMessage) : that.disputeCommunicationMessage != null) return false; @@ -258,7 +273,7 @@ public final class DisputeResult implements Payload { if (arbitratorAddressAsString != null ? !arbitratorAddressAsString.equals(that.arbitratorAddressAsString) : that.arbitratorAddressAsString != null) return false; if (!Arrays.equals(arbitratorPubKey, that.arbitratorPubKey)) return false; - return winner == that.winner; + return true; } @@ -266,8 +281,9 @@ public final class DisputeResult implements Payload { public int hashCode() { int result = tradeId != null ? tradeId.hashCode() : 0; result = 31 * result + traderId; - result = 31 * result + (disputeFeePolicy != null ? disputeFeePolicy.hashCode() : 0); - result = 31 * result + (reason != null ? reason.hashCode() : 0); + result = 31 * result + (disputeFeePolicy != null ? disputeFeePolicy.ordinal() : 0); + result = 31 * result + (reason != null ? reason.ordinal() : 0); + result = 31 * result + (winner != null ? winner.ordinal() : 0); result = 31 * result + (tamperProofEvidence ? 1 : 0); result = 31 * result + (idVerification ? 1 : 0); result = 31 * result + (screenCast ? 1 : 0); @@ -280,7 +296,6 @@ public final class DisputeResult implements Payload { result = 31 * result + (arbitratorAddressAsString != null ? arbitratorAddressAsString.hashCode() : 0); result = 31 * result + (arbitratorPubKey != null ? Arrays.hashCode(arbitratorPubKey) : 0); result = 31 * result + (int) (closeDate ^ (closeDate >>> 32)); - result = 31 * result + (winner != null ? winner.hashCode() : 0); return result; } } diff --git a/core/src/main/java/io/bitsquare/trade/offer/Offer.java b/core/src/main/java/io/bitsquare/trade/offer/Offer.java index 65e429ff3b..0962c76217 100644 --- a/core/src/main/java/io/bitsquare/trade/offer/Offer.java +++ b/core/src/main/java/io/bitsquare/trade/offer/Offer.java @@ -502,7 +502,12 @@ public final class Offer implements Priority1StoragePayload, RequiresOwnerIsOnli if (amount != offer.amount) return false; if (minAmount != offer.minAmount) return false; if (id != null ? !id.equals(offer.id) : offer.id != null) return false; - if (direction != offer.direction) return false; + + if (direction != null && offer.direction != null && direction.ordinal() != offer.direction.ordinal()) + return false; + else if ((direction == null && offer.direction != null) || direction != null) + return false; + if (currencyCode != null ? !currencyCode.equals(offer.currencyCode) : offer.currencyCode != null) return false; if (offererNodeAddress != null ? !offererNodeAddress.equals(offer.offererNodeAddress) : offer.offererNodeAddress != null) return false; @@ -526,7 +531,7 @@ public final class Offer implements Priority1StoragePayload, RequiresOwnerIsOnli @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; - result = 31 * result + (direction != null ? direction.hashCode() : 0); + result = 31 * result + (direction != null ? direction.ordinal() : 0); result = 31 * result + (currencyCode != null ? currencyCode.hashCode() : 0); result = 31 * result + (int) (date ^ (date >>> 32)); result = 31 * result + (int) (fiatPrice ^ (fiatPrice >>> 32)); @@ -577,6 +582,7 @@ public final class Offer implements Priority1StoragePayload, RequiresOwnerIsOnli "\n\terrorMessageProperty=" + errorMessageProperty + "\n\tTAC_OFFERER=" + TAC_OFFERER + "\n\tTAC_TAKER=" + TAC_TAKER + + "\n\thashCode=" + hashCode() + '}'; } } diff --git a/core/src/main/java/io/bitsquare/trade/statistics/TradeStatistics.java b/core/src/main/java/io/bitsquare/trade/statistics/TradeStatistics.java index a294472bbe..4efd47392e 100644 --- a/core/src/main/java/io/bitsquare/trade/statistics/TradeStatistics.java +++ b/core/src/main/java/io/bitsquare/trade/statistics/TradeStatistics.java @@ -110,12 +110,16 @@ public final class TradeStatistics implements Priority2StoragePayload, Capabilit if (offerAmount != that.offerAmount) return false; if (offerMinAmount != that.offerMinAmount) return false; if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false; - if (direction != that.direction) return false; + + if (direction != null && that.direction != null && direction.ordinal() != that.direction.ordinal()) + return false; + else if ((direction == null && that.direction != null) || direction != null) + return false; + if (paymentMethod != null ? !paymentMethod.equals(that.paymentMethod) : that.paymentMethod != null) return false; if (offerId != null ? !offerId.equals(that.offerId) : that.offerId != null) return false; return !(depositTxId != null ? !depositTxId.equals(that.depositTxId) : that.depositTxId != null); - } @Override @@ -123,7 +127,7 @@ public final class TradeStatistics implements Priority2StoragePayload, Capabilit int result; long temp; result = currency != null ? currency.hashCode() : 0; - result = 31 * result + (direction != null ? direction.hashCode() : 0); + result = 31 * result + (direction != null ? direction.ordinal() : 0); result = 31 * result + (int) (tradePrice ^ (tradePrice >>> 32)); result = 31 * result + (int) (tradeAmount ^ (tradeAmount >>> 32)); result = 31 * result + (paymentMethod != null ? paymentMethod.hashCode() : 0); @@ -155,6 +159,7 @@ public final class TradeStatistics implements Priority2StoragePayload, Capabilit ", offerId='" + offerId + '\'' + ", depositTxId='" + depositTxId + '\'' + ", pubKeyRing=" + pubKeyRing + + ", hashCode=" + hashCode() + '}'; } }