nus-yam/ex-repair huggingface dataset:
Program: 58630
Project: 58630
Buggy source:
/** 
 * Function which merges the clusters determined by the cut off value to group lists used for rendering the clusters assignments in   {@link GLHierarchicalHeatMap}.
 */
private void buildNewGroupList(){
  if (iAlClusterNodes.size() < 2) {
    groupList=null;
    if (bRenderGeneTree) {
      useCase.getSet().setGroupListGenes(groupList);
    }
 else {
      useCase.getSet().setGroupListExperiments(groupList);
    }
    eventPublisher.triggerEvent(new ReplaceVirtualArrayEvent(EVAType.CONTENT));
    bRedrawDendrogram=true;
    bEnableDepthCheck=false;
    setDisplayListDirty();
    return;
  }
  groupList=new GroupList(iAlClusterNodes.size());
  bEnableDepthCheck=true;
  int cnt=0;
  int iExample=0;
  IVirtualArray currentVA=null;
  if (bRenderGeneTree) {
    currentVA=contentVA;
  }
 else {
    currentVA=storageVA;
  }
  for (  ClusterNode iter : iAlClusterNodes) {
    Group temp=new Group(iter.getNrElements(),false,currentVA.get(iExample),ESelectionType.NORMAL,iter);
    groupList.append(temp);
    cnt++;
    iExample+=iter.getNrElements();
  }
  if (bRenderGeneTree) {
    contentVA.setGroupList(groupList);
    useCase.replaceVirtualArray(EVAType.CONTENT,contentVA);
  }
 else {
    storageVA.setGroupList(groupList);
    useCase.replaceVirtualArray(EVAType.STORAGE,storageVA);
  }
}

Fixed version (ground truth):
/** 
 * Function which merges the clusters determined by the cut off value to group lists used for rendering the clusters assignments in   {@link GLHierarchicalHeatMap}.
 */
private void buildNewGroupList(){
  if (iAlClusterNodes.size() < 2) {
    groupList=null;
    if (bRenderGeneTree) {
      useCase.getSet().setGroupListGenes(groupList);
      useCase.replaceVirtualArray(EVAType.CONTENT,contentVA);
    }
 else {
      useCase.getSet().setGroupListExperiments(groupList);
      useCase.replaceVirtualArray(EVAType.STORAGE,storageVA);
    }
    bRedrawDendrogram=true;
    bEnableDepthCheck=false;
    setDisplayListDirty();
    return;
  }
  groupList=new GroupList(iAlClusterNodes.size());
  bEnableDepthCheck=true;
  int cnt=0;
  int iExample=0;
  IVirtualArray currentVA=null;
  if (bRenderGeneTree) {
    currentVA=contentVA;
  }
 else {
    currentVA=storageVA;
  }
  for (  ClusterNode iter : iAlClusterNodes) {
    Group temp=new Group(iter.getNrElements(),false,currentVA.get(iExample),ESelectionType.NORMAL,iter);
    groupList.append(temp);
    cnt++;
    iExample+=iter.getNrElements();
  }
  if (bRenderGeneTree) {
    useCase.getSet().setGroupListGenes(groupList);
    useCase.replaceVirtualArray(EVAType.CONTENT,contentVA);
  }
 else {
    useCase.getSet().setGroupListExperiments(groupList);
    useCase.replaceVirtualArray(EVAType.STORAGE,storageVA);
  }
}
Program: 58632
Project: 58632
Buggy source:
/** 
 * Depending on which group info should be handeld a bollean has to be set. True for genes, false for experiments
 * @param bGeneGroup if true gene groups will be handled, if false experiment groups
 */
public void setGeneExperimentFlag(boolean bGeneGroup){
  InterchangeGroupsEvent interchangeGroupsEvent=new InterchangeGroupsEvent();
  interchangeGroupsEvent.setSender(this);
  interchangeGroupsEvent.setGeneExperimentFlag(bGeneGroup);
  registerEvent(interchangeGroupsEvent);
}

Fixed version (ground truth):
/** 
 * Depending on which group info should be handled a boolean has to be set. True for genes, false for experiments
 * @param bGeneGroup if true gene groups will be handled, if false experiment groups
 */
public void setGeneExperimentFlag(boolean bGeneGroup){
  InterchangeGroupsEvent interchangeGroupsEvent=new InterchangeGroupsEvent();
  interchangeGroupsEvent.setSender(this);
  interchangeGroupsEvent.setGeneExperimentFlag(bGeneGroup);
  registerEvent(interchangeGroupsEvent);
}
Program: 58633
Project: 58633
Buggy source:
/** 
 * Depending on which group info should be handeld a bollean has to be set. True for genes, false for experiments
 * @param bGeneGroup if true gene groups will be handled, if false experiment groups
 */
public void setGeneExperimentFlag(boolean bGeneGroup){
  MergeGroupsEvent mergeGroupEvent=new MergeGroupsEvent();
  mergeGroupEvent.setSender(this);
  mergeGroupEvent.setGeneExperimentFlag(bGeneGroup);
  registerEvent(mergeGroupEvent);
}

Fixed version (ground truth):
/** 
 * Depending on which group info should be handled a boolean has to be set. True for genes, false for experiments
 * @param bGeneGroup if true gene groups will be handled, if false experiment groups
 */
public void setGeneExperimentFlag(boolean bGeneGroup){
  MergeGroupsEvent mergeGroupEvent=new MergeGroupsEvent();
  mergeGroupEvent.setSender(this);
  mergeGroupEvent.setGeneExperimentFlag(bGeneGroup);
  registerEvent(mergeGroupEvent);
}
Program: 58634
Project: 58634
Buggy source:
@Override public void replaceVirtualArray(EVAType vaType){
  if (vaType == storageVAType) {
    storageVA=useCase.getVA(vaType);
    storageSelectionManager.setVA(storageVA);
  }
 else   if (vaType == contentVAType) {
    contentVA=useCase.getVA(vaType);
    contentSelectionManager.setVA(contentVA);
  }
 else   return;
}

Fixed version (ground truth):
@Override public void replaceVirtualArray(EVAType vaType){
  if (vaType == storageVAType) {
    storageVA=useCase.getVA(vaType);
  }
 else   if (vaType == contentVAType) {
    contentVA=useCase.getVA(vaType);
  }
 else   return;
  initData();
}
Program: 58635
Project: 58635
Buggy source:
@Override public void handleVirtualArrayUpdate(IVirtualArrayDelta delta,String info){
  super.handleVirtualArrayUpdate(delta,info);
  if (delta.getVAType() == EVAType.CONTENT_CONTEXT && contentVAType == EVAType.CONTENT_CONTEXT) {
    long original=System.currentTimeMillis();
    System.out.println("String_Node_Str");
    AffinityClusterer clusterer=new AffinityClusterer(contentVA.size());
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.GENE_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    state.setContentVaId(contentVA.getID());
    state.setStorageVaId(storageVA.getID());
    state.setAffinityPropClusterFactorGenes(4.0f);
    IVirtualArray tempVA2=set.getVA(contentVAID);
    IVirtualArray tempVA=clusterer.getSortedVA(set,state,0,2);
    contentVA=tempVA;
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
    long result=System.currentTimeMillis() - original;
    System.out.println("String_Node_Str" + result);
  }
}

Fixed version (ground truth):
@Override public void handleVirtualArrayUpdate(IVirtualArrayDelta delta,String info){
  super.handleVirtualArrayUpdate(delta,info);
  if (delta.getVAType() == EVAType.CONTENT_CONTEXT && contentVAType == EVAType.CONTENT_CONTEXT) {
    AffinityClusterer clusterer=new AffinityClusterer(contentVA.size());
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.GENE_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    state.setContentVaId(contentVA.getID());
    state.setStorageVaId(storageVA.getID());
    state.setAffinityPropClusterFactorGenes(4.0f);
    IVirtualArray tempVA=clusterer.getSortedVA(set,state,0,2);
    contentVA=tempVA;
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
  }
}
Program: 58636
Project: 58636
Buggy source:
/** 
 * Constructor.
 */
protected AGLEventListener(GLCaleydoCanvas glCanvas,final String sLabel,final IViewFrustum viewFrustum,final boolean bRegisterToParentCanvasNow){
  super(glCanvas != null ? glCanvas.getID() : -1,sLabel,GeneralManager.get().getIDManager().createID(EManagedObjectType.GL_EVENT_LISTENER));
  parentGLCanvas=glCanvas;
  if (bRegisterToParentCanvasNow && parentGLCanvas != null) {
    glMouseListener=parentGLCanvas.getGLMouseListener();
  }
  this.viewFrustum=viewFrustum;
  viewCamera=new ViewCameraBase(iUniqueID);
  pickingManager=generalManager.getViewGLCanvasManager().getPickingManager();
  idMappingManager=generalManager.getIDMappingManager();
  textureManager=new TextureManager();
  contextMenu=ContextMenu.get();
  queue=new LinkedBlockingQueue<Pair<AEventListener<? extends IListenerOwner>,AEvent>>();
}

Fixed version (ground truth):
/** 
 * Constructor.
 */
protected AGLEventListener(GLCaleydoCanvas glCanvas,final String sLabel,final IViewFrustum viewFrustum,final boolean bRegisterToParentCanvasNow){
  super(glCanvas != null ? glCanvas.getID() : -1,sLabel,GeneralManager.get().getIDManager().createID(EManagedObjectType.GL_EVENT_LISTENER));
  parentGLCanvas=glCanvas;
  if (bRegisterToParentCanvasNow && parentGLCanvas != null) {
    glMouseListener=parentGLCanvas.getGLMouseListener();
  }
  this.viewFrustum=viewFrustum;
  viewCamera=new ViewCameraBase(iUniqueID);
  pickingManager=generalManager.getViewGLCanvasManager().getPickingManager();
  idMappingManager=generalManager.getIDMappingManager();
  textureManager=new TextureManager();
  contextMenu=ContextMenu.get();
  queue=new LinkedBlockingQueue<Pair<AEventListener<? extends IListenerOwner>,AEvent>>();
  bShowMagnifyingGlass=false;
}
Program: 58637
Project: 58637
Buggy source:
@Override public void draw(float fXCenter,float fYCenter,GL gl,GLU glu,double dTimePassed){
  PartialDisc pdCurrentSelectedElement=radialHierarchy.getCurrentSelectedElement();
  if (!bAnimationStarted) {
    initAnimation(fXCenter,fYCenter,pdCurrentSelectedElement);
    bAnimationStarted=true;
    radialHierarchy.setAnimationActive(true);
  }
  moveValues(dTimePassed);
  dsFixedColor.setFillColor(mvCurrentRootColorR.getMovementValue(),mvCurrentRootColorG.getMovementValue(),mvCurrentRootColorB.getMovementValue(),1);
  gl.glLoadIdentity();
  gl.glTranslatef(fXCenter,fYCenter,0);
  pdCurrentSelectedElement.drawHierarchyAngular(gl,glu,mvCurrentWidth.getMovementValue(),fTargetDepth,mvCurrentRootStartAngle.getMovementValue(),mvCurrentRootAngle.getMovementValue(),mvCurrentRootInnerRadius.getMovementValue());
  if (haveMovementValuesReachedTargets()) {
    bAnimationStarted=false;
  }
  if (!bAnimationStarted) {
    ADrawingState dsNext=drawingController.getDrawingState(EDrawingStateType.DRAWING_STATE_FULL_HIERARCHY);
    drawingController.setDrawingState(dsNext);
    radialHierarchy.setAnimationActive(false);
    radialHierarchy.setCurrentRootElement(pdCurrentSelectedElement);
    navigationHistory.addNewHistoryEntry(dsNext,pdCurrentSelectedElement,pdCurrentSelectedElement,radialHierarchy.getMaxDisplayedHierarchyDepth());
    radialHierarchy.setNewSelection(ESelectionType.SELECTION,pdCurrentSelectedElement,pdCurrentSelectedElement);
    radialHierarchy.setDisplayListDirty();
  }
}

Fixed version (ground truth):
@Override public void draw(float fXCenter,float fYCenter,GL gl,GLU glu,double dTimePassed){
  PartialDisc pdCurrentSelectedElement=radialHierarchy.getCurrentSelectedElement();
  if (!bAnimationStarted) {
    initAnimation(fXCenter,fYCenter,pdCurrentSelectedElement);
    bAnimationStarted=true;
    radialHierarchy.setAnimationActive(true);
  }
  moveValues(dTimePassed);
  dsFixedColor.setFillColor(mvCurrentRootColorR.getMovementValue(),mvCurrentRootColorG.getMovementValue(),mvCurrentRootColorB.getMovementValue(),1);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  gl.glTranslatef(fXCenter,fYCenter,0);
  pdCurrentSelectedElement.drawHierarchyAngular(gl,glu,mvCurrentWidth.getMovementValue(),fTargetDepth,mvCurrentRootStartAngle.getMovementValue(),mvCurrentRootAngle.getMovementValue(),mvCurrentRootInnerRadius.getMovementValue());
  if (haveMovementValuesReachedTargets()) {
    bAnimationStarted=false;
  }
  if (!bAnimationStarted) {
    ADrawingState dsNext=drawingController.getDrawingState(EDrawingStateType.DRAWING_STATE_FULL_HIERARCHY);
    drawingController.setDrawingState(dsNext);
    radialHierarchy.setAnimationActive(false);
    radialHierarchy.setCurrentRootElement(pdCurrentSelectedElement);
    navigationHistory.addNewHistoryEntry(dsNext,pdCurrentSelectedElement,pdCurrentSelectedElement,radialHierarchy.getMaxDisplayedHierarchyDepth());
    radialHierarchy.setNewSelection(ESelectionType.SELECTION,pdCurrentSelectedElement,pdCurrentSelectedElement);
    radialHierarchy.setDisplayListDirty();
  }
  gl.glPopMatrix();
}
Program: 58642
Project: 58642
Buggy source:
@Override public void unregisterEventListeners(){
  if (redrawViewListener != null) {
    eventPublisher.removeListener(redrawViewListener);
    redrawViewListener=null;
  }
  if (clusterNodeMouseOverListener != null) {
    eventPublisher.removeListener(clusterNodeMouseOverListener);
    clusterNodeMouseOverListener=null;
  }
  if (goBackInHistoryListener != null) {
    eventPublisher.removeListener(goBackInHistoryListener);
    goBackInHistoryListener=null;
  }
  if (goForthInHistoryListener != null) {
    eventPublisher.removeListener(goForthInHistoryListener);
    goForthInHistoryListener=null;
  }
  if (changeColorModeListener != null) {
    eventPublisher.removeListener(changeColorModeListener);
    changeColorModeListener=null;
  }
  if (setMaxDisplayedHierarchyDepthListener != null) {
    eventPublisher.removeListener(setMaxDisplayedHierarchyDepthListener);
    setMaxDisplayedHierarchyDepthListener=null;
  }
  if (detailOutsideListener != null) {
    eventPublisher.removeListener(detailOutsideListener);
    detailOutsideListener=null;
  }
  if (updateViewListener != null) {
    eventPublisher.removeListener(updateViewListener);
    updateViewListener=null;
  }
  if (selectionUpdateListener != null) {
    eventPublisher.removeListener(selectionUpdateListener);
    selectionUpdateListener=null;
  }
  if (clearSelectionsListener != null) {
    eventPublisher.removeListener(clearSelectionsListener);
    clearSelectionsListener=null;
  }
}

Fixed version (ground truth):
@Override public void unregisterEventListeners(){
  super.unregisterEventListeners();
  if (redrawViewListener != null) {
    eventPublisher.removeListener(redrawViewListener);
    redrawViewListener=null;
  }
  if (clusterNodeMouseOverListener != null) {
    eventPublisher.removeListener(clusterNodeMouseOverListener);
    clusterNodeMouseOverListener=null;
  }
  if (goBackInHistoryListener != null) {
    eventPublisher.removeListener(goBackInHistoryListener);
    goBackInHistoryListener=null;
  }
  if (goForthInHistoryListener != null) {
    eventPublisher.removeListener(goForthInHistoryListener);
    goForthInHistoryListener=null;
  }
  if (changeColorModeListener != null) {
    eventPublisher.removeListener(changeColorModeListener);
    changeColorModeListener=null;
  }
  if (setMaxDisplayedHierarchyDepthListener != null) {
    eventPublisher.removeListener(setMaxDisplayedHierarchyDepthListener);
    setMaxDisplayedHierarchyDepthListener=null;
  }
  if (detailOutsideListener != null) {
    eventPublisher.removeListener(detailOutsideListener);
    detailOutsideListener=null;
  }
  if (updateViewListener != null) {
    eventPublisher.removeListener(updateViewListener);
    updateViewListener=null;
  }
  if (selectionUpdateListener != null) {
    eventPublisher.removeListener(selectionUpdateListener);
    selectionUpdateListener=null;
  }
  if (clearSelectionsListener != null) {
    eventPublisher.removeListener(clearSelectionsListener);
    clearSelectionsListener=null;
  }
}
Program: 58647
Project: 58647
Buggy source:
private float calculateCircle(float radius,float current_step,float numberOfElements){
  float phi=(float)((float)2 * Math.PI / numberOfElements);
  setFXCoord((float)(fCenterX + radius * Math.cos(phi * current_step)));
  setFYCoord((float)(fCenterY + radius * Math.sin(phi * current_step)));
  return phi;
}

Fixed version (ground truth):
private float calculateCircle(float radius,float current_step,float numberOfElements){
  float phi=(float)((float)2 * Math.PI / numberOfElements);
  setFXCoord((float)(fCenterX + radius * Math.cos(phi * current_step)));
  setFYCoord((float)(fCenterY + radius * Math.sin(phi * current_step)));
  return phi * current_step;
}
Program: 58648
Project: 58648
Buggy source:
public float calculateRecursiveLayout(GL gl,ADrawAbleNode node,Tree<ADrawAbleNode> tree,float radius,float angle,float layer,float fNodeSize){
  float fNumberOfNodesInLayer=5.0f + layer;
  for (float fCurrentNode=1; fCurrentNode <= fNumberOfNodesInLayer; fCurrentNode++) {
    float childRadius=radius + 0.5f;
    float alpha=calculateCircle((radius),fCurrentNode,fNumberOfNodesInLayer);
    float space=calculateChildSpace(childRadius,fNumberOfNodesInLayer);
    if (tree.hasChildren(node)) {
      float childs=5.0f;
      int childCount=0;
      for (float numChilds=1; numChilds < childs; numChilds++) {
        childCount++;
        childAngle=calculateChildAngle(alpha * fCurrentNode,space / childs,childRadius) * childCount + (alpha / 2);
        calculateRecursiveLayout(gl,node,tree,childRadius,childAngle,layer + 1,fNodeSize);
      }
    }
    node.drawAtPostion(gl,getFXCoord(),getFYCoord(),0,fNodeSize,0.2f,EDrawAbleNodeDetailLevel.Low);
    childAngle=0.0f;
  }
  return angle;
}

Fixed version (ground truth):
public float calculateRecursiveLayout(GL gl,ADrawAbleNode node,Tree<ADrawAbleNode> tree,float radius,float angle,float layer,float currentStep,float fNumberOfNodesInLayer,float fNodeSize){
  float fNumberOfNodesInNewLayer=fNumberOfNodesInLayer;
  float space=calculateChildSpace(radius,fNumberOfNodesInNewLayer);
  if (layer < fDepth) {
    float childs=4.0f;
    int childCount=0;
    float childAngle=0.0f;
    for (float numChilds=1; numChilds < childs; numChilds++) {
      childCount++;
      float parentAngle=(angle) - (angle / currentStep);
      float alphaHalfOffset=(angle / currentStep / 2);
      childAngle=calculateChildAngle(parentAngle,space / childs,radius,numChilds) + alphaHalfOffset;
      calcualteChildPosition(radius,childAngle,numChilds);
      node.drawAtPostion(gl,getFXCoord(),getFYCoord(),0,fNodeSize,0.2f,EDrawAbleNodeDetailLevel.Low);
      calculateRecursiveLayout(gl,node,tree,radius + 0.7f,childAngle,layer + 1,numChilds,fNumberOfNodesInNewLayer * childs,fNodeSize);
    }
    gl.glFlush();
  }
  return angle;
}
Program: 58649
Project: 58649
Buggy source:
@Override public void renderTreeLayout(GL gl,Tree<ADrawAbleNode> tree){
  updateSizeInfo();
  if (tree == null)   return;
  setFCenterX(fViewSpaceXAbs / 2);
  setFCenterY(fViewSpaceYAbs / 2);
  ADrawAbleNode rootNode=tree.getRoot();
  float fNumberOfNodesInLayer=5.0f;
  float fNodeSize=0.2f;
  float layer=1.0f;
  float firstRadius=0.5f;
  fNodeSize=fNodeSize * HyperbolicRenderStyle.LIN_TREE_Y_SCALING_PER_LAYER;
  Vec3f p1=new Vec3f(3.0f,3.0f,0);
  Vec3f p2=new Vec3f(1.1f,2.8f,0);
  Vec3f p3=new Vec3f(1.0f,1.0f,0);
  vec.add(p1);
  vec.add(p2);
  vec.add(p3);
  return;
}

Fixed version (ground truth):
@Override public void renderTreeLayout(GL gl,Tree<ADrawAbleNode> tree){
  updateSizeInfo();
  if (tree == null)   return;
  setFCenterX(fViewSpaceXAbs / 2);
  setFCenterY(fViewSpaceYAbs / 2);
  ADrawAbleNode rootNode=tree.getRoot();
  float fNodeSize=0.2f;
  float layer=1.0f;
  float firstRadius=0.5f;
  float fNumberOfNodesInLayer=3.0f;
  for (float fCurrentNode=1; fCurrentNode <= fNumberOfNodesInLayer; fCurrentNode++) {
    float childRadius=firstRadius + 0.5f;
    float alpha=calculateCircle((firstRadius),fCurrentNode,fNumberOfNodesInLayer);
    float space=calculateChildSpace(childRadius,fNumberOfNodesInLayer);
    rootNode.drawAtPostion(gl,getFXCoord(),getFYCoord(),0,fNodeSize,0.2f,EDrawAbleNodeDetailLevel.Low);
    calculateRecursiveLayout(gl,rootNode,tree,firstRadius,alpha,layer,fCurrentNode,fNumberOfNodesInLayer,fNodeSize);
  }
  fNodeSize=fNodeSize * HyperbolicRenderStyle.LIN_TREE_Y_SCALING_PER_LAYER;
  Vec3f p1=new Vec3f(3.0f,3.0f,0);
  Vec3f p2=new Vec3f(1.1f,2.8f,0);
  Vec3f p3=new Vec3f(1.0f,1.0f,0);
  vec.add(p1);
  vec.add(p2);
  vec.add(p3);
  return;
}
Program: 58650
Project: 58650
Buggy source:
private float calculateChildAngle(float parentAngle,float space,float radius){
  float angle=parentAngle - space / radius;
  return angle;
}

Fixed version (ground truth):
private float calculateChildAngle(float parentAngle,float space,float radius,float currentStep){
  float angle=parentAngle + ((space / radius) * currentStep);
  return angle;
}
Program: 58654
Project: 58654
Buggy source:
@Override public void clearAllSelections(){
  fPosCut=0;
  iMaxDepth=Integer.MAX_VALUE;
  iAlClusterNodes.clear();
  buildNewGroupList();
  resetAllTreeSelections();
  bRedrawDendrogram=true;
  bEnableDepthCheck=false;
}

Fixed version (ground truth):
@Override public void clearAllSelections(){
  contentSelectionManager.clearSelections();
  storageSelectionManager.clearSelections();
}
Program: 58656
Project: 58656
Buggy source:
/** 
 * Handels keyboard events for controlling level 2
 * @param bArrowUp true for arrow up, false for arrow down
 */
public void handleArrowAndAltPressed(boolean bArrowUp){
  int iNrElementsToShift=(int)Math.floor(Math.sqrt(iSamplesLevel2));
  if (bArrowUp) {
    if (iFirstSampleLevel2 > iNrElementsToShift + 1) {
      iLastSampleLevel2-=iNrElementsToShift;
      iFirstSampleLevel2-=iNrElementsToShift;
      setEmbeddedHeatMapData();
      setDisplayListDirty();
    }
 else     if (iFirstSampleLevel2 > 0) {
      iLastSampleLevel2--;
      iFirstSampleLevel2--;
      setEmbeddedHeatMapData();
      setDisplayListDirty();
    }
  }
 else {
    if (iLastSampleLevel2 < iSamplesLevel2 - 1 - iNrElementsToShift) {
      iLastSampleLevel2+=iNrElementsToShift;
      iFirstSampleLevel2+=iNrElementsToShift;
      setEmbeddedHeatMapData();
      setDisplayListDirty();
    }
 else     if (iLastSampleLevel2 < iSamplesLevel2 - 1) {
      iLastSampleLevel2++;
      iFirstSampleLevel2++;
      setEmbeddedHeatMapData();
      setDisplayListDirty();
    }
  }
}

Fixed version (ground truth):
/** 
 * Handels keyboard events for controlling level 2
 * @param bArrowUp true for arrow up, false for arrow down
 */
public void handleArrowAndAltPressed(boolean bArrowUp){
  int iNrElementsToShift=(int)Math.floor(Math.sqrt(iSamplesLevel2));
  if (bArrowUp) {
    if (iFirstSampleLevel2 > iNrElementsToShift + 1) {
      iLastSampleLevel2-=iNrElementsToShift;
      iFirstSampleLevel2-=iNrElementsToShift;
      setDisplayListDirty();
    }
 else     if (iFirstSampleLevel2 > 0) {
      iLastSampleLevel2--;
      iFirstSampleLevel2--;
      setDisplayListDirty();
    }
  }
 else {
    if (iLastSampleLevel2 < iSamplesLevel2 - 1 - iNrElementsToShift) {
      iLastSampleLevel2+=iNrElementsToShift;
      iFirstSampleLevel2+=iNrElementsToShift;
      setDisplayListDirty();
    }
 else     if (iLastSampleLevel2 < iSamplesLevel2 - 1) {
      iLastSampleLevel2++;
      iFirstSampleLevel2++;
      setDisplayListDirty();
    }
  }
}
Program: 58657
Project: 58657
Buggy source:
@Override public void initData(){
  super.initData();
  initHierarchy();
  calculateTextures();
  initPosCursorLevel1();
  if (bSkipLevel2 == false) {
    initPosCursorLevel2();
  }
  glHeatMapView.setSet(set);
  glHeatMapView.setContentVAType(EVAType.CONTENT_EMBEDDED_HM);
  glHeatMapView.initData();
  glGeneDendrogramView.setSet(set);
  glGeneDendrogramView.setContentVAType(EVAType.CONTENT);
  glGeneDendrogramView.initData();
  glExperimentDendrogramView.setSet(set);
  glExperimentDendrogramView.setContentVAType(EVAType.STORAGE);
  glExperimentDendrogramView.initData();
  if (bSkipLevel2 == false)   bRedrawTextures=true;
}

Fixed version (ground truth):
@Override public void initData(){
  super.initData();
  initHierarchy();
  calculateTextures();
  initPosCursorLevel1();
  if (bSkipLevel2 == false) {
    initPosCursorLevel2();
  }
  glHeatMapView.setSet(set);
  glHeatMapView.setContentVAType(EVAType.CONTENT_EMBEDDED_HM);
  glHeatMapView.initData();
  glGeneDendrogramView.setSet(set);
  glGeneDendrogramView.setContentVAType(EVAType.CONTENT);
  glGeneDendrogramView.initData();
  glExperimentDendrogramView.setSet(set);
  glExperimentDendrogramView.setContentVAType(EVAType.CONTENT);
  glExperimentDendrogramView.initData();
  if (bSkipLevel2 == false)   bRedrawTextures=true;
}
Program: 58659
Project: 58659
Buggy source:
/** 
 * Determine selected element in stage 1 (overview bar)
 * @param gl
 */
private void handleTexturePickingLevel1(GL gl){
  int iNumberSample=iNumberOfElements;
  float fOffsety;
  float fHeightSample=viewFrustum.getHeight() / iNumberSample;
  float[] fArPickingCoords=new float[3];
  if (pickingPointLevel1 != null) {
    fArPickingCoords=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickingPointLevel1.x,pickingPointLevel1.y);
    fOffsety=viewFrustum.getHeight() - fArPickingCoords[1] + 0.4f;
    iPickedSampleLevel1=(int)Math.ceil(fOffsety / fHeightSample);
    pickingPointLevel1=null;
    if (iSamplesLevel2 % 2 == 0) {
      iFirstSampleLevel1=iPickedSampleLevel1 - (int)Math.floor(iSamplesLevel2 / 2) + 1;
      iLastSampleLevel1=iPickedSampleLevel1 + (int)Math.floor(iSamplesLevel2 / 2);
    }
 else {
      iFirstSampleLevel1=iPickedSampleLevel1 - (int)Math.ceil(iSamplesLevel2 / 2);
      iLastSampleLevel1=iPickedSampleLevel1 + (int)Math.floor(iSamplesLevel2 / 2);
    }
    if (iPickedSampleLevel1 < iSamplesLevel2 / 2) {
      iPickedSampleLevel1=(int)Math.floor(iSamplesLevel2 / 2);
      iFirstSampleLevel1=0;
      iLastSampleLevel1=iSamplesLevel2 - 1;
    }
 else     if (iPickedSampleLevel1 > iNumberSample - 1 - iSamplesLevel2 / 2) {
      iPickedSampleLevel1=(int)Math.ceil(iNumberSample - iSamplesLevel2 / 2);
      iLastSampleLevel1=iNumberSample - 1;
      iFirstSampleLevel1=iNumberSample - iSamplesLevel2;
    }
  }
  setDisplayListDirty();
  setEmbeddedHeatMapData();
}

Fixed version (ground truth):
/** 
 * Determine selected element in stage 1 (overview bar)
 * @param gl
 */
private void handleTexturePickingLevel1(GL gl){
  int iNumberSample=iNumberOfElements;
  float fOffsety;
  float fHeightSample=viewFrustum.getHeight() / iNumberSample;
  float[] fArPickingCoords=new float[3];
  if (pickingPointLevel1 != null) {
    fArPickingCoords=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickingPointLevel1.x,pickingPointLevel1.y);
    fOffsety=viewFrustum.getHeight() - fArPickingCoords[1] + 0.4f;
    iPickedSampleLevel1=(int)Math.ceil(fOffsety / fHeightSample);
    pickingPointLevel1=null;
    if (iSamplesLevel2 % 2 == 0) {
      iFirstSampleLevel1=iPickedSampleLevel1 - (int)Math.floor(iSamplesLevel2 / 2) + 1;
      iLastSampleLevel1=iPickedSampleLevel1 + (int)Math.floor(iSamplesLevel2 / 2);
    }
 else {
      iFirstSampleLevel1=iPickedSampleLevel1 - (int)Math.ceil(iSamplesLevel2 / 2);
      iLastSampleLevel1=iPickedSampleLevel1 + (int)Math.floor(iSamplesLevel2 / 2);
    }
    if (iPickedSampleLevel1 < iSamplesLevel2 / 2) {
      iPickedSampleLevel1=(int)Math.floor(iSamplesLevel2 / 2);
      iFirstSampleLevel1=0;
      iLastSampleLevel1=iSamplesLevel2 - 1;
    }
 else     if (iPickedSampleLevel1 > iNumberSample - 1 - iSamplesLevel2 / 2) {
      iPickedSampleLevel1=(int)Math.ceil(iNumberSample - iSamplesLevel2 / 2);
      iLastSampleLevel1=iNumberSample - 1;
      iFirstSampleLevel1=iNumberSample - iSamplesLevel2;
    }
  }
  setDisplayListDirty();
}
Program: 58660
Project: 58660
Buggy source:
/** 
 * Determine selected element in stage 2 (texture)
 * @param gl
 */
private void handleTexturePickingLevel2(GL gl){
  int iNumberSample=iSamplesLevel2;
  float fOffsety;
  float fHeightSample=viewFrustum.getHeight() / iNumberSample;
  float[] fArPickingCoords=new float[3];
  if (pickingPointLevel2 != null) {
    fArPickingCoords=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickingPointLevel2.x,pickingPointLevel2.y);
    fOffsety=viewFrustum.getHeight() - fArPickingCoords[1] + 0.4f;
    iPickedSampleLevel2=(int)Math.ceil(fOffsety / fHeightSample);
    pickingPointLevel2=null;
    if (iSamplesLevel2 % 2 == 0) {
      iFirstSampleLevel2=iPickedSampleLevel2 - (int)Math.floor(iSamplesPerHeatmap / 2) + 1;
      iLastSampleLevel2=iPickedSampleLevel2 + (int)Math.floor(iSamplesPerHeatmap / 2);
    }
 else {
      iFirstSampleLevel2=iPickedSampleLevel2 - (int)Math.ceil(iSamplesPerHeatmap / 2);
      iLastSampleLevel2=iPickedSampleLevel2 + (int)Math.floor(iSamplesPerHeatmap / 2) - 1;
    }
    if (iPickedSampleLevel2 < iSamplesPerHeatmap / 2) {
      iPickedSampleLevel2=(int)Math.floor(iSamplesPerHeatmap / 2);
      iFirstSampleLevel2=0;
      iLastSampleLevel2=iSamplesPerHeatmap - 1;
    }
 else     if (iPickedSampleLevel2 > iNumberSample - 1 - iSamplesPerHeatmap / 2) {
      iPickedSampleLevel2=(int)Math.ceil(iNumberSample - iSamplesPerHeatmap / 2);
      iLastSampleLevel2=iNumberSample - 1;
      iFirstSampleLevel2=iNumberSample - iSamplesPerHeatmap;
    }
  }
  setDisplayListDirty();
  setEmbeddedHeatMapData();
}

Fixed version (ground truth):
/** 
 * Determine selected element in stage 2 (texture)
 * @param gl
 */
private void handleTexturePickingLevel2(GL gl){
  int iNumberSample=iSamplesLevel2;
  float fOffsety;
  float fHeightSample=viewFrustum.getHeight() / iNumberSample;
  float[] fArPickingCoords=new float[3];
  if (pickingPointLevel2 != null) {
    fArPickingCoords=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,pickingPointLevel2.x,pickingPointLevel2.y);
    fOffsety=viewFrustum.getHeight() - fArPickingCoords[1] + 0.4f;
    iPickedSampleLevel2=(int)Math.ceil(fOffsety / fHeightSample);
    pickingPointLevel2=null;
    if (iSamplesLevel2 % 2 == 0) {
      iFirstSampleLevel2=iPickedSampleLevel2 - (int)Math.floor(iSamplesPerHeatmap / 2) + 1;
      iLastSampleLevel2=iPickedSampleLevel2 + (int)Math.floor(iSamplesPerHeatmap / 2);
    }
 else {
      iFirstSampleLevel2=iPickedSampleLevel2 - (int)Math.ceil(iSamplesPerHeatmap / 2);
      iLastSampleLevel2=iPickedSampleLevel2 + (int)Math.floor(iSamplesPerHeatmap / 2) - 1;
    }
    if (iPickedSampleLevel2 < iSamplesPerHeatmap / 2) {
      iPickedSampleLevel2=(int)Math.floor(iSamplesPerHeatmap / 2);
      iFirstSampleLevel2=0;
      iLastSampleLevel2=iSamplesPerHeatmap - 1;
    }
 else     if (iPickedSampleLevel2 > iNumberSample - 1 - iSamplesPerHeatmap / 2) {
      iPickedSampleLevel2=(int)Math.ceil(iNumberSample - iSamplesPerHeatmap / 2);
      iLastSampleLevel2=iNumberSample - 1;
      iFirstSampleLevel2=iNumberSample - iSamplesPerHeatmap;
    }
  }
  setDisplayListDirty();
}
Program: 58665
Project: 58665
Buggy source:
@Override public void clearAllSelections(){
  contentSelectionManager.clearSelections();
  storageSelectionManager.clearSelections();
  if (bSkipLevel1 == false)   initPosCursorLevel1();
  bRedrawTextures=true;
  setDisplayListDirty();
  setEmbeddedHeatMapData();
  glHeatMapView.setDisplayListDirty();
  glGeneDendrogramView.setDisplayListDirty();
  glExperimentDendrogramView.setDisplayListDirty();
  if (storageVA.getGroupList() != null) {
    IGroupList groupList=storageVA.getGroupList();
    for (    Group group : groupList)     group.setSelectionType(ESelectionType.NORMAL);
  }
  if (contentVA.getGroupList() != null) {
    IGroupList groupList=contentVA.getGroupList();
    for (    Group group : groupList)     group.setSelectionType(ESelectionType.NORMAL);
  }
}

Fixed version (ground truth):
@Override public void clearAllSelections(){
  contentSelectionManager.clearSelections();
  storageSelectionManager.clearSelections();
  if (bSkipLevel1 == false)   initPosCursorLevel1();
  bRedrawTextures=true;
  setDisplayListDirty();
  glHeatMapView.setDisplayListDirty();
  glGeneDendrogramView.setDisplayListDirty();
  glExperimentDendrogramView.setDisplayListDirty();
  if (storageVA.getGroupList() != null) {
    IGroupList groupList=storageVA.getGroupList();
    for (    Group group : groupList)     group.setSelectionType(ESelectionType.NORMAL);
  }
  if (contentVA.getGroupList() != null) {
    IGroupList groupList=contentVA.getGroupList();
    for (    Group group : groupList)     group.setSelectionType(ESelectionType.NORMAL);
  }
}
Program: 58668
Project: 58668
Buggy source:
/** 
 * Function calculates for each node (gene or entity) in the sub dendrogram recursive the corresponding position inside the view frustum
 * @param currentNode
 * @return position of node in sub dendrogram
 */
private Vec3f determinePosRecSubTree(ClusterNode currentNode){
  Vec3f pos=new Vec3f();
  int temp=0;
  if (currentNode.isPartOfSubTree() == true) {
    temp=currentNode.getDepth();
    iMaxDepthSubTree=Math.max(iMaxDepthSubTree,temp);
  }
  if (tree.hasChildren(currentNode)) {
    ArrayList<ClusterNode> alChilds=tree.getChildren(currentNode);
    int iNrChildsNode=alChilds.size();
    Vec3f[] positions=new Vec3f[iNrChildsNode];
    for (int i=0; i < iNrChildsNode; i++) {
      ClusterNode node=(ClusterNode)alChilds.get(i);
      positions[i]=determinePosRecSubTree(node);
    }
    float fXmin=Float.MAX_VALUE;
    float fYmax=Float.MIN_VALUE;
    float fYmin=Float.MAX_VALUE;
    for (    Vec3f vec : positions) {
      fXmin=Math.min(fXmin,vec.x());
      fYmax=Math.max(fYmax,vec.y());
      fYmin=Math.min(fYmin,vec.y());
    }
    pos.setX(fXmin - fLevelWidthSubTree);
    pos.setY(fYmin + (fYmax - fYmin) / 2);
    pos.setZ(0f);
  }
 else {
    if (currentNode.isPartOfSubTree()) {
      pos.setY(yPosInitSubTree);
      yPosInitSubTree-=fSampleHeightSubTree;
      pos.setX(xGlobalMaxSubTree - fLevelWidthSubTree);
      pos.setZ(0f);
    }
  }
  currentNode.setPosSubTree(pos);
  return pos;
}

Fixed version (ground truth):
/** 
 * Function calculates for each node (gene or entity) in the sub dendrogram recursive the corresponding position inside the view frustum
 * @param currentNode
 * @return position of node in sub dendrogram
 */
private Vec3f determinePosRecSubTree(ClusterNode currentNode){
  Vec3f pos=new Vec3f();
  if (tree.hasChildren(currentNode)) {
    ArrayList<ClusterNode> alChilds=tree.getChildren(currentNode);
    int iNrChildsNode=alChilds.size();
    Vec3f[] positions=new Vec3f[iNrChildsNode];
    for (int i=0; i < iNrChildsNode; i++) {
      ClusterNode node=(ClusterNode)alChilds.get(i);
      positions[i]=determinePosRecSubTree(node);
    }
    float fXmin=Float.MAX_VALUE;
    float fYmax=Float.MIN_VALUE;
    float fYmin=Float.MAX_VALUE;
    for (    Vec3f vec : positions) {
      fXmin=Math.min(fXmin,vec.x());
      fYmax=Math.max(fYmax,vec.y());
      fYmin=Math.min(fYmin,vec.y());
    }
    pos.setX(fXmin - fLevelWidthSubTree);
    pos.setY(fYmin + (fYmax - fYmin) / 2);
    pos.setZ(0f);
  }
 else {
    if (currentNode.isPartOfSubTree()) {
      pos.setY(yPosInitSubTree);
      yPosInitSubTree-=fSampleHeightSubTree;
      pos.setX(xGlobalMaxSubTree - fLevelWidthSubTree);
      pos.setZ(0f);
    }
  }
  currentNode.setPosSubTree(pos);
  return pos;
}
Program: 58669
Project: 58669
Buggy source:
/** 
 * Functions renders a sub part of the dendrogram determined by two indexes (first and last element).
 * @param gl
 * @param fromIndex index of the first element in sub dendrogram
 * @param toIndex index (+1) of the last element in sub dendrogram
 * @param iNrLeafs number of leaf nodes in sub dendrogram
 * @param fWidth width of area for sub dendrogram
 * @param fHeight height of area for sub dendrogram
 */
public void renderSubTreeFromIndexToIndex(GL gl,int fromIndex,int toIndex,int iNrLeafs,float fWidth,float fHeight){
  if (tree == null)   return;
  determineNodesToRender(currentRootNode,fromIndex,toIndex,false);
  removeWronglySelectedNodes(currentRootNode);
  iMaxDepthSubTree=0;
  yPosInitSubTree=fHeight;
  xGlobalMaxSubTree=fWidth;
  determinePosRecSubTree(currentRootNode);
  fLevelWidthSubTree=fWidth / (iMaxDepthSubTree + 1);
  fSampleHeightSubTree=fHeight / iNrLeafs;
  gl.glTranslatef(0,-fSampleHeightSubTree / 2,0);
  renderSubTreeRec(gl,currentRootNode);
  gl.glTranslatef(0,+fSampleHeightSubTree / 2,0);
}

Fixed version (ground truth):
/** 
 * Functions renders a sub part of the dendrogram determined by two indexes (first and last element).
 * @param gl
 * @param fromIndex index of the first element in sub dendrogram
 * @param toIndex index (+1) of the last element in sub dendrogram
 * @param iNrLeafs number of leaf nodes in sub dendrogram
 * @param fWidth width of area for sub dendrogram
 * @param fHeight height of area for sub dendrogram
 */
public void renderSubTreeFromIndexToIndex(GL gl,int fromIndex,int toIndex,int iNrLeafs,float fWidth,float fHeight){
  if (tree == null)   return;
  determineNodesToRender(currentRootNode,fromIndex,toIndex,false);
  removeWronglySelectedNodes(currentRootNode);
  iMaxDepthSubTree=0;
  yPosInitSubTree=fHeight;
  xGlobalMaxSubTree=fWidth;
  determineMaxDepthSubTree(currentRootNode);
  fLevelWidthSubTree=fWidth / (iMaxDepthSubTree + 1);
  fSampleHeightSubTree=fHeight / iNrLeafs;
  determinePosRecSubTree(currentRootNode);
  gl.glTranslatef(0,-fSampleHeightSubTree / 2,0);
  gl.glLineWidth(1f);
  renderSubTreeRec(gl,currentRootNode);
  gl.glTranslatef(0,+fSampleHeightSubTree / 2,0);
}
Program: 58672
Project: 58672
Buggy source:
/** 
 * This function calls a recursive function which is responsible for the calculation of the position inside the viewfrustum of the nodes in the dendrogram
 */
private void determinePositions(){
  if (bRenderGeneTree)   determinePosRecGenes(currentRootNode);
 else   determinePosRecExperiments(tree.getRoot());
}

Fixed version (ground truth):
/** 
 * This function calls a recursive function which is responsible for the calculation of the position inside the view frustum of the nodes in the dendrogram
 */
private void determinePositions(){
  if (bRenderGeneTree) {
    determinePosRecGenes(currentRootNode);
  }
 else   determinePosRecExperiments(tree.getRoot());
}
Program: 58673
Project: 58673
Buggy source:
@Override public void initRemote(final GL gl,final AGLEventListener glParentView,final GLMouseListener glMouseListener,final IGLCanvasRemoteRendering remoteRenderingGLCanvas,GLInfoAreaManager infoAreaManager){
  this.remoteRenderingGLView=remoteRenderingGLCanvas;
  this.glMouseListener=glMouseListener;
  iGLDisplayListIndexRemote=gl.glGenLists(1);
  iGLDisplayListToCall=iGLDisplayListIndexRemote;
  init(gl);
}

Fixed version (ground truth):
@Override public void initRemote(final GL gl,final AGLEventListener glParentView,final GLMouseListener glMouseListener,final IGLCanvasRemoteRendering remoteRenderingGLCanvas,GLInfoAreaManager infoAreaManager){
  this.remoteRenderingGLView=remoteRenderingGLCanvas;
  this.glMouseListener=glMouseListener;
  iGLDisplayListIndexRemote=gl.glGenLists(1);
  iGLDisplayListToCall=iGLDisplayListIndexRemote;
  iGLDisplayListCutOffValue=gl.glGenLists(1);
  init(gl);
}
Program: 58676
Project: 58676
Buggy source:
@Override public void display(GL gl){
  processEvents();
  if (bIsDraggingActive) {
    handleDragging(gl);
    if (glMouseListener.wasMouseReleased()) {
      bIsDraggingActive=false;
    }
  }
  gl.glCallList(iGLDisplayListToCall);
}

Fixed version (ground truth):
@Override public void display(GL gl){
  processEvents();
  if (bIsDraggingActive) {
    handleDragging(gl);
    if (glMouseListener.wasMouseReleased()) {
      bIsDraggingActive=false;
    }
  }
  gl.glCallList(iGLDisplayListToCall);
  gl.glCallList(iGLDisplayListCutOffValue);
}
Program: 58677
Project: 58677
Buggy source:
@Override public void initLocal(GL gl){
  iGLDisplayListIndexLocal=gl.glGenLists(1);
  iGLDisplayListToCall=iGLDisplayListIndexLocal;
  init(gl);
}

Fixed version (ground truth):
@Override public void initLocal(GL gl){
  iGLDisplayListIndexLocal=gl.glGenLists(1);
  iGLDisplayListToCall=iGLDisplayListIndexLocal;
  iGLDisplayListCutOffValue=gl.glGenLists(1);
  init(gl);
}
Program: 58678
Project: 58678
Buggy source:
/** 
 * Returns the connection ID of the element.
 * @return the connection ID
 */
public Collection<Integer> getConnectionIDs(){
  return connectionIDs;
}

Fixed version (ground truth):
/** 
 * Returns the connection ID of the element.
 * @return the connection ID
 */
public ArrayList<Integer> getConnectionIDs(){
  return connectionIDs;
}
Program: 58679
Project: 58679
Buggy source:
/** 
 * Returns the connection ID of the element.
 * @return the connection ID
 */
public ArrayList<Integer> getConnectionIDs(){
  return connectionIDs;
}

Fixed version (ground truth):
/** 
 * Returns the connection ID of the element.
 * @return the connection ID
 */
@XmlElementWrapper public ArrayList<Integer> getConnectionIDs(){
  return connectionIDs;
}
Program: 58681
Project: 58681
Buggy source:
/** 
 * Loads a   {@link VirtualArray} from the file system. the filename is created by the type of  {@link VirtualArray}.
 * @param unmarshaller JAXB-unmarshaller to convert the xml-file to a {@link VirtualArray}-instance
 * @param dir directory-name in the file system to load the {@link VirtualArray} from 
 * @param type type of VirtualArray in the {@link UseCase}
 * @return loaded {@link VirtualArray}
 * @throws JAXBException in case of a {@link JAXBException} while unmarshalling the xml file
 */
private VirtualArray loadVirtualArray(Unmarshaller unmarshaller,String dir,EVAType type) throws JAXBException {
  String fileName=dir + "String_Node_Str" + type.toString()+ "String_Node_Str";
  VirtualArray va=(VirtualArray)unmarshaller.unmarshal(new File(fileName));
  return va;
}

Fixed version (ground truth):
/** 
 * Loads a   {@link VirtualArray} from the file system. the filename is created by the type of{@link VirtualArray}.
 * @param unmarshaller JAXB-unmarshaller to convert the xml-file to a  {@link VirtualArray}-instance
 * @param dir directory-name in the file system to load the  {@link VirtualArray} from
 * @param type type of VirtualArray in the  {@link UseCase}
 * @return loaded {@link VirtualArray}
 * @throws JAXBException in case of a  {@link JAXBException} while unmarshalling the xml file
 */
private VirtualArray loadVirtualArray(Unmarshaller unmarshaller,String dir,EVAType type) throws JAXBException {
  String fileName=dir + "String_Node_Str" + type.toString()+ "String_Node_Str";
  VirtualArray va=(VirtualArray)unmarshaller.unmarshal(new File(fileName));
  return va;
}
Program: 58682
Project: 58682
Buggy source:
/** 
 * Saves the project to the directory for the recent project 
 */
public void saveRecentProject(){
  ZipUtils zipUtils=new ZipUtils();
  if (!GeneralManager.get().getUseCase().getLoadDataParameters().getFileName().startsWith(RECENT_PROJECT_DIR_NAME)) {
    zipUtils.deleteDirectory(RECENT_PROJECT_DIR_NAME);
  }
  saveToDirectory(RECENT_PROJECT_DIR_NAME);
}

Fixed version (ground truth):
/** 
 * Saves the project to the directory for the recent project
 */
public void saveRecentProject(){
  ZipUtils zipUtils=new ZipUtils();
  if (!GeneralManager.get().getUseCase().getLoadDataParameters().getFileName().startsWith(RECENT_PROJECT_DIR_NAME)) {
    zipUtils.deleteDirectory(RECENT_PROJECT_DIR_NAME);
  }
  saveToDirectory(RECENT_PROJECT_DIR_NAME);
}
Program: 58683
Project: 58683
Buggy source:
/** 
 * Saves the   {@link VirtualArray} of the given type. The filename is createdfrom the type.
 * @param dir directory to save the {@link VirtualArray} in.
 * @param useCase {@link IUseCase} to retrieve the {@link VirtualArray} from.
 * @param type type of the virtual array within the given {@link IUseCase}.
 */
private void saveVirtualArray(Marshaller marshaller,String dir,IUseCase useCase,EVAType type) throws JAXBException {
  String fileName=dir + "String_Node_Str" + type.toString()+ "String_Node_Str";
  VirtualArray va=(VirtualArray)useCase.getVA(type);
  marshaller.marshal(va,new File(fileName));
}

Fixed version (ground truth):
/** 
 * Saves the   {@link VirtualArray} of the given type. The filename is created from the type.
 * @param dir directory to save the  {@link VirtualArray} in.
 * @param useCase {@link IUseCase} to retrieve the {@link VirtualArray} from.
 * @param type type of the virtual array within the given  {@link IUseCase}.
 */
private void saveVirtualArray(Marshaller marshaller,String dir,IUseCase useCase,EVAType type) throws JAXBException {
  String fileName=dir + "String_Node_Str" + type.toString()+ "String_Node_Str";
  VirtualArray va=(VirtualArray)useCase.getVA(type);
  marshaller.marshal(va,new File(fileName));
}
Program: 58684
Project: 58684
Buggy source:
/** 
 * Creates a   {@link ViewList} of all views registered in the central {@link IViewManager}.
 * @return {@link ViewList} to storing the view's state. 
 */
private ViewList createStoreViewList(){
  ArrayList<ASerializedView> storeViews=new ArrayList<ASerializedView>();
  IViewManager viewManager=GeneralManager.get().getViewGLCanvasManager();
  Collection<AGLEventListener> glViews=viewManager.getAllGLEventListeners();
  for (  AGLEventListener glView : glViews) {
    if (!glView.isRenderedRemote()) {
      ASerializedView serView=glView.getSerializableRepresentation();
      if (!(serView instanceof SerializedDummyView)) {
        storeViews.add(serView);
      }
    }
  }
  Collection<IView> swtViews=viewManager.getAllItems();
  for (  IView swtView : swtViews) {
    ASerializedView serView=swtView.getSerializableRepresentation();
    if (!(serView instanceof SerializedDummyView)) {
      storeViews.add(serView);
    }
  }
  ViewList viewList=new ViewList();
  viewList.setViews(storeViews);
  return viewList;
}

Fixed version (ground truth):
/** 
 * Creates a   {@link ViewList} of all views registered in the central {@link IViewManager}.
 * @return {@link ViewList} to storing the view's state.
 */
private ViewList createStoreViewList(){
  ArrayList<ASerializedView> storeViews=new ArrayList<ASerializedView>();
  IViewManager viewManager=GeneralManager.get().getViewGLCanvasManager();
  Collection<AGLEventListener> glViews=viewManager.getAllGLEventListeners();
  for (  AGLEventListener glView : glViews) {
    if (!glView.isRenderedRemote()) {
      ASerializedView serView=glView.getSerializableRepresentation();
      if (!(serView instanceof SerializedDummyView)) {
        storeViews.add(serView);
      }
    }
  }
  Collection<IView> swtViews=viewManager.getAllItems();
  for (  IView swtView : swtViews) {
    ASerializedView serView=swtView.getSerializableRepresentation();
    if (!(serView instanceof SerializedDummyView)) {
      storeViews.add(serView);
    }
  }
  ViewList viewList=new ViewList();
  viewList.setViews(storeViews);
  return viewList;
}
Program: 58686
Project: 58686
Buggy source:
/** 
 * Saves the set-data contained in the useCase in the given file. The   {@link LoadDataParameters} of the useCase are set according to the created set-file  
 * @param useCase useCase to get the set-data from 
 */
public static void saveSetFile(LoadDataParameters parameters,byte[] data,File setFile){
  FileOutputStream os=null;
  try {
    os=new FileOutputStream(setFile);
    os.write(data);
  }
 catch (  FileNotFoundException ex) {
    throw new RuntimeException("String_Node_Str",ex);
  }
catch (  IOException ex) {
    throw new RuntimeException("String_Node_Str",ex);
  }
 finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      IOException ex) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Saves the set-data contained in the useCase in a new created temp-file. The   {@link LoadDataParameters} of the useCase are set according to the created set-file  
 * @param parameters set-load parameters to store the filename;
 * @param data set-data to save
 */
public static void saveSetFile(LoadDataParameters parameters,byte[] data){
  File homeDir=new File(IGeneralManager.CALEYDO_HOME_PATH);
  File setFile;
  try {
    setFile=File.createTempFile(DATA_FILE_PREFIX,"String_Node_Str",homeDir);
    parameters.setFileName(setFile.getCanonicalPath());
  }
 catch (  IOException ex) {
    throw new RuntimeException("String_Node_Str",ex);
  }
  saveFile(data,setFile);
}