boolean (ContractValue other) { if (!(other instanceof Condition that)) return false; if (that.myLeft.equals(myLeft) && that.myRight.equals(myRight) && that.myRelationType.getNegated() == myRelationType) { return true; } if (that.myLeft.equals(myRight) && that.myRight.equals(myLeft) && that.myRelationType.getNegated() == myRelationType.getFlipped()) { return true; } if (that.myRelationType == myRelationType) { if (that.myLeft.equals(myLeft) && that.myRight.isExclusive(myRight)) return true; if (that.myLeft.equals(myRight) && that.myRight.isExclusive(myLeft)) return true; } return false; }