Program: 58583
Project: 58583
Buggy source:
@Override protected void handlePickingEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW || bIsDraggingActive || bWasAxisMoved) {
    return;
  }
  ESelectionType eSelectionType;
switch (ePickingType) {
case PCS_VIEW_SELECTION:
    break;
case POLYLINE_SELECTION:
switch (ePickingMode) {
case CLICKED:
    eSelectionType=ESelectionType.SELECTION;
  if (bAngularBrushingSelectPolyline) {
    bAngularBrushingSelectPolyline=false;
    bIsAngularBrushingActive=true;
    iSelectedLineID=iExternalID;
    linePick=pick;
    bIsAngularBrushingFirstTime=true;
  }
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
case RIGHT_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (dataDomain != EDataDomain.GENETIC_DATA) break;
GeneContextMenuItemContainer geneContextMenuItemContainer=new GeneContextMenuItemContainer();
geneContextMenuItemContainer.setID(EIDType.EXPRESSION_INDEX,iExternalID);
contextMenu.addItemContanier(geneContextMenuItemContainer);
if (!isRenderedRemote()) {
contextMenu.setLocation(pick.getPickedPoint(),getParentGLCanvas().getWidth(),getParentGLCanvas().getHeight());
contextMenu.setMasterGLView(this);
}
break;
default :
return;
}
if (polylineSelectionManager.checkStatus(eSelectionType,iExternalID)) {
break;
}
connectedElementRepresentationManager.clear(ePolylineDataType);
polylineSelectionManager.clearSelection(eSelectionType);
polylineSelectionManager.addToType(eSelectionType,iExternalID);
polylineSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
if (ePolylineDataType == EIDType.EXPRESSION_INDEX && !bAngularBrushingSelectPolyline) {
ISelectionDelta selectionDelta=polylineSelectionManager.getDelta();
handleConnectedElementRep(selectionDelta);
SelectionUpdateEvent event=new SelectionUpdateEvent();
event.setSender(this);
event.setSelectionDelta((SelectionDelta)selectionDelta);
event.setInfo(getShortInfo());
eventPublisher.triggerEvent(event);
}
setDisplayListDirty();
break;
case X_AXIS_SELECTION:
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
case RIGHT_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (!isRenderedRemote()) {
contextMenu.setLocation(pick.getPickedPoint(),getParentGLCanvas().getWidth(),getParentGLCanvas().getHeight());
contextMenu.setMasterGLView(this);
}
ExperimentContextMenuItemContainer experimentContextMenuItemContainer=new ExperimentContextMenuItemContainer();
experimentContextMenuItemContainer.setID(iExternalID);
contextMenu.addItemContanier(experimentContextMenuItemContainer);
default :
return;
}
axisSelectionManager.clearSelection(eSelectionType);
axisSelectionManager.addToType(eSelectionType,iExternalID);
axisSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
connectedElementRepresentationManager.clear(eAxisDataType);
SelectionCommand command=new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType);
sendSelectionCommandEvent(eAxisDataType,command);
ISelectionDelta selectionDelta=axisSelectionManager.getDelta();
if (eAxisDataType == EIDType.EXPRESSION_INDEX) {
handleConnectedElementRep(selectionDelta);
}
SelectionUpdateEvent event=new SelectionUpdateEvent();
event.setSender(this);
event.setSelectionDelta((SelectionDelta)selectionDelta);
eventPublisher.triggerEvent(event);
rePosition(iExternalID);
setDisplayListDirty();
break;
case GATE_TIP_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_TIP_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
draggedObject=EPickingType.GATE_TIP_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case GATE_BOTTOM_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_BOTTOM_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
draggedObject=EPickingType.GATE_BOTTOM_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case GATE_BODY_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_BODY_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
bIsGateDraggingFirstTime=true;
draggedObject=EPickingType.GATE_BODY_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
break;
}
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DELETE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (axisVA.containsElement(axisVA.get(iExternalID)) == 1) {
hashGates.remove(axisVA.get(iExternalID));
}
axisVA.remove(iExternalID);
axisSelectionManager.remove(iExternalID,false);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(axisVAType,EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.remove(iExternalID));
sendVirtualArrayUpdateEvent(vaDelta);
setDisplayListDirty();
resetAxisSpacing();
break;
}
break;
case MOVE_AXIS:
switch (ePickingMode) {
case CLICKED:
bWasAxisMoved=true;
bWasAxisDraggedFirstTime=true;
iMovedAxisPosition=iExternalID;
setDisplayListDirty();
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_MOVE;
iChangeDropOnAxisNumber=iExternalID;
break;
}
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DUPLICATE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (iExternalID >= 0) {
axisVA.copy(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(axisVAType,EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.copy(iExternalID));
sendVirtualArrayUpdateEvent(vaDelta);
setDisplayListDirty();
resetAxisSpacing();
break;
}
}
break;
case ADD_GATE:
switch (ePickingMode) {
case CLICKED:
Integer iGateCount=hashNumberOfGatesPerAxisID.get(iExternalID);
if (iGateCount == null) {
iGateCount=0;
}
 else {
iGateCount++;
}
hashNumberOfGatesPerAxisID.put(iExternalID,iGateCount);
int iGateID=iExternalID * 1000 + iGateCount;
AGate gate;
if (set.isSetHomogeneous()) {
gate=new Gate(iGateID,(float)set.getRawForNormalized(0),(float)set.getRawForNormalized(0.5f),set,renderStyle);
}
 else {
gate=new NominalGate(iGateID,0,0.5f,set,renderStyle);
}
hashGates.put(iGateID,gate);
hashIsGateBlocking.put(iGateID,new ArrayList<Integer>());
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case ADD_MASTER_GATE:
switch (ePickingMode) {
case CLICKED:
Gate gate=new Gate(++iNumberOfMasterGates,(float)set.getRawForNormalized(0),(float)set.getRawForNormalized(0.5f),set,renderStyle);
hashMasterGates.put(iNumberOfMasterGates,gate);
hashIsGateBlocking.put(iNumberOfMasterGates,new ArrayList<Integer>());
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case REMOVE_GATE:
switch (ePickingMode) {
case CLICKED:
if (iExternalID > 999) {
hashGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
}
 else {
hashMasterGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
}
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
case REMOVE_NAN:
switch (ePickingMode) {
case CLICKED:
if (hashExcludeNAN.containsKey(iExternalID)) {
hashExcludeNAN.remove(iExternalID);
}
 else {
hashExcludeNAN.put(iExternalID,null);
}
setDisplayListDirty();
break;
}
break;
}
}

Fixed version (ground truth):
@Override protected void handlePickingEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW || bIsDraggingActive || bWasAxisMoved) {
    return;
  }
  ESelectionType eSelectionType;
switch (ePickingType) {
case PCS_VIEW_SELECTION:
    break;
case POLYLINE_SELECTION:
switch (ePickingMode) {
case CLICKED:
    eSelectionType=ESelectionType.SELECTION;
  if (bAngularBrushingSelectPolyline) {
    bAngularBrushingSelectPolyline=false;
    bIsAngularBrushingActive=true;
    iSelectedLineID=iExternalID;
    linePick=pick;
    bIsAngularBrushingFirstTime=true;
  }
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
case RIGHT_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (dataDomain != EDataDomain.GENETIC_DATA) break;
GeneContextMenuItemContainer geneContextMenuItemContainer=new GeneContextMenuItemContainer();
geneContextMenuItemContainer.setID(EIDType.EXPRESSION_INDEX,iExternalID);
contextMenu.addItemContanier(geneContextMenuItemContainer);
if (!isRenderedRemote()) {
contextMenu.setLocation(pick.getPickedPoint(),getParentGLCanvas().getWidth(),getParentGLCanvas().getHeight());
contextMenu.setMasterGLView(this);
}
break;
default :
return;
}
if (polylineSelectionManager.checkStatus(eSelectionType,iExternalID)) {
break;
}
connectedElementRepresentationManager.clear(ePolylineDataType);
polylineSelectionManager.clearSelection(eSelectionType);
polylineSelectionManager.addToType(eSelectionType,iExternalID);
polylineSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
if (!bAngularBrushingSelectPolyline) {
ISelectionDelta selectionDelta=polylineSelectionManager.getDelta();
handleConnectedElementRep(selectionDelta);
SelectionUpdateEvent event=new SelectionUpdateEvent();
event.setSender(this);
event.setSelectionDelta((SelectionDelta)selectionDelta);
event.setInfo(getShortInfo());
eventPublisher.triggerEvent(event);
}
setDisplayListDirty();
break;
case X_AXIS_SELECTION:
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
case RIGHT_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (!isRenderedRemote()) {
contextMenu.setLocation(pick.getPickedPoint(),getParentGLCanvas().getWidth(),getParentGLCanvas().getHeight());
contextMenu.setMasterGLView(this);
}
ExperimentContextMenuItemContainer experimentContextMenuItemContainer=new ExperimentContextMenuItemContainer();
experimentContextMenuItemContainer.setID(iExternalID);
contextMenu.addItemContanier(experimentContextMenuItemContainer);
default :
return;
}
axisSelectionManager.clearSelection(eSelectionType);
axisSelectionManager.addToType(eSelectionType,iExternalID);
axisSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
connectedElementRepresentationManager.clear(eAxisDataType);
SelectionCommand command=new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType);
sendSelectionCommandEvent(eAxisDataType,command);
ISelectionDelta selectionDelta=axisSelectionManager.getDelta();
if (eAxisDataType == EIDType.EXPRESSION_INDEX) {
handleConnectedElementRep(selectionDelta);
}
SelectionUpdateEvent event=new SelectionUpdateEvent();
event.setSender(this);
event.setSelectionDelta((SelectionDelta)selectionDelta);
eventPublisher.triggerEvent(event);
rePosition(iExternalID);
setDisplayListDirty();
break;
case GATE_TIP_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_TIP_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
draggedObject=EPickingType.GATE_TIP_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case GATE_BOTTOM_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_BOTTOM_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
draggedObject=EPickingType.GATE_BOTTOM_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case GATE_BODY_SELECTION:
switch (ePickingMode) {
case MOUSE_OVER:
iDraggedGateNumber=iExternalID;
draggedObject=EPickingType.GATE_BODY_SELECTION;
setDisplayListDirty();
break;
case CLICKED:
bIsDraggingActive=true;
bIsGateDraggingFirstTime=true;
draggedObject=EPickingType.GATE_BODY_SELECTION;
iDraggedGateNumber=iExternalID;
break;
}
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
break;
}
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DELETE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (axisVA.containsElement(axisVA.get(iExternalID)) == 1) {
hashGates.remove(axisVA.get(iExternalID));
}
axisVA.remove(iExternalID);
axisSelectionManager.remove(iExternalID,false);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(axisVAType,EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.remove(iExternalID));
sendVirtualArrayUpdateEvent(vaDelta);
setDisplayListDirty();
resetAxisSpacing();
break;
}
break;
case MOVE_AXIS:
switch (ePickingMode) {
case CLICKED:
bWasAxisMoved=true;
bWasAxisDraggedFirstTime=true;
iMovedAxisPosition=iExternalID;
setDisplayListDirty();
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_MOVE;
iChangeDropOnAxisNumber=iExternalID;
break;
}
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DUPLICATE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (iExternalID >= 0) {
axisVA.copy(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(axisVAType,EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.copy(iExternalID));
sendVirtualArrayUpdateEvent(vaDelta);
setDisplayListDirty();
resetAxisSpacing();
break;
}
}
break;
case ADD_GATE:
switch (ePickingMode) {
case CLICKED:
Integer iGateCount=hashNumberOfGatesPerAxisID.get(iExternalID);
if (iGateCount == null) {
iGateCount=0;
}
 else {
iGateCount++;
}
hashNumberOfGatesPerAxisID.put(iExternalID,iGateCount);
int iGateID=iExternalID * 1000 + iGateCount;
AGate gate;
if (set.isSetHomogeneous()) {
gate=new Gate(iGateID,(float)set.getRawForNormalized(0),(float)set.getRawForNormalized(0.5f),set,renderStyle);
}
 else {
gate=new NominalGate(iGateID,0,0.5f,set,renderStyle);
}
hashGates.put(iGateID,gate);
hashIsGateBlocking.put(iGateID,new ArrayList<Integer>());
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case ADD_MASTER_GATE:
switch (ePickingMode) {
case CLICKED:
Gate gate=new Gate(++iNumberOfMasterGates,(float)set.getRawForNormalized(0),(float)set.getRawForNormalized(0.5f),set,renderStyle);
hashMasterGates.put(iNumberOfMasterGates,gate);
hashIsGateBlocking.put(iNumberOfMasterGates,new ArrayList<Integer>());
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case REMOVE_GATE:
switch (ePickingMode) {
case CLICKED:
if (iExternalID > 999) {
hashGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
}
 else {
hashMasterGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
}
handleUnselection();
triggerSelectionUpdate();
setDisplayListDirty();
break;
}
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
break;
case REMOVE_NAN:
switch (ePickingMode) {
case CLICKED:
if (hashExcludeNAN.containsKey(iExternalID)) {
hashExcludeNAN.remove(iExternalID);
}
 else {
hashExcludeNAN.put(iExternalID,null);
}
setDisplayListDirty();
break;
}
break;
}
}