public int compareTo(HardSoftScore other) { // A direct implementation (instead of CompareToBuilder) to avoid dependencies if (hardScore != other.getHardScore()) { if (hardScore < other.getHardScore()) { return -1; } else { return 1; } } else { if (softScore < other.getSoftScore()) { return -1; } else if (softScore > other.getSoftScore()) { return 1; } else { return 0; } } }
public boolean equals(Object o) { // A direct implementation (instead of EqualsBuilder) to avoid dependencies if (this == o) { return true; } else if (o instanceof HardSoftScore) { HardSoftScore other = (HardSoftScore) o; return hardScore == other.getHardScore() && softScore == other.getSoftScore(); } else { return false; } }
public HardSoftScore subtract(HardSoftScore subtrahend) { return new HardSoftScore( hardScore - subtrahend.getHardScore(), softScore - subtrahend.getSoftScore()); }
public HardSoftScore add(HardSoftScore augment) { return new HardSoftScore( hardScore + augment.getHardScore(), softScore + augment.getSoftScore()); }