コード例 #1
0
 @Override
 public int compareTo(RelevanceRange obj) {
   if (this.getLowerValue() < obj.getLowerValue() && this.getUpperValue() < obj.getUpperValue()) {
     return -1;
   }
   if (this.getLowerValue() > obj.getLowerValue() && this.getUpperValue() > obj.getUpperValue()) {
     return 1;
   }
   return 0;
 }
コード例 #2
0
 /**
  * Returns the range for the given value. A value belongs to a range if value>=loweValue and value
  * <=upperValue. If there is no range defined for the given value, then the method return null.
  *
  * @param value An integer value, where value >=0 and value <=17
  * @return The <code>RelevanceRange</code> corresponding to the given value.
  */
 public static RelevanceRange getRelevanceRange(int value) {
   Iterator<RelevanceRange> it = set.iterator();
   RelevanceRange range = null;
   while (it.hasNext()) {
     range = it.next();
     if (value >= range.getLowerValue() && value <= range.getUpperValue()) {
       return range;
     }
   }
   return null;
 }