Program: 59084
Project: 59084
Buggy source:
protected void handleEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (remoteRenderingGLCanvas.getHierarchyLayerByGLCanvasListenerId(iUniqueId).getCapacity() > 5) {
    return;
  }
  ArrayList<Integer> iAlOldSelection;
switch (ePickingType) {
case POLYLINE_SELECTION:
switch (ePickingMode) {
case CLICKED:
      extSelectionManager.clear();
    iAlOldSelection=prepareSelection(horizontalSelectionManager,EViewInternalSelectionType.SELECTION);
  horizontalSelectionManager.clearSelection(EViewInternalSelectionType.SELECTION);
horizontalSelectionManager.addToType(EViewInternalSelectionType.SELECTION,iExternalID);
if (ePolylineDataType == EInputDataType.GENE && !bAngularBrushingSelectPolyline) {
propagateGeneSelection(iExternalID,2,iAlOldSelection);
}
if (bAngularBrushingSelectPolyline) {
bAngularBrushingSelectPolyline=false;
bIsAngularBrushingActive=true;
iSelectedLineID=iExternalID;
linePick=pick;
bIsAngularBrushingFirstTime=true;
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
case MOUSE_OVER:
extSelectionManager.clear();
iAlOldSelection=prepareSelection(horizontalSelectionManager,EViewInternalSelectionType.SELECTION);
if (ePolylineDataType == EInputDataType.GENE) propagateGeneSelection(iExternalID,1,iAlOldSelection);
horizontalSelectionManager.clearSelection(EViewInternalSelectionType.MOUSE_OVER);
horizontalSelectionManager.addToType(EViewInternalSelectionType.MOUSE_OVER,iExternalID);
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case X_AXIS_SELECTION:
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
iAlOldSelection=prepareSelection(verticalSelectionManager,EViewInternalSelectionType.SELECTION);
verticalSelectionManager.clearSelection(EViewInternalSelectionType.SELECTION);
verticalSelectionManager.addToType(EViewInternalSelectionType.SELECTION,iExternalID);
if (eAxisDataType == EInputDataType.GENE) {
propagateGeneSelection(iExternalID,2,iAlOldSelection);
}
rePosition(iExternalID);
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
case MOUSE_OVER:
iAlOldSelection=prepareSelection(verticalSelectionManager,EViewInternalSelectionType.MOUSE_OVER);
verticalSelectionManager.clearSelection(EViewInternalSelectionType.MOUSE_OVER);
verticalSelectionManager.addToType(EViewInternalSelectionType.MOUSE_OVER,iExternalID);
if (eAxisDataType == EInputDataType.GENE) {
propagateGeneSelection(iExternalID,1,iAlOldSelection);
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case LOWER_GATE_TIP_SELECTION:
switch (ePickingMode) {
case CLICKED:
System.out.println("String_Node_Str");
break;
case DRAGGED:
bIsDraggingActive=true;
draggedObject=EPickingType.LOWER_GATE_TIP_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case LOWER_GATE_BOTTOM_SELECTION:
switch (ePickingMode) {
case CLICKED:
System.out.println("String_Node_Str");
break;
case DRAGGED:
System.out.println("String_Node_Str");
bIsDraggingActive=true;
draggedObject=EPickingType.LOWER_GATE_BOTTOM_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
if (iExternalID == EIconIDs.TOGGLE_RENDER_ARRAY_AS_POLYLINE.ordinal()) {
if (bRenderStorageHorizontally == true) renderStorageAsPolyline();
 else renderStorageAsPolyline();
}
 else if (iExternalID == EIconIDs.TOGGLE_PREVENT_OCCLUSION.ordinal()) {
if (bPreventOcclusion == true) preventOcclusion(false);
 else preventOcclusion(true);
}
 else if (iExternalID == EIconIDs.TOGGLE_RENDER_SELECTION.ordinal()) {
if (bRenderSelection == true) renderSelection(false);
 else renderSelection(true);
}
 else if (iExternalID == EIconIDs.RESET_SELECTIONS.ordinal()) {
resetSelections();
}
 else if (iExternalID == EIconIDs.SAVE_SELECTIONS.ordinal()) {
ArrayList<Integer> iAlSelection=new ArrayList<Integer>();
ArrayList<Integer> iAlGroup=new ArrayList<Integer>();
if (bRenderSelection) {
Set<Integer> deselectedSet=horizontalSelectionManager.getElements(EViewInternalSelectionType.DESELECTED);
addSetToSelection(deselectedSet,iAlSelection,iAlGroup,-1);
propagateGenes(iAlSelection,iAlGroup);
}
 else {
Set<Integer> set=horizontalSelectionManager.getElements(EViewInternalSelectionType.NORMAL);
addSetToSelection(set,iAlSelection,iAlGroup,0);
set=horizontalSelectionManager.getElements(EViewInternalSelectionType.MOUSE_OVER);
addSetToSelection(set,iAlSelection,iAlGroup,1);
set=horizontalSelectionManager.getElements(EViewInternalSelectionType.SELECTION);
addSetToSelection(set,iAlSelection,iAlGroup,2);
}
mergeSelection(iAlSelection,iAlGroup,null);
propagateGeneSet();
renderSelection(true);
extSelectionManager.clear();
}
 else if (iExternalID == EIconIDs.ANGULAR_BRUSHING.ordinal()) {
bAngularBrushingSelectPolyline=true;
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.PC_ICON_SELECTION);
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case CLICKED:
if (bRenderStorageHorizontally) {
alContentSelection.remove(iExternalID);
}
 else {
alStorageSelection.remove(iExternalID);
}
refresh();
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.REMOVE_AXIS);
break;
case MOVE_AXIS_LEFT:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
if (iExternalID > 0 && iExternalID < alSelection.size()) {
int iTemp=alSelection.get(iExternalID - 1);
alSelection.set(iExternalID - 1,alSelection.get(iExternalID));
alSelection.set(iExternalID,iTemp);
refresh();
}
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.MOVE_AXIS_LEFT);
break;
case MOVE_AXIS_RIGHT:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
if (iExternalID >= 0 && iExternalID < alSelection.size() - 1) {
int iTemp=alSelection.get(iExternalID + 1);
alSelection.set(iExternalID + 1,alSelection.get(iExternalID));
alSelection.set(iExternalID,iTemp);
refresh();
}
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.MOVE_AXIS_RIGHT);
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
alSelection.add(iExternalID + 1,alSelection.get(iExternalID));
refresh();
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.DUPLICATE_AXIS);
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueId,EPickingType.ANGULAR_UPPER);
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
}
}

Fixed version (ground truth):
protected void handleEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (remoteRenderingGLCanvas != null) {
    if (remoteRenderingGLCanvas.getHierarchyLayerByGLCanvasListenerId(iUniqueId).getCapacity() > 5) {
      return;
    }
  }
  ArrayList<Integer> iAlOldSelection;
switch (ePickingType) {
case POLYLINE_SELECTION:
switch (ePickingMode) {
case CLICKED:
      extSelectionManager.clear();
    iAlOldSelection=prepareSelection(horizontalSelectionManager,EViewInternalSelectionType.SELECTION);
  horizontalSelectionManager.clearSelection(EViewInternalSelectionType.SELECTION);
horizontalSelectionManager.addToType(EViewInternalSelectionType.SELECTION,iExternalID);
if (ePolylineDataType == EInputDataType.GENE && !bAngularBrushingSelectPolyline) {
propagateGeneSelection(iExternalID,2,iAlOldSelection);
}
if (bAngularBrushingSelectPolyline) {
bAngularBrushingSelectPolyline=false;
bIsAngularBrushingActive=true;
iSelectedLineID=iExternalID;
linePick=pick;
bIsAngularBrushingFirstTime=true;
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
case MOUSE_OVER:
extSelectionManager.clear();
iAlOldSelection=prepareSelection(horizontalSelectionManager,EViewInternalSelectionType.SELECTION);
if (ePolylineDataType == EInputDataType.GENE) propagateGeneSelection(iExternalID,1,iAlOldSelection);
horizontalSelectionManager.clearSelection(EViewInternalSelectionType.MOUSE_OVER);
horizontalSelectionManager.addToType(EViewInternalSelectionType.MOUSE_OVER,iExternalID);
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case X_AXIS_SELECTION:
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
iAlOldSelection=prepareSelection(verticalSelectionManager,EViewInternalSelectionType.SELECTION);
verticalSelectionManager.clearSelection(EViewInternalSelectionType.SELECTION);
verticalSelectionManager.addToType(EViewInternalSelectionType.SELECTION,iExternalID);
if (eAxisDataType == EInputDataType.GENE) {
propagateGeneSelection(iExternalID,2,iAlOldSelection);
}
rePosition(iExternalID);
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
case MOUSE_OVER:
iAlOldSelection=prepareSelection(verticalSelectionManager,EViewInternalSelectionType.MOUSE_OVER);
verticalSelectionManager.clearSelection(EViewInternalSelectionType.MOUSE_OVER);
verticalSelectionManager.addToType(EViewInternalSelectionType.MOUSE_OVER,iExternalID);
if (eAxisDataType == EInputDataType.GENE) {
propagateGeneSelection(iExternalID,1,iAlOldSelection);
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case LOWER_GATE_TIP_SELECTION:
switch (ePickingMode) {
case CLICKED:
System.out.println("String_Node_Str");
break;
case DRAGGED:
bIsDraggingActive=true;
draggedObject=EPickingType.LOWER_GATE_TIP_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case LOWER_GATE_BOTTOM_SELECTION:
switch (ePickingMode) {
case CLICKED:
System.out.println("String_Node_Str");
break;
case DRAGGED:
System.out.println("String_Node_Str");
bIsDraggingActive=true;
draggedObject=EPickingType.LOWER_GATE_BOTTOM_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
pickingManager.flushHits(iUniqueId,ePickingType);
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
if (iExternalID == EIconIDs.TOGGLE_RENDER_ARRAY_AS_POLYLINE.ordinal()) {
if (bRenderStorageHorizontally == true) renderStorageAsPolyline();
 else renderStorageAsPolyline();
}
 else if (iExternalID == EIconIDs.TOGGLE_PREVENT_OCCLUSION.ordinal()) {
if (bPreventOcclusion == true) preventOcclusion(false);
 else preventOcclusion(true);
}
 else if (iExternalID == EIconIDs.TOGGLE_RENDER_SELECTION.ordinal()) {
if (bRenderSelection == true) renderSelection(false);
 else renderSelection(true);
}
 else if (iExternalID == EIconIDs.RESET_SELECTIONS.ordinal()) {
resetSelections();
}
 else if (iExternalID == EIconIDs.SAVE_SELECTIONS.ordinal()) {
ArrayList<Integer> iAlSelection=new ArrayList<Integer>();
ArrayList<Integer> iAlGroup=new ArrayList<Integer>();
if (bRenderSelection) {
Set<Integer> deselectedSet=horizontalSelectionManager.getElements(EViewInternalSelectionType.DESELECTED);
addSetToSelection(deselectedSet,iAlSelection,iAlGroup,-1);
propagateGenes(iAlSelection,iAlGroup);
}
 else {
Set<Integer> set=horizontalSelectionManager.getElements(EViewInternalSelectionType.NORMAL);
addSetToSelection(set,iAlSelection,iAlGroup,0);
set=horizontalSelectionManager.getElements(EViewInternalSelectionType.MOUSE_OVER);
addSetToSelection(set,iAlSelection,iAlGroup,1);
set=horizontalSelectionManager.getElements(EViewInternalSelectionType.SELECTION);
addSetToSelection(set,iAlSelection,iAlGroup,2);
}
mergeSelection(iAlSelection,iAlGroup,null);
propagateGeneSet();
renderSelection(true);
extSelectionManager.clear();
}
 else if (iExternalID == EIconIDs.ANGULAR_BRUSHING.ordinal()) {
bAngularBrushingSelectPolyline=true;
}
bIsDisplayListDirtyLocal=true;
bIsDisplayListDirtyRemote=true;
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.PC_ICON_SELECTION);
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case CLICKED:
if (bRenderStorageHorizontally) {
alContentSelection.remove(iExternalID);
}
 else {
alStorageSelection.remove(iExternalID);
}
refresh();
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.REMOVE_AXIS);
break;
case MOVE_AXIS_LEFT:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
if (iExternalID > 0 && iExternalID < alSelection.size()) {
int iTemp=alSelection.get(iExternalID - 1);
alSelection.set(iExternalID - 1,alSelection.get(iExternalID));
alSelection.set(iExternalID,iTemp);
refresh();
}
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.MOVE_AXIS_LEFT);
break;
case MOVE_AXIS_RIGHT:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
if (iExternalID >= 0 && iExternalID < alSelection.size() - 1) {
int iTemp=alSelection.get(iExternalID + 1);
alSelection.set(iExternalID + 1,alSelection.get(iExternalID));
alSelection.set(iExternalID,iTemp);
refresh();
}
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.MOVE_AXIS_RIGHT);
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case CLICKED:
ArrayList<Integer> alSelection;
if (bRenderStorageHorizontally) alSelection=alContentSelection;
 else alSelection=alStorageSelection;
alSelection.add(iExternalID + 1,alSelection.get(iExternalID));
refresh();
break;
}
pickingManager.flushHits(iUniqueId,EPickingType.DUPLICATE_AXIS);
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueId,EPickingType.ANGULAR_UPPER);
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
}
}