if (leadIndex < 0) { if (anchorSelectionIndex < 0) leadSelectionIndex = -1; else return; }   if (anchorSelectionIndex < 0) return;
  public void setLeadSelectionIndex(int leadIndex)  {    if (selectionMode == SINGLE_SELECTION)      setSelectionInterval (leadIndex, leadIndex);        int oldLeadIndex = leadSelectionIndex;    if (oldLeadIndex == -1)      oldLeadIndex = leadIndex;    if (setLeadCalledFromAdd == false)      oldSel = sel.clone();    leadSelectionIndex = leadIndex;    if (anchorSelectionIndex == -1)      return;    int R1 = Math.min(anchorSelectionIndex, oldLeadIndex);    int R2 = Math.max(anchorSelectionIndex, oldLeadIndex);    int S1 = Math.min(anchorSelectionIndex, leadIndex);    int S2 = Math.max(anchorSelectionIndex, leadIndex);        int lo = Math.min(R1, S1);    int hi = Math.max(R2, S2);    if (isSelectedIndex(anchorSelectionIndex))      {        sel.clear(R1, R2+1);        sel.set(S1, S2+1);      }    else      {        sel.set(R1, R2+1);        sel.clear(S1, S2+1);      }        int beg = sel.nextSetBit(0), end = -1;    for(int i=beg; i >= 0; i=sel.nextSetBit(i+1))         end = i;    if (sel.equals(oldSel) == false)    fireValueChanged(beg, end, valueIsAdjusting);      }