/**
  * Removes the EXACT range defined by (low,high). If no range is defined on exactly those
  * coordinates, no elements are removed
  */
 public Object remove(int low, int high) {
   RangeHolder holder = new RangeHolder(low, high);
   int pos = VectorUtil.binarySearch(ranges, holder, rangeComparator, false);
   Range found = (Range) ranges.elementAt(pos);
   if (found.equals(holder)) return data.remove(holder);
   else return null;
 }
 /** Test of equals method, of class Range. */
 @Test
 public void testEquals() {
   System.out.println("equals");
   Range r = new Range(3, 5);
   Range instance = new Range(3, 5);
   boolean expResult = true;
   boolean result = instance.equals(r);
   assertEquals(expResult, result);
 }
 public void removeRange(Range range) {
   RangeGroup rangeGroup = rangeMap.get(range.start);
   if (range.isEmpty()) {
     if (rangeGroup.emptyRangesAtStart <= 0) {
       throw new IllegalStateException();
     }
     rangeGroup.emptyRangesAtStart--;
   } else {
     if (rangeGroup.nonEmptyRangeMapping == null
         || !range.equals(rangeGroup.nonEmptyRangeMapping.sourceRange)) {
       throw new IllegalStateException();
     }
     rangeGroup.nonEmptyRangeMapping = null;
   }
   if (rangeGroup.nonEmptyRangeMapping == null && rangeGroup.emptyRangesAtStart == 0) {
     rangeMap.remove(range.start);
   }
 }
Example #4
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (obj == null) {
      return false;
    }

    if (getClass() != obj.getClass()) {
      return false;
    }

    Annotation other = (Annotation) obj;
    if ((name == null && other.name != null)
        || (value == null && other.value != null)
        || (range == null && other.range != null)) {
      return false;
    }

    return name.equals(other.name) && range.equals(other.range) && value.equals(other.value);
  }