}
  public void addSelectionInterval(int index0, int index1)   {    if (index0 == -1 || index1 == -1)      return;        int lo = Math.min(index0, index1);    int hi = Math.max(index0, index1);    oldSel = sel.clone();    if (selectionMode == SINGLE_SELECTION)      setSelectionInterval(index0, index1);    // COMPAT: Like Sun (but not like IBM), we allow calls to     // addSelectionInterval when selectionMode is    // SINGLE_SELECTION_INTERVAL iff the interval being added    // is adjacent to an already selected interval    if (selectionMode == SINGLE_INTERVAL_SELECTION)      if (!(isSelectedIndex(index0) ||             isSelectedIndex(index1) ||             isSelectedIndex(Math.max(lo-1,0)) ||             isSelectedIndex(Math.min(hi+1,sel.size()))))      sel.clear();        // We have to update the anchorSelectionIndex and leadSelectionIndex    // variables        // The next if statements breaks down to "if this selection is adjacent    // to the previous selection and going in the same direction"    if ((isSelectedIndex(leadSelectionIndex))         && ((index0 - 1 == leadSelectionIndex              && (index1 >= index0)               && (leadSelectionIndex >= anchorSelectionIndex))             || (index0 + 1 == leadSelectionIndex && (index1 <= index0)                  && (leadSelectionIndex <= anchorSelectionIndex)))        && (anchorSelectionIndex != -1 || leadSelectionIndex != -1))      {        // setting setLeadCalledFromAdd to true tells setLeadSelectionIndex        //   not to update oldSel        setLeadCalledFromAdd = true;      setLeadSelectionIndex(index1);        setLeadCalledFromAdd = false;      }    else      {        leadSelectionIndex = index1;        anchorSelectionIndex = index0;    sel.set(lo, hi+1);        fireDifference(sel, (BitSet) oldSel);  }  }