Example #1
0
 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;
     }
   }
 }
Example #2
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;
   }
 }
Example #3
0
 public HardSoftScore subtract(HardSoftScore subtrahend) {
   return new HardSoftScore(
       hardScore - subtrahend.getHardScore(), softScore - subtrahend.getSoftScore());
 }
Example #4
0
 public HardSoftScore add(HardSoftScore augment) {
   return new HardSoftScore(
       hardScore + augment.getHardScore(), softScore + augment.getSoftScore());
 }