|
|
|
@@ -1,6 +1,9 @@ |
|
|
|
package co.wuunder.rule_engine; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
public class RateRule { |
|
|
|
public final String id; |
|
|
|
public final int minWeight; |
|
|
|
public final int maxWeight; |
|
|
|
public final int maxLengthHeightWidth; |
|
|
|
@@ -11,9 +14,10 @@ public class RateRule { |
|
|
|
public final String deliveryCountry; |
|
|
|
public final String deliveryAddressType; |
|
|
|
|
|
|
|
public RateRule(int minWeight, int maxWeight, int maxLengthHeightWidth, boolean isReturn, |
|
|
|
public RateRule(String id, int minWeight, int maxWeight, int maxLengthHeightWidth, boolean isReturn, |
|
|
|
int maxDimension, String pickupCountry, String pickupAddressType, String deliveryCountry, |
|
|
|
String deliveryAddressType) { |
|
|
|
this.id = id; |
|
|
|
this.minWeight = minWeight; |
|
|
|
this.maxWeight = maxWeight; |
|
|
|
this.maxLengthHeightWidth = maxLengthHeightWidth; |
|
|
|
@@ -29,34 +33,21 @@ public class RateRule { |
|
|
|
public boolean equals(Object o) { |
|
|
|
if (this == o) return true; |
|
|
|
if (o == null || getClass() != o.getClass()) return false; |
|
|
|
|
|
|
|
RateRule rateRule = (RateRule) o; |
|
|
|
|
|
|
|
if (minWeight != rateRule.minWeight) return false; |
|
|
|
if (maxWeight != rateRule.maxWeight) return false; |
|
|
|
if (maxLengthHeightWidth != rateRule.maxLengthHeightWidth) return false; |
|
|
|
if (isReturn != rateRule.isReturn) return false; |
|
|
|
if (maxDimension != rateRule.maxDimension) return false; |
|
|
|
if (pickupCountry != null ? !pickupCountry.equals(rateRule.pickupCountry) : rateRule.pickupCountry != null) |
|
|
|
return false; |
|
|
|
if (pickupAddressType != null ? !pickupAddressType.equals(rateRule.pickupAddressType) : rateRule.pickupAddressType != null) |
|
|
|
return false; |
|
|
|
if (deliveryCountry != null ? !deliveryCountry.equals(rateRule.deliveryCountry) : rateRule.deliveryCountry != null) |
|
|
|
return false; |
|
|
|
return deliveryAddressType != null ? deliveryAddressType.equals(rateRule.deliveryAddressType) : rateRule.deliveryAddressType == null; |
|
|
|
return minWeight == rateRule.minWeight && |
|
|
|
maxWeight == rateRule.maxWeight && |
|
|
|
maxLengthHeightWidth == rateRule.maxLengthHeightWidth && |
|
|
|
isReturn == rateRule.isReturn && |
|
|
|
maxDimension == rateRule.maxDimension && |
|
|
|
Objects.equals(id, rateRule.id) && |
|
|
|
Objects.equals(pickupCountry, rateRule.pickupCountry) && |
|
|
|
Objects.equals(pickupAddressType, rateRule.pickupAddressType) && |
|
|
|
Objects.equals(deliveryCountry, rateRule.deliveryCountry) && |
|
|
|
Objects.equals(deliveryAddressType, rateRule.deliveryAddressType); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public int hashCode() { |
|
|
|
int result = minWeight; |
|
|
|
result = 31 * result + maxWeight; |
|
|
|
result = 31 * result + maxLengthHeightWidth; |
|
|
|
result = 31 * result + (isReturn ? 1 : 0); |
|
|
|
result = 31 * result + maxDimension; |
|
|
|
result = 31 * result + (pickupCountry != null ? pickupCountry.hashCode() : 0); |
|
|
|
result = 31 * result + (pickupAddressType != null ? pickupAddressType.hashCode() : 0); |
|
|
|
result = 31 * result + (deliveryCountry != null ? deliveryCountry.hashCode() : 0); |
|
|
|
result = 31 * result + (deliveryAddressType != null ? deliveryAddressType.hashCode() : 0); |
|
|
|
return result; |
|
|
|
return Objects.hash(id, minWeight, maxWeight, maxLengthHeightWidth, isReturn, maxDimension, pickupCountry, pickupAddressType, deliveryCountry, deliveryAddressType); |
|
|
|
} |
|
|
|
} |