Example #1
0
 @Override
 public String toString() {
   String condition = this.condition;
   String units = ConditionRule.getUnits(condition);
   condition += " " + this.min + units + " to " + this.max + units;
   return condition;
 }
Example #2
0
 /**
  * CompareTo method
  *
  * @param otherRule the other Rule to compare with
  */
 public int compareTo(Rule otherRule) {
   if (getClass() == otherRule.getClass()) {
     ConditionRule other = (ConditionRule) otherRule;
     if (!condition.equals(other.getCondition())) {
       return condition.compareTo(other.getCondition());
     } else {
       Pair<Integer, Integer> otherP = other.getMinMax();
       if (min != otherP.first) {
         return ((Integer) min).compareTo(otherP.first);
       } else if (max != otherP.second) {
         return ((Integer) max).compareTo(otherP.second);
       }
       return 0;
     }
   } else {
     return 1;
   }
 }