Program: 58870
Project: 58870
Buggy source:
@Override protected void handleEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW || bIsDraggingActive || bWasAxisMoved) {
    pickingManager.flushHits(iUniqueID,ePickingType);
    return;
  }
  ESelectionType eSelectionType;
switch (ePickingType) {
case PCS_VIEW_SELECTION:
    pickingManager.flushHits(iUniqueID,EPickingType.PCS_VIEW_SELECTION);
  break;
case POLYLINE_SELECTION:
switch (ePickingMode) {
case DOUBLE_CLICKED:
  LoadPathwaysByGeneEvent loadPathwaysByGeneEvent=new LoadPathwaysByGeneEvent();
loadPathwaysByGeneEvent.setGeneID(IDMappingHelper.get().getRefSeqFromStorageIndex(iExternalID));
loadPathwaysByGeneEvent.setIdType(EIDType.REFSEQ_MRNA_INT);
generalManager.getEventPublisher().triggerEvent(loadPathwaysByGeneEvent);
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;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
infoAreaManager.setData(iExternalID,EIDType.EXPRESSION_INDEX,pick.getPickedPoint(),pick.getDepth());
if (polylineSelectionManager.checkStatus(eSelectionType,iExternalID)) {
break;
}
connectedElementRepresentationManager.clear(ePolylineDataType);
polylineSelectionManager.clearSelection(eSelectionType);
if (ePolylineDataType == EIDType.EXPRESSION_INDEX) {
Integer iRefSeqID=idMappingManager.getID(EMappingType.EXPRESSION_INDEX_2_REFSEQ_MRNA_INT,iExternalID);
if (iRefSeqID == null) {
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
int iConnectionID=generalManager.getIDManager().createID(EManagedObjectType.CONNECTION);
for (Object iExpressionIndex : idMappingManager.getMultiID(EMappingType.REFSEQ_MRNA_INT_2_EXPRESSION_INDEX,iRefSeqID)) {
polylineSelectionManager.addToType(eSelectionType,(Integer)iExpressionIndex);
polylineSelectionManager.addConnectionID(iConnectionID,(Integer)iExpressionIndex);
}
}
 else {
polylineSelectionManager.addToType(eSelectionType,iExternalID);
polylineSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
}
if (ePolylineDataType == EIDType.EXPRESSION_INDEX && !bAngularBrushingSelectPolyline) {
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(EIDType.REFSEQ_MRNA_INT,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=contentSelectionManager.getDelta();
handleConnectedElementRep(selectionDelta);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
}
setDisplayListDirty();
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case X_AXIS_SELECTION:
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
axisSelectionManager.clearSelection(eSelectionType);
axisSelectionManager.addToType(eSelectionType,iExternalID);
axisSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
connectedElementRepresentationManager.clear(eAxisDataType);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(eAxisDataType,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=axisSelectionManager.getDelta();
if (eAxisDataType == EIDType.EXPRESSION_INDEX) {
handleConnectedElementRep(selectionDelta);
}
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
rePosition(iExternalID);
setDisplayListDirty();
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.PC_ICON_SELECTION);
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DELETE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
IVirtualArray axisVA=set.getVA(iAxisVAID);
if (axisVA.containsElement(axisVA.get(iExternalID)) == 1) {
hashGates.remove(axisVA.get(iExternalID));
}
axisVA.remove(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.remove(iExternalID));
generalManager.getEventPublisher().triggerEvent(EMediatorType.SELECTION_MEDIATOR,this,new DeltaEventContainer<IVirtualArrayDelta>(vaDelta));
setDisplayListDirty();
resetAxisSpacing();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_AXIS);
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;
}
pickingManager.flushHits(iUniqueID,EPickingType.MOVE_AXIS);
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DUPLICATE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (iExternalID >= 0) {
set.getVA(iAxisVAID).copy(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.copy(iExternalID));
generalManager.getEventPublisher().triggerEvent(EMediatorType.SELECTION_MEDIATOR,this,new DeltaEventContainer<IVirtualArrayDelta>(vaDelta));
setDisplayListDirty();
resetAxisSpacing();
break;
}
}
pickingManager.flushHits(iUniqueID,EPickingType.DUPLICATE_AXIS);
break;
case ADD_GATE:
switch (ePickingMode) {
case CLICKED:
Integer iGateCount=hashNumberOfGatesPerAxisID.get(iExternalID);
if (iGateCount == null) {
iGateCount=1;
}
 else {
iGateCount++;
}
hashNumberOfGatesPerAxisID.put(iExternalID,iGateCount);
int iGateID=iExternalID * 1000 + iGateCount;
hashGates.put(iGateID,new Pair<Float,Float>(0f,renderStyle.getAxisHeight() / 2f));
hashIsGateBlocking.put(iGateID,new ArrayList<Integer>());
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.ADD_GATE);
break;
case ADD_MASTER_GATE:
switch (ePickingMode) {
case CLICKED:
hashMasterGates.put(++iNumberOfMasterGates,new Pair<Float,Float>(0f,renderStyle.getAxisHeight() / 2f));
hashIsGateBlocking.put(iNumberOfMasterGates,new ArrayList<Integer>());
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.ADD_MASTER_GATE);
break;
case REMOVE_GATE:
switch (ePickingMode) {
case CLICKED:
if (iExternalID > 999) {
hashGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
setDisplayListDirty();
}
 else {
hashMasterGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
setDisplayListDirty();
}
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_GATE);
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueID,EPickingType.ANGULAR_UPPER);
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueID,EPickingType.ANGULAR_LOWER);
break;
case REMOVE_NAN:
switch (ePickingMode) {
case CLICKED:
if (hashExcludeNAN.containsKey(iExternalID)) {
hashExcludeNAN.remove(iExternalID);
}
 else {
hashExcludeNAN.put(iExternalID,null);
}
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_NAN);
break;
}
}

Fixed version (ground truth):
@Override protected void handleEvents(final EPickingType ePickingType,final EPickingMode ePickingMode,final int iExternalID,final Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW || bIsDraggingActive || bWasAxisMoved) {
    pickingManager.flushHits(iUniqueID,ePickingType);
    return;
  }
  ESelectionType eSelectionType;
switch (ePickingType) {
case PCS_VIEW_SELECTION:
    pickingManager.flushHits(iUniqueID,EPickingType.PCS_VIEW_SELECTION);
  break;
case POLYLINE_SELECTION:
switch (ePickingMode) {
case DOUBLE_CLICKED:
  LoadPathwaysByGeneEvent loadPathwaysByGeneEvent=new LoadPathwaysByGeneEvent();
loadPathwaysByGeneEvent.setGeneID(IDMappingHelper.get().getRefSeqFromStorageIndex(iExternalID));
loadPathwaysByGeneEvent.setIdType(EIDType.REFSEQ_MRNA_INT);
generalManager.getEventPublisher().triggerEvent(loadPathwaysByGeneEvent);
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;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
if (polylineSelectionManager.checkStatus(eSelectionType,iExternalID)) {
break;
}
connectedElementRepresentationManager.clear(ePolylineDataType);
polylineSelectionManager.clearSelection(eSelectionType);
if (ePolylineDataType == EIDType.EXPRESSION_INDEX) {
Integer iRefSeqID=idMappingManager.getID(EMappingType.EXPRESSION_INDEX_2_REFSEQ_MRNA_INT,iExternalID);
if (iRefSeqID == null) {
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
int iConnectionID=generalManager.getIDManager().createID(EManagedObjectType.CONNECTION);
for (Object iExpressionIndex : idMappingManager.getMultiID(EMappingType.REFSEQ_MRNA_INT_2_EXPRESSION_INDEX,iRefSeqID)) {
polylineSelectionManager.addToType(eSelectionType,(Integer)iExpressionIndex);
polylineSelectionManager.addConnectionID(iConnectionID,(Integer)iExpressionIndex);
}
}
 else {
polylineSelectionManager.addToType(eSelectionType,iExternalID);
polylineSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
}
if (ePolylineDataType == EIDType.EXPRESSION_INDEX && !bAngularBrushingSelectPolyline) {
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(EIDType.REFSEQ_MRNA_INT,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=contentSelectionManager.getDelta();
handleConnectedElementRep(selectionDelta);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
}
setDisplayListDirty();
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case X_AXIS_SELECTION:
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case Y_AXIS_SELECTION:
switch (ePickingMode) {
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
axisSelectionManager.clearSelection(eSelectionType);
axisSelectionManager.addToType(eSelectionType,iExternalID);
axisSelectionManager.addConnectionID(generalManager.getIDManager().createID(EManagedObjectType.CONNECTION),iExternalID);
connectedElementRepresentationManager.clear(eAxisDataType);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(eAxisDataType,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=axisSelectionManager.getDelta();
if (eAxisDataType == EIDType.EXPRESSION_INDEX) {
handleConnectedElementRep(selectionDelta);
}
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
rePosition(iExternalID);
setDisplayListDirty();
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
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;
}
pickingManager.flushHits(iUniqueID,ePickingType);
break;
case PC_ICON_SELECTION:
switch (ePickingMode) {
case CLICKED:
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.PC_ICON_SELECTION);
break;
case REMOVE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DELETE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
IVirtualArray axisVA=set.getVA(iAxisVAID);
if (axisVA.containsElement(axisVA.get(iExternalID)) == 1) {
hashGates.remove(axisVA.get(iExternalID));
}
axisVA.remove(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.remove(iExternalID));
generalManager.getEventPublisher().triggerEvent(EMediatorType.SELECTION_MEDIATOR,this,new DeltaEventContainer<IVirtualArrayDelta>(vaDelta));
setDisplayListDirty();
resetAxisSpacing();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_AXIS);
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;
}
pickingManager.flushHits(iUniqueID,EPickingType.MOVE_AXIS);
break;
case DUPLICATE_AXIS:
switch (ePickingMode) {
case MOUSE_OVER:
dropTexture=EIconTextures.DROP_DUPLICATE;
iChangeDropOnAxisNumber=iExternalID;
break;
case CLICKED:
if (iExternalID >= 0) {
set.getVA(iAxisVAID).copy(iExternalID);
IVirtualArrayDelta vaDelta=new VirtualArrayDelta(EIDType.EXPERIMENT_INDEX);
vaDelta.add(VADeltaItem.copy(iExternalID));
generalManager.getEventPublisher().triggerEvent(EMediatorType.SELECTION_MEDIATOR,this,new DeltaEventContainer<IVirtualArrayDelta>(vaDelta));
setDisplayListDirty();
resetAxisSpacing();
break;
}
}
pickingManager.flushHits(iUniqueID,EPickingType.DUPLICATE_AXIS);
break;
case ADD_GATE:
switch (ePickingMode) {
case CLICKED:
Integer iGateCount=hashNumberOfGatesPerAxisID.get(iExternalID);
if (iGateCount == null) {
iGateCount=1;
}
 else {
iGateCount++;
}
hashNumberOfGatesPerAxisID.put(iExternalID,iGateCount);
int iGateID=iExternalID * 1000 + iGateCount;
hashGates.put(iGateID,new Pair<Float,Float>(0f,renderStyle.getAxisHeight() / 2f));
hashIsGateBlocking.put(iGateID,new ArrayList<Integer>());
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.ADD_GATE);
break;
case ADD_MASTER_GATE:
switch (ePickingMode) {
case CLICKED:
hashMasterGates.put(++iNumberOfMasterGates,new Pair<Float,Float>(0f,renderStyle.getAxisHeight() / 2f));
hashIsGateBlocking.put(iNumberOfMasterGates,new ArrayList<Integer>());
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.ADD_MASTER_GATE);
break;
case REMOVE_GATE:
switch (ePickingMode) {
case CLICKED:
if (iExternalID > 999) {
hashGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
setDisplayListDirty();
}
 else {
hashMasterGates.remove(iExternalID);
hashIsGateBlocking.remove(iExternalID);
setDisplayListDirty();
}
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_GATE);
break;
case ANGULAR_UPPER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueID,EPickingType.ANGULAR_UPPER);
break;
case ANGULAR_LOWER:
switch (ePickingMode) {
case CLICKED:
bIsAngularDraggingActive=true;
case DRAGGED:
bIsAngularDraggingActive=true;
}
pickingManager.flushHits(iUniqueID,EPickingType.ANGULAR_LOWER);
break;
case REMOVE_NAN:
switch (ePickingMode) {
case CLICKED:
if (hashExcludeNAN.containsKey(iExternalID)) {
hashExcludeNAN.remove(iExternalID);
}
 else {
hashExcludeNAN.put(iExternalID,null);
}
setDisplayListDirty();
break;
}
pickingManager.flushHits(iUniqueID,EPickingType.REMOVE_NAN);
break;
}
}