public void select(Segment segment,boolean addToSelection){
  if (segment.isNone()) {
    return;
  }
  if (!addToSelection) {
    deselectAllSegments();
  }
  if (segment.isUnpaired()) {
    if (addToSelection) {
      boolean allSegmentsSelected=true;
      for (      Segment other : segments.getPairedSegments(segment)) {
        if (!isSelected(other)) {
          allSegmentsSelected=false;
          break;
        }
      }
      if (allSegmentsSelected) {
        deselectSegment(segment);
        return;
      }
    }
    if (isSelected(segment)) {
      deselectSegment(segment);
    }
 else {
      selectSegment(segment);
    }
  }
 else {
    if (isSelected(segment)) {
      deselectSegment(segment);
    }
 else {
      selectSegment(segment);
    }
  }
}

public void select ( Segment segment , boolean addToSelection ) { if ( segment . isNone ( ) ) { return ; } if ( ! addToSelection ) { deselectAllSegments ( ) ; } if ( segment . isUnpaired ( ) ) { if ( addToSelection ) { boolean allSegmentsSelected = true ; for ( Segment other : segments . getPairedSegments ( segment ) ) { if ( ! isSelected ( other ) ) { allSegmentsSelected = false ; break ; } } if ( allSegmentsSelected ) { deselectSegment ( segment ) ; return ; } } if ( isSelected ( segment ) ) { deselectSegment ( segment ) ; } else { selectSegment ( segment ) ; } } else { if ( isSelected ( segment ) ) { deselectSegment ( segment ) ; } else { selectSegment ( segment ) ; } } }
adds or removes the given segment to the selection . depending on the clustering and cluster selected and the addtoselection option given , the current selection will be modified . this method is called by clicking on a segment and ring and the ctrl - button status . adding selections does only work on the same clustering and cluster , else a new selection will be added .
