class AdjacentSortedRangeList extends SortedRangeList {

	public AdjacentSortedRangeList intersect(AdjacentSortedRangeList other) {
		AdjacentSortedRangeList srl = new AdjacentSortedRangeList(this);
		srl.remove(other);
		AdjacentSortedRangeList srl2 = new AdjacentSortedRangeList(this);
		srl2.remove(srl);
		// Split ranges where other list's breaks are between adjacent ranges.
		int num = other.getNumRanges();
		for(int otherIndex=0; otherIndex < num-1; otherIndex++) {
			Range r = other.getRange(otherIndex);
			Range rNext = other.getRange(otherIndex+1);
			if (r.max+1 == rNext.min) {
				// Adjacent
				int myIndex = srl2.getRangeIndex(r.max);
				if (myIndex < 0) {
					continue;
				}
				Range myRange = srl2.getRange(myIndex);
				int min = myRange.min;
				int max = myRange.max;
				if (max >= rNext.min) {
					// split the range
					srl2.removeRange(min, max);
					srl2.addRange(min, r.max);
					srl2.addRange(rNext.min, max);
				}
			}
		}
		return srl2;
	}

	public  AdjacentSortedRangeList();
	public  AdjacentSortedRangeList(AdjacentSortedRangeList list);

}