nus-yam/ex-repair huggingface dataset:
Program: 92915
Project: 92915
Buggy source:
/** 
 * Return a shifted and scaled timestamp. Limitation: The scaling is limited to MAX_SCALING orders of magnitude. The main reason is that the 64 bits value starts to lose any significance meaning beyond that scale difference and it's not even worth the trouble to switch to BigDecimal arithmetics.
 * @param offset the shift value (in the same scale as newScale)
 * @param newScale the new timestamp scale
 * @return the synchronized timestamp in the new scale
 * @throws ArithmeticException
 */
public TmfTimestamp synchronize(long offset,byte newScale) throws ArithmeticException {
  int MAX_SCALING=19;
  long newValue=fValue;
  long newPrecision=fPrecision;
  if (fScale != newScale) {
    int scaleDiff=Math.abs(fScale - newScale);
    if (scaleDiff > MAX_SCALING) {
      throw new ArithmeticException("String_Node_Str");
    }
    long scalingFactor=1;
    for (int i=0; i < scaleDiff; i++) {
      scalingFactor*=10;
    }
    if (newScale < fScale) {
      newValue*=scalingFactor;
      newPrecision*=scalingFactor;
    }
 else {
      newValue/=scalingFactor;
      newPrecision/=scalingFactor;
    }
  }
  return new TmfTimestamp(newValue + offset,newScale,newPrecision);
}

Fixed version (ground truth):
/** 
 * Return a shifted and scaled timestamp. Limitation: The scaling is limited to MAX_SCALING orders of magnitude. The main reason is that the 64 bits value starts to lose any significance meaning beyond that scale difference and it's not even worth the trouble to switch to BigDecimal arithmetics.
 * @param offset the shift value (in the same scale as newScale)
 * @param newScale the new timestamp scale
 * @return the synchronized timestamp in the new scale
 * @throws ArithmeticException
 */
public TmfTimestamp synchronize(long offset,byte newScale) throws ArithmeticException {
  long newValue=fValue;
  long newPrecision=fPrecision;
  if (fScale != newScale) {
    int scaleDiff=Math.abs(fScale - newScale);
    if (scaleDiff > MAX_SCALING) {
      throw new ArithmeticException("String_Node_Str");
    }
    long scalingFactor=1;
    for (int i=0; i < scaleDiff; i++) {
      scalingFactor*=10;
    }
    if (newScale < fScale) {
      newValue*=scalingFactor;
      newPrecision*=scalingFactor;
    }
 else {
      newValue/=scalingFactor;
      newPrecision/=scalingFactor;
    }
  }
  return new TmfTimestamp(newValue + offset,newScale,newPrecision);
}
Program: 92916
Project: 92916
Buggy source:
/** 
 * Convert a String representing nanoseconds into a valid long.<p> This can handle number like "0.5", "0.123456789" as well as plain number like "12".<p> Note : This function ALWAYS return a number, if conversion failed, 0 will be returned.<p>
 * @param timeString	The string to convert
 * @return				The converted nanoseconds time as long
 */
public static long convertStringToNanoseconds(String timeString){
  long returnedNumber=0L;
  try {
    timeString=timeString.replace("String_Node_Str","String_Node_Str");
    int dotPosition=timeString.indexOf("String_Node_Str");
    if (dotPosition == 0) {
      timeString="String_Node_Str" + timeString;
      dotPosition=1;
    }
    if (dotPosition != -1) {
      int decimalNumber=(timeString.length() - dotPosition - 1);
      if (decimalNumber <= 9) {
        for (int nbDec=decimalNumber; nbDec < 9; nbDec++) {
          timeString+="String_Node_Str";
        }
      }
 else {
        timeString=timeString.substring(dotPosition,9);
      }
    }
    double dblMaxTimerange=Double.parseDouble(timeString);
    returnedNumber=(long)(dblMaxTimerange * 1000000000.0);
  }
 catch (  NumberFormatException e) {
    System.out.println("String_Node_Str");
  }
  return returnedNumber;
}

Fixed version (ground truth):
/** 
 * Convert a String representing nanoseconds into a valid long.<p> This can handle number like "0.5", "0.123456789" as well as plain number like "12".<p> Note : This function ALWAYS return a number, if conversion failed, 0 will be returned.<p>
 * @param timeString	The string to convert
 * @return				The converted nanoseconds time as long
 */
public static long convertStringToNanoseconds(String timeString){
  long returnedNumber=0L;
  try {
    timeString=timeString.replace("String_Node_Str","String_Node_Str");
    int dotPosition=timeString.indexOf("String_Node_Str");
    if (dotPosition == 0) {
      timeString="String_Node_Str" + timeString;
      dotPosition=1;
    }
    if (dotPosition != -1) {
      int decimalNumber=(timeString.length() - dotPosition - 1);
      if (decimalNumber <= 9) {
        StringBuffer strBuffer=new StringBuffer(timeString);
        for (int nbDec=decimalNumber; nbDec < 9; nbDec++) {
          strBuffer.append("String_Node_Str");
        }
        timeString=strBuffer.toString();
      }
 else {
        timeString=timeString.substring(dotPosition,9);
      }
    }
    double dblMaxTimerange=Double.parseDouble(timeString);
    returnedNumber=(long)(dblMaxTimerange * 1000000000.0);
  }
 catch (  NumberFormatException e) {
    System.out.println("String_Node_Str");
  }
  return returnedNumber;
}
Program: 92917
Project: 92917
Buggy source:
/** 
 * Recalculate the average number of events by time interval.<p> Note : This run over all the element so this is quite cpu intensive, use with care. 
 */
public void recalculateAverageNumberOfEvents(){
  int nbInterval=0;
  int totalNbEvents=0;
  for (int x=0; x < readyUpToPosition; x++) {
    if (HistogramConstant.SKIP_EMPTY_INTERVALS_WHEN_CALCULATING_AVERAGE) {
      if (elementTable[x].intervalNbEvents > 0) {
        nbInterval++;
      }
    }
 else {
      nbInterval++;
    }
    totalNbEvents+=elementTable[x].intervalNbEvents;
  }
  averageNumberOfEvents=(int)((double)totalNbEvents / (double)nbInterval);
}

Fixed version (ground truth):
/** 
 * Recalculate the average number of events by time interval.<p> Note : This run over all the element so this is quite cpu intensive, use with care. 
 */
public void recalculateAverageNumberOfEvents(){
  int nbInterval=0;
  int totalNbEvents=0;
  for (int x=0; x < readyUpToPosition; x++) {
    if (HistogramConstant.SKIP_EMPTY_INTERVALS_WHEN_CALCULATING_AVERAGE) {
      if (elementTable[x].intervalNbEvents > 0) {
        nbInterval++;
      }
    }
 else {
      nbInterval++;
    }
    totalNbEvents+=elementTable[x].intervalNbEvents;
  }
  averageNumberOfEvents=(int)Math.round((double)totalNbEvents / (double)nbInterval);
}
Program: 92918
Project: 92918
Buggy source:
/** 
 * Recalculate the height of each bar in a certain interval of the elements table.<p> Unlike recalculateEventHeight(), this only recalculate for the given range, not the whole table.
 */
public void recalculateEventHeightInInterval(int startPosition,int stopPosition){
  if (startPosition < 0) {
    startPosition=0;
  }
  if (stopPosition >= elementTable.length) {
    stopPosition=(elementTable.length - 1);
  }
  for (int x=startPosition; x < stopPosition; x++) {
    elementTable[x].intervalHeight=(int)(elementTable[x].intervalNbEvents * heightFactor);
  }
}

Fixed version (ground truth):
/** 
 * Recalculate the height of each bar in a certain interval of the elements table.<p> Unlike recalculateEventHeight(), this only recalculate for the given range, not the whole table.
 */
public void recalculateEventHeightInInterval(int startPosition,int stopPosition){
  if (startPosition < 0) {
    startPosition=0;
  }
  if (stopPosition >= elementTable.length) {
    stopPosition=(elementTable.length - 1);
  }
  for (int x=startPosition; x < stopPosition; x++) {
    elementTable[x].intervalHeight=(int)Math.ceil((double)elementTable[x].intervalNbEvents * heightFactor);
  }
}
Program: 92919
Project: 92919
Buggy source:
/** 
 * Calculate the correct time interval of each element from the given time.<p>
 * @return	The complete time interval
 */
public void recalculateElementsTimeInterval(long startTime,long endTime){
  long tmpInterval=((endTime - startTime) / getNbElement());
  if (tmpInterval <= 0) {
    tmpInterval=1L;
  }
  this.elementsTimeInterval=tmpInterval;
}

Fixed version (ground truth):
/** 
 * Calculate the correct time interval of each element from the given time.<p>
 * @return	The complete time interval
 */
public void recalculateElementsTimeInterval(long startTime,long endTime){
  long tmpInterval=(long)Math.ceil((double)(endTime - startTime) / (double)getNbElement());
  if (tmpInterval <= 0) {
    tmpInterval=1L;
  }
  this.elementsTimeInterval=tmpInterval;
}
Program: 92920
Project: 92920
Buggy source:
/** 
 * Return the closest element to a timestamp (long) given.<p> Note : startTime and intervalTime need to be set correctly here, otherwise unexpected element might be returned.<p> <p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.  
 * @param timestamp  The timestamp (in nanosecond, as long) of the element we are looking for (startTime < timestamp < endTime) 
 * @return	The <i>closest</i> element found.
 */
public HistogramElement getClosestElementFromTimestamp(long timestamp){
  int index=(int)((timestamp - startTime) / elementsTimeInterval);
  if (index < 0) {
    index=0;
  }
 else   if (index >= elementTable.length) {
    index=(elementTable.length - 1);
  }
  return elementTable[index];
}

Fixed version (ground truth):
/** 
 * Return the closest element to a timestamp (long) given.<p> Note : startTime and intervalTime need to be set correctly here, otherwise unexpected element might be returned.<p> <p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.  
 * @param timestamp  The timestamp (in nanosecond, as long) of the element we are looking for (startTime < timestamp < endTime) 
 * @return	The <i>closest</i> element found.
 */
public HistogramElement getClosestElementFromTimestamp(long timestamp){
  int index=(int)Math.round((double)(timestamp - startTime) / (double)elementsTimeInterval);
  if (index < 0) {
    index=0;
  }
 else   if (index >= elementTable.length) {
    index=(elementTable.length - 1);
  }
  return elementTable[index];
}
Program: 92921
Project: 92921
Buggy source:
/** 
 * Return the X position (relative to the canvas) of a certain element.<p> Note : canvasWindowSize need to be set correctly here, otherwise unexpected element might be returned.<p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.
 * @param targetElement		The element we are looking to find the position 
 * @return					The <i>closest</i> found element. 
 */
public int getXPositionFromElement(HistogramElement targetElement){
  return (int)(((double)targetElement.index / (double)elementTable.length) * (double)canvasWindowSize);
}

Fixed version (ground truth):
/** 
 * Return the X position (relative to the canvas) of a certain element.<p> Note : canvasWindowSize need to be set correctly here, otherwise unexpected element might be returned.<p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.
 * @param targetElement		The element we are looking to find the position 
 * @return					The <i>closest</i> found element. 
 */
public int getXPositionFromElement(HistogramElement targetElement){
  return (int)Math.round(((double)targetElement.index / (double)elementTable.length) * (double)canvasWindowSize);
}
Program: 92922
Project: 92922
Buggy source:
/** 
 * Return the closest element to a X position on the canvas.<p> Note : canvasWindowSize need to be set correctly here, otherwise unexpected element might be returned.<p> <p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.  
 * @param position  The X position we are looking at (0 < pos < canvasWidth) 
 * @return	The <i>closest</i> element found.
 */
public HistogramElement getClosestElementFromXPosition(int position){
  int index=(int)((double)elementTable.length * ((double)position / (double)canvasWindowSize));
  if (index < 0) {
    index=0;
  }
 else   if (index >= elementTable.length) {
    index=(elementTable.length - 1);
  }
  return elementTable[index];
}

Fixed version (ground truth):
/** 
 * Return the closest element to a X position on the canvas.<p> Note : canvasWindowSize need to be set correctly here, otherwise unexpected element might be returned.<p> <p> NOTE : This <b>ALWAYS</b> return an element;  If calculation lead outside the table, the first or the last element will be returned.  
 * @param position  The X position we are looking at (0 < pos < canvasWidth) 
 * @return	The <i>closest</i> element found.
 */
public HistogramElement getClosestElementFromXPosition(int position){
  int index=(int)Math.round((double)elementTable.length * ((double)position / (double)canvasWindowSize));
  if (index < 0) {
    index=0;
  }
 else   if (index >= elementTable.length) {
    index=(elementTable.length - 1);
  }
  return elementTable[index];
}
Program: 92923
Project: 92923
Buggy source:
/** 
 * Recalculate the height of each bar in the elements table.<p> This assume "heightFactor" is already set correctly.<p> NOTE : if "maxHeight", "heighestEventCount" or "averageNumberOfEvents" changes,  recalculateHeightFactor() should be recalled.
 */
public void recalculateEventHeight(){
  for (int x=0; x < readyUpToPosition; x++) {
    elementTable[x].intervalHeight=(int)(elementTable[x].intervalNbEvents * heightFactor);
  }
}

Fixed version (ground truth):
/** 
 * Recalculate the height of each bar in the elements table.<p> This assume "heightFactor" is already set correctly.<p> NOTE : if "maxHeight", "heighestEventCount" or "averageNumberOfEvents" changes,  recalculateHeightFactor() should be recalled.
 */
public void recalculateEventHeight(){
  for (int x=0; x < readyUpToPosition; x++) {
    elementTable[x].intervalHeight=(int)Math.ceil((double)elementTable[x].intervalNbEvents * heightFactor);
  }
}
Program: 92924
Project: 92924
Buggy source:
/** 
 * Getter for the left border of the window.<p> Compute the position from the HistogramContent data; may return 0 if the content data are wrong.  
 * @return The left position of the window, or 0 if it cannot compute it. 
 */
public int getWindowXPositionLeft(){
  int tmpLeftPosition=histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,-(windowTimeWidth / 2));
  if ((tmpLeftPosition == windowCenterPosition) && (tmpLeftPosition > 0)) {
    tmpLeftPosition=tmpLeftPosition - 1;
  }
  return tmpLeftPosition;
}

Fixed version (ground truth):
/** 
 * Getter for the left border of the window.<p> Compute the position from the HistogramContent data; may return 0 if the content data are wrong.  
 * @return The left position of the window, or 0 if it cannot compute it. 
 */
public int getWindowXPositionLeft(){
  if (windowTimeWidth < histogramContent.getElementsTimeInterval()) {
    return histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,-(histogramContent.getElementsTimeInterval()));
  }
 else {
    return histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,-(windowTimeWidth / 2));
  }
}
Program: 92925
Project: 92925
Buggy source:
/** 
 * Getter for the right border of the window.<p> Compute the position from the HistogramContent data; may return 0 if the content data are wrong.  
 * @return The right position of the window, or 0 if it cannot compute it. 
 */
public int getWindowXPositionRight(){
  int tmpRightPosition=histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,+(windowTimeWidth / 2));
  if ((tmpRightPosition == windowCenterPosition) && (tmpRightPosition < (histogramContent.getNbElement() - 1))) {
    tmpRightPosition=tmpRightPosition + 1;
  }
  return tmpRightPosition;
}

Fixed version (ground truth):
/** 
 * Getter for the right border of the window.<p> Compute the position from the HistogramContent data; may return 0 if the content data are wrong.  
 * @return The right position of the window, or 0 if it cannot compute it. 
 */
public int getWindowXPositionRight(){
  if (windowTimeWidth < histogramContent.getElementsTimeInterval()) {
    return histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,+(histogramContent.getElementsTimeInterval()));
  }
 else {
    return histogramContent.getXPositionByPositionAndTimeInterval(windowCenterPosition,+(windowTimeWidth / 2));
  }
}
Program: 92926
Project: 92926
Buggy source:
/** 
 * Perform a new request for the Selection window.<p> This assume the full experiment canvas has correct information about the selected window;  we need the fullExperimentCanvas' HistogramContent to be created and a selection window to be set.
 * @param experiment	The experiment we will select from
 */
public void performSelectedWindowEventsRequest(TmfExperiment<LttngEvent> experiment){
  HistogramSelectedWindow curSelectedWindow=fullExperimentCanvas.getCurrentWindow();
  if (curSelectedWindow == null) {
    fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
    curSelectedWindow=fullExperimentCanvas.getCurrentWindow();
  }
  LttngTimestamp ts1=new LttngTimestamp(curSelectedWindow.getTimestampLeft());
  LttngTimestamp ts2=new LttngTimestamp(curSelectedWindow.getTimestampRight());
  TmfTimeRange tmpRange=new TmfTimeRange(ts1,ts2);
  long intervalTime=((ts2.getValue() - ts1.getValue()) / selectedWindowCanvas.getHistogramContent().getNbElement());
  selectedWindowRequest=performRequest(experiment,selectedWindowCanvas,tmpRange,intervalTime);
  selectedWindowCanvas.redrawAsynchronously();
}

Fixed version (ground truth):
/** 
 * Perform a new request for the Selection window.<p> This assume the full experiment canvas has correct information about the selected window;  we need the fullExperimentCanvas' HistogramContent to be created and a selection window to be set.
 * @param experiment	The experiment we will select from
 */
public void performSelectedWindowEventsRequest(TmfExperiment<LttngEvent> experiment){
  HistogramSelectedWindow curSelectedWindow=fullExperimentCanvas.getCurrentWindow();
  if (curSelectedWindow == null) {
    fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
    curSelectedWindow=fullExperimentCanvas.getCurrentWindow();
  }
  LttngTimestamp ts1=new LttngTimestamp(curSelectedWindow.getTimestampOfLeftPosition());
  LttngTimestamp ts2=new LttngTimestamp(curSelectedWindow.getTimestampOfRightPosition());
  TmfTimeRange tmpRange=new TmfTimeRange(ts1,ts2);
  long intervalTime=((ts2.getValue() - ts1.getValue()) / selectedWindowCanvas.getHistogramContent().getNbElement());
  selectedWindowRequest=performRequest(experiment,selectedWindowCanvas,tmpRange,intervalTime);
  selectedWindowCanvas.redrawAsynchronously();
}
Program: 92927
Project: 92927
Buggy source:
/** 
 * Function used to tell that the timerange (window) changed.<p> This will most likely be called if the time window is resized. We send a signal to notify other views of the new timerange.
 */
public void sendTmfRangeSynchSignalBroadcast(){
  long centerTime=fullExperimentCanvas.getCurrentWindow().getTimestampCenter();
  long windowWidth=fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth();
  long startTime=centerTime - windowWidth;
  if (startTime < fullExperimentCanvas.getHistogramContent().getStartTime()) {
    startTime=fullExperimentCanvas.getHistogramContent().getStartTime();
  }
  LttngTimestamp tmpStartTime=new LttngTimestamp(startTime);
  long endTime=centerTime + windowWidth;
  if (endTime > fullExperimentCanvas.getHistogramContent().getEndTime()) {
    endTime=fullExperimentCanvas.getHistogramContent().getEndTime();
  }
  LttngTimestamp tmpEndTime=new LttngTimestamp(endTime);
  TmfTimeRange tmpTimeRange=new TmfTimeRange(tmpStartTime,tmpEndTime);
  LttngTimestamp tmpEventTime=new LttngTimestamp(currentEventTime);
  broadcast(new TmfRangeSynchSignal(this,tmpTimeRange,tmpEventTime));
}

Fixed version (ground truth):
/** 
 * Function used to tell that the timerange (window) changed.<p> This will most likely be called if the time window is resized. We send a signal to notify other views of the new timerange.
 */
public void sendTmfRangeSynchSignalBroadcast(){
  long centerTime=fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition();
  long windowWidth=fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth();
  long startTime=centerTime - windowWidth;
  if (startTime < fullExperimentCanvas.getHistogramContent().getStartTime()) {
    startTime=fullExperimentCanvas.getHistogramContent().getStartTime();
  }
  LttngTimestamp tmpStartTime=new LttngTimestamp(startTime);
  long endTime=centerTime + windowWidth;
  if (endTime > fullExperimentCanvas.getHistogramContent().getEndTime()) {
    endTime=fullExperimentCanvas.getHistogramContent().getEndTime();
  }
  LttngTimestamp tmpEndTime=new LttngTimestamp(endTime);
  TmfTimeRange tmpTimeRange=new TmfTimeRange(tmpStartTime,tmpEndTime);
  LttngTimestamp tmpEventTime=new LttngTimestamp(currentEventTime);
  broadcast(new TmfRangeSynchSignal(this,tmpTimeRange,tmpEventTime));
}
Program: 92928
Project: 92928
Buggy source:
/** 
 * Update the content of the controls related to the timestamp of the selection window<p> WARNING : Calls in there are not thread safe and can't be called from different thread than "main"
 */
public void updateSelectedWindowTimestamp(){
  String startTime=HistogramConstant.formatNanoSecondsTime(selectedWindowCanvas.getHistogramContent().getStartTime());
  String stopTime=HistogramConstant.formatNanoSecondsTime(selectedWindowCanvas.getHistogramContent().getEndTime());
  txtWindowStartTime.setText(startTime);
  txtWindowStopTime.setText(stopTime);
  ntgCurrentWindowTime.setValue(fullExperimentCanvas.getCurrentWindow().getTimestampCenter());
  ntgTimeRangeWindow.setValue(fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth());
  if (isGivenTimestampInSelectedWindow(ntgCurrentEventTime.getValue()) == false) {
    currentEventChangeNotification(fullExperimentCanvas.getCurrentWindow().getTimestampCenter());
  }
  txtWindowStartTime.getParent().layout();
  ntgCurrentWindowTime.getParent().layout();
}

Fixed version (ground truth):
/** 
 * Update the content of the controls related to the timestamp of the selection window<p> WARNING : Calls in there are not thread safe and can't be called from different thread than "main"
 */
public void updateSelectedWindowTimestamp(){
  String startTime=HistogramConstant.formatNanoSecondsTime(selectedWindowCanvas.getHistogramContent().getStartTime());
  String stopTime=HistogramConstant.formatNanoSecondsTime(selectedWindowCanvas.getHistogramContent().getEndTime());
  txtWindowStartTime.setText(startTime);
  txtWindowStopTime.setText(stopTime);
  ntgCurrentWindowTime.setValue(fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition());
  ntgTimeRangeWindow.setValue(fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth());
  if (isGivenTimestampInSelectedWindow(ntgCurrentEventTime.getValue()) == false) {
    currentEventChangeNotification(fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition());
  }
  txtWindowStartTime.getParent().layout();
  ntgCurrentWindowTime.getParent().layout();
}
Program: 92929
Project: 92929
Buggy source:
/** 
 * Check if a given timestamp is inside the selection window.<p> This assume fullExperimentCanvas contain a valid HistogramContent
 * @param timestamp	the timestamp to check
 * @return	if the time is inside the selection window or not
 */
public boolean isGivenTimestampInSelectedWindow(long timestamp){
  boolean returnedValue=true;
  if ((timestamp < fullExperimentCanvas.getCurrentWindow().getTimestampLeft()) || (timestamp > fullExperimentCanvas.getCurrentWindow().getTimestampRight())) {
    returnedValue=false;
  }
  return returnedValue;
}

Fixed version (ground truth):
/** 
 * Check if a given timestamp is inside the selection window.<p> This assume fullExperimentCanvas contain a valid HistogramContent
 * @param timestamp	the timestamp to check
 * @return	if the time is inside the selection window or not
 */
public boolean isGivenTimestampInSelectedWindow(long timestamp){
  boolean returnedValue=true;
  if ((timestamp < fullExperimentCanvas.getCurrentWindow().getTimestampOfLeftPosition()) || (timestamp > fullExperimentCanvas.getCurrentWindow().getTimestampOfRightPosition())) {
    returnedValue=false;
  }
  return returnedValue;
}
Program: 92930
Project: 92930
Buggy source:
private void createCanvasAndRequests(TmfExperiment<LttngEvent> newExperiment){
  lastUsedExperiment=newExperiment;
  TmfExperiment<LttngEvent> experimentCopy=newExperiment.createTraceCopy();
  fullExperimentCanvas.createNewHistogramContent(fullExperimentCanvas.getSize().x,FULL_TRACE_BAR_WIDTH,FULL_TRACE_CANVAS_HEIGHT,FULL_TRACE_DIFFERENCE_TO_AVERAGE);
  fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
  currentEventTime=newExperiment.getStartTime().getValue();
  fullExperimentCanvas.getCurrentWindow().setSelectedWindowVisible(true);
  fullExperimentCanvas.getHistogramContent().resetTable(newExperiment.getStartTime().getValue(),newExperiment.getEndTime().getValue());
  selectedWindowCanvas.createNewHistogramContent(selectedWindowCanvas.getSize().x,SELECTED_WINDOW_BAR_WIDTH,SELECTED_WINDOW_CANVAS_HEIGHT,SELECTED_WINDOW_DIFFERENCE_TO_AVERAGE);
  selectedWindowCanvas.getHistogramContent().resetTable(fullExperimentCanvas.getCurrentWindow().getTimestampLeft(),fullExperimentCanvas.getCurrentWindow().getTimestampRight());
  resetControlsContent();
  if (dataBackgroundFullRequest != null) {
    fullExperimentCanvas.redraw();
    selectedWindowCanvas.redraw();
  }
  dataBackgroundFullRequest=null;
  selectedWindowRequest=null;
  performSelectedWindowEventsRequest(newExperiment);
  performAllTraceEventsRequest(experimentCopy);
}

Fixed version (ground truth):
private void createCanvasAndRequests(TmfExperiment<LttngEvent> newExperiment){
  lastUsedExperiment=newExperiment;
  TmfExperiment<LttngEvent> experimentCopy=newExperiment.createTraceCopy();
  fullExperimentCanvas.createNewHistogramContent(fullExperimentCanvas.getSize().x,FULL_TRACE_BAR_WIDTH,FULL_TRACE_CANVAS_HEIGHT,FULL_TRACE_DIFFERENCE_TO_AVERAGE);
  fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
  currentEventTime=newExperiment.getStartTime().getValue();
  fullExperimentCanvas.getCurrentWindow().setSelectedWindowVisible(true);
  fullExperimentCanvas.getHistogramContent().resetTable(newExperiment.getStartTime().getValue(),newExperiment.getEndTime().getValue());
  selectedWindowCanvas.createNewHistogramContent(selectedWindowCanvas.getSize().x,SELECTED_WINDOW_BAR_WIDTH,SELECTED_WINDOW_CANVAS_HEIGHT,SELECTED_WINDOW_DIFFERENCE_TO_AVERAGE);
  selectedWindowCanvas.getHistogramContent().resetTable(fullExperimentCanvas.getCurrentWindow().getTimestampOfLeftPosition(),fullExperimentCanvas.getCurrentWindow().getTimestampOfRightPosition());
  resetControlsContent();
  if (dataBackgroundFullRequest != null) {
    fullExperimentCanvas.redraw();
    selectedWindowCanvas.redraw();
  }
  dataBackgroundFullRequest=null;
  selectedWindowRequest=null;
  performSelectedWindowEventsRequest(newExperiment);
  performAllTraceEventsRequest(experimentCopy);
}
Program: 92931
Project: 92931
Buggy source:
/** 
 * Function used to warn that the selection window changed.<p> This might be called because the window moved or because its size changed.<p> We will update the different control related to the selection window.
 */
public void windowChangedNotification(){
  if (lastUsedExperiment != null) {
    if (selectedWindowRequest.isCompleted() == false) {
      selectedWindowRequest.cancel();
    }
    selectedWindowTime=fullExperimentCanvas.getCurrentWindow().getTimestampCenter();
    selectedWindowTimerange=fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth();
    if (isGivenTimestampInSelectedWindow(currentEventTime) == false) {
      currentEventChangeNotification(fullExperimentCanvas.getCurrentWindow().getTimestampLeft());
    }
    performSelectedWindowEventsRequest(lastUsedExperiment);
  }
}

Fixed version (ground truth):
/** 
 * Function used to warn that the selection window changed.<p> This might be called because the window moved or because its size changed.<p> We will update the different control related to the selection window.
 */
public void windowChangedNotification(){
  if (lastUsedExperiment != null) {
    if (selectedWindowRequest.isCompleted() == false) {
      selectedWindowRequest.cancel();
    }
    selectedWindowTime=fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition();
    selectedWindowTimerange=fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth();
    if (isGivenTimestampInSelectedWindow(currentEventTime) == false) {
      currentEventChangeNotification(fullExperimentCanvas.getCurrentWindow().getTimestampOfLeftPosition());
    }
    performSelectedWindowEventsRequest(lastUsedExperiment);
  }
}
Program: 92932
Project: 92932
Buggy source:
protected void recalculateHeightIfCanvasSizeChanged(){
  HistogramContent tmpContent=parentCanvas.getHistogramContent();
  int exp=(int)Math.floor(Math.log((double)tmpContent.getCanvasWindowSize()) / Math.log(2.0));
  int contentSize=(int)Math.pow(2,exp);
  double maxBarsDiffFactor=((double)tmpContent.getNbElement() / (double)contentSize);
  if (maxBarsDiffFactor != tmpContent.getMaxDifferenceToAverageFactor()) {
    tmpContent.setMaxDifferenceToAverageFactor(maxBarsDiffFactor);
    tmpContent.recalculateHeightFactor();
    tmpContent.recalculateEventHeight();
  }
}

Fixed version (ground truth):
protected void recalculateHeightIfCanvasSizeChanged(){
  HistogramContent tmpContent=parentCanvas.getHistogramContent();
  int exp=(int)Math.floor(Math.log((double)tmpContent.getCanvasWindowSize()) / Math.log(2.0));
  int contentSize=(int)Math.pow(2,exp);
  double maxBarsDiffFactor=((double)tmpContent.getNbElement() / (double)contentSize);
  if (Math.abs(maxBarsDiffFactor - tmpContent.getMaxDifferenceToAverageFactor()) > 0.001) {
    tmpContent.setMaxDifferenceToAverageFactor(maxBarsDiffFactor);
    tmpContent.recalculateHeightFactor();
    tmpContent.recalculateEventHeight();
  }
}
Program: 92933
Project: 92933
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite(AllTmfCoreTests.class.getName());
  suite.addTestSuite(TmfCorePluginTest.class);
  suite.addTestSuite(TmfEventFieldTest.class);
  suite.addTestSuite(TmfEventContentTest.class);
  suite.addTestSuite(TmfEventTypeTest.class);
  suite.addTestSuite(TmfEventSourceTest.class);
  suite.addTestSuite(TmfTraceEventTest.class);
  suite.addTestSuite(TmfEventReferenceTest.class);
  suite.addTestSuite(TmfTimestampTest.class);
  suite.addTestSuite(TmfTimeRangeTest.class);
  suite.addTestSuite(TmfEventTest.class);
  suite.addTestSuite(TmfDataRequestTest.class);
  suite.addTestSuite(TmfEventRequestTest.class);
  suite.addTestSuite(TmfCoalescedDataRequestTest.class);
  suite.addTestSuite(TmfCoalescedEventRequestTest.class);
  suite.addTestSuite(TmfRequestExecutorTest.class);
  suite.addTestSuite(TmfEventProviderTest.class);
  suite.addTestSuite(TmfProviderManagerTest.class);
  suite.addTestSuite(TmfTraceTest.class);
  suite.addTestSuite(TmfExperimentTest.class);
  suite.addTestSuite(TmfMultiTraceExperimentTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite(AllTmfCoreTests.class.getName());
  suite.addTestSuite(TmfCorePluginTest.class);
  suite.addTest(org.eclipse.linuxtools.tmf.tests.event.AllTests.suite());
  suite.addTest(org.eclipse.linuxtools.tmf.tests.request.AllTests.suite());
  suite.addTest(org.eclipse.linuxtools.tmf.tests.component.AllTests.suite());
  suite.addTest(org.eclipse.linuxtools.tmf.tests.trace.AllTests.suite());
  suite.addTest(org.eclipse.linuxtools.tmf.tests.experiment.AllTests.suite());
  return suite;
}
Program: 92934
Project: 92934
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite(AllTests.class.getName());
  suite.addTestSuite(TmfEventProviderTest.class);
  suite.addTestSuite(TmfProviderManagerTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite(AllTests.class.getName());
  suite.addTestSuite(TmfProviderManagerTest.class);
  suite.addTestSuite(TmfEventProviderTest.class);
  return suite;
}
Program: 92935
Project: 92935
Buggy source:
@SuppressWarnings("String_Node_Str") public void testGetProviders(){
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class);
  assertTrue(eventProviders.length == 2);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfTraceStub.class);
  assertTrue(eventProviders.length == 1);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  assertTrue(eventProviders.length == 1);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfSyntheticEventStub.class);
  assertTrue(eventProviders.length == 1);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testGetProviders(){
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class);
  assertEquals("String_Node_Str",2,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfTraceStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfSyntheticEventStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
}
Program: 92936
Project: 92936
Buggy source:
@SuppressWarnings("String_Node_Str") public void testGetProviders2(){
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class);
  assertTrue(eventProviders.length == 2);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfTraceStub.class);
  assertTrue(eventProviders.length == 1);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  assertTrue(eventProviders.length == 1);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfSyntheticEventStub.class);
  assertTrue(eventProviders.length == 1);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testGetProviders2(){
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class);
  assertEquals("String_Node_Str",2,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfTraceStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
  eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfSyntheticEventStub.class);
  assertEquals("String_Node_Str",1,eventProviders.length);
}
Program: 92937
Project: 92937
Buggy source:
private void createCanvasAndRequests(TmfExperiment<LttngEvent> newExperiment){
  TmfExperiment<LttngEvent> experimentCopy=newExperiment.createTraceCopy();
  lastUsedExperiment=experimentCopy;
  fullExperimentCanvas.createNewHistogramContent(fullExperimentCanvas.getSize().x,FULL_TRACE_BAR_WIDTH,FULL_TRACE_CANVAS_HEIGHT,FULL_TRACE_DIFFERENCE_TO_AVERAGE);
  fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
  currentEventTime=newExperiment.getStartTime().getValue();
  fullExperimentCanvas.getCurrentWindow().setSelectedWindowVisible(true);
  fullExperimentCanvas.getHistogramContent().resetTable(newExperiment.getStartTime().getValue(),newExperiment.getEndTime().getValue());
  selectedWindowCanvas.createNewHistogramContent(selectedWindowCanvas.getSize().x,SELECTED_WINDOW_BAR_WIDTH,SELECTED_WINDOW_CANVAS_HEIGHT,SELECTED_WINDOW_DIFFERENCE_TO_AVERAGE);
  selectedWindowCanvas.getHistogramContent().resetTable(fullExperimentCanvas.getCurrentWindow().getTimestampLeft(),fullExperimentCanvas.getCurrentWindow().getTimestampRight());
  resetControlsContent();
  if (dataBackgroundFullRequest != null) {
    fullExperimentCanvas.redraw();
    selectedWindowCanvas.redraw();
  }
  dataBackgroundFullRequest=null;
  selectedWindowRequest=null;
  performSelectedWindowEventsRequest(newExperiment);
  performAllTraceEventsRequest(experimentCopy);
}

Fixed version (ground truth):
private void createCanvasAndRequests(TmfExperiment<LttngEvent> newExperiment){
  lastUsedExperiment=newExperiment;
  TmfExperiment<LttngEvent> experimentCopy=newExperiment.createTraceCopy();
  fullExperimentCanvas.createNewHistogramContent(fullExperimentCanvas.getSize().x,FULL_TRACE_BAR_WIDTH,FULL_TRACE_CANVAS_HEIGHT,FULL_TRACE_DIFFERENCE_TO_AVERAGE);
  fullExperimentCanvas.createNewSelectedWindow(DEFAULT_WINDOW_SIZE);
  currentEventTime=newExperiment.getStartTime().getValue();
  fullExperimentCanvas.getCurrentWindow().setSelectedWindowVisible(true);
  fullExperimentCanvas.getHistogramContent().resetTable(newExperiment.getStartTime().getValue(),newExperiment.getEndTime().getValue());
  selectedWindowCanvas.createNewHistogramContent(selectedWindowCanvas.getSize().x,SELECTED_WINDOW_BAR_WIDTH,SELECTED_WINDOW_CANVAS_HEIGHT,SELECTED_WINDOW_DIFFERENCE_TO_AVERAGE);
  selectedWindowCanvas.getHistogramContent().resetTable(fullExperimentCanvas.getCurrentWindow().getTimestampLeft(),fullExperimentCanvas.getCurrentWindow().getTimestampRight());
  resetControlsContent();
  if (dataBackgroundFullRequest != null) {
    fullExperimentCanvas.redraw();
    selectedWindowCanvas.redraw();
  }
  dataBackgroundFullRequest=null;
  selectedWindowRequest=null;
  performSelectedWindowEventsRequest(newExperiment);
  performAllTraceEventsRequest(experimentCopy);
}
Program: 92938
Project: 92938
Buggy source:
public void selectExperiment(LTTngExperimentNode experiment){
  String expId=experiment.getName();
  if (fSelectedExperiment != null)   fSelectedExperiment.deregister();
  try {
    LTTngTraceNode[] traceEntries=experiment.getTraces();
    int nbTraces=traceEntries.length;
    ITmfTrace[] traces=new ITmfTrace[nbTraces];
    for (int i=0; i < nbTraces; i++) {
      IResource res=traceEntries[i].getFolder();
      String location=res.getLocation().toOSString();
      ITmfTrace trace=new LTTngTrace(location,waitForCompletion);
      traces[i]=trace;
    }
    fSelectedExperiment=new TmfExperiment<LttngEvent>(LttngEvent.class,expId,traces);
    fSelectedExperiment.indexExperiment(waitForCompletion);
    broadcast(new TmfExperimentSelectedSignal<LttngEvent>(this,fSelectedExperiment));
  }
 catch (  FileNotFoundException e) {
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void selectExperiment(LTTngExperimentNode experiment){
  String expId=experiment.getName();
  if (fSelectedExperiment != null)   fSelectedExperiment.dispose();
  try {
    LTTngTraceNode[] traceEntries=experiment.getTraces();
    int nbTraces=traceEntries.length;
    ITmfTrace[] traces=new ITmfTrace[nbTraces];
    for (int i=0; i < nbTraces; i++) {
      IResource res=traceEntries[i].getFolder();
      String location=res.getLocation().toOSString();
      ITmfTrace trace=new LTTngTrace(location,waitForCompletion);
      traces[i]=trace;
    }
    fSelectedExperiment=new TmfExperiment<LttngEvent>(LttngEvent.class,expId,traces);
    fSelectedExperiment.indexExperiment(waitForCompletion);
    broadcast(new TmfExperimentSelectedSignal<LttngEvent>(this,fSelectedExperiment));
  }
 catch (  FileNotFoundException e) {
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 92939
Project: 92939
Buggy source:
/** 
 * Clea up resources
 */
public static void dispose(){
  if (experimentManager != null) {
    experimentManager.deregister();
    experimentManager=null;
    instanceBook=null;
  }
}

Fixed version (ground truth):
/** 
 * Clea up resources
 */
public static void dispose(){
  if (experimentManager != null) {
    experimentManager.dispose();
    experimentManager=null;
    instanceBook=null;
  }
}
Program: 92940
Project: 92940
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite(AllTmfCoreTests.class.getName());
  suite.addTestSuite(TmfCorePluginTest.class);
  suite.addTestSuite(TmfEventProviderTest.class);
  suite.addTestSuite(TmfProviderManagerTest.class);
  suite.addTestSuite(TmfEventFieldTest.class);
  suite.addTestSuite(TmfEventContentTest.class);
  suite.addTestSuite(TmfEventTypeTest.class);
  suite.addTestSuite(TmfEventSourceTest.class);
  suite.addTestSuite(TmfTraceEventTest.class);
  suite.addTestSuite(TmfEventReferenceTest.class);
  suite.addTestSuite(TmfTimestampTest.class);
  suite.addTestSuite(TmfTimeRangeTest.class);
  suite.addTestSuite(TmfEventTest.class);
  suite.addTestSuite(TmfDataRequestTest.class);
  suite.addTestSuite(TmfEventRequestTest.class);
  suite.addTestSuite(TmfCoalescedDataRequestTest.class);
  suite.addTestSuite(TmfCoalescedEventRequestTest.class);
  suite.addTestSuite(TmfTraceTest.class);
  suite.addTestSuite(TmfExperimentTest.class);
  suite.addTestSuite(TmfMultiTraceExperimentTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite(AllTmfCoreTests.class.getName());
  suite.addTestSuite(TmfCorePluginTest.class);
  suite.addTestSuite(TmfEventFieldTest.class);
  suite.addTestSuite(TmfEventContentTest.class);
  suite.addTestSuite(TmfEventTypeTest.class);
  suite.addTestSuite(TmfEventSourceTest.class);
  suite.addTestSuite(TmfTraceEventTest.class);
  suite.addTestSuite(TmfEventReferenceTest.class);
  suite.addTestSuite(TmfTimestampTest.class);
  suite.addTestSuite(TmfTimeRangeTest.class);
  suite.addTestSuite(TmfEventTest.class);
  suite.addTestSuite(TmfDataRequestTest.class);
  suite.addTestSuite(TmfEventRequestTest.class);
  suite.addTestSuite(TmfCoalescedDataRequestTest.class);
  suite.addTestSuite(TmfCoalescedEventRequestTest.class);
  suite.addTestSuite(TmfEventProviderTest.class);
  suite.addTestSuite(TmfProviderManagerTest.class);
  suite.addTestSuite(TmfTraceTest.class);
  suite.addTestSuite(TmfExperimentTest.class);
  suite.addTestSuite(TmfMultiTraceExperimentTest.class);
  return suite;
}
Program: 92941
Project: 92941
Buggy source:
@SuppressWarnings("String_Node_Str") public void testGetPlainEvents(){
  final int BLOCK_SIZE=100;
  final int NB_EVENTS=1000;
  final Vector<TmfEvent> requestedEvents=new Vector<TmfEvent>();
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  ITmfDataProvider<TmfEvent> provider=eventProviders[0];
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  final TmfEventRequest<TmfEvent> request=new TmfEventRequest<TmfEvent>(TmfEvent.class,range,NB_EVENTS,BLOCK_SIZE){
    @Override public void handleData(){
      TmfEvent[] events=getData();
      for (      TmfEvent e : events) {
        requestedEvents.add(e);
      }
    }
  }
;
  provider.sendRequest(request);
  request.waitForCompletion();
  assertEquals("String_Node_Str",NB_EVENTS,requestedEvents.size());
  assertTrue("String_Node_Str",request.isCompleted());
  assertFalse("String_Node_Str",request.isCancelled());
  for (int i=0; i < NB_EVENTS; i++) {
    assertEquals("String_Node_Str",i + 1,requestedEvents.get(i).getTimestamp().getValue());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testGetPlainEvents() throws InterruptedException {
  final int BLOCK_SIZE=100;
  final int NB_EVENTS=1000;
  final Vector<TmfEvent> requestedEvents=new Vector<TmfEvent>();
  ITmfDataProvider<TmfEvent>[] eventProviders=(ITmfDataProvider<TmfEvent>[])TmfProviderManager.getProviders(TmfEvent.class,TmfEventProviderStub.class);
  ITmfDataProvider<TmfEvent> provider=eventProviders[0];
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  final TmfEventRequest<TmfEvent> request=new TmfEventRequest<TmfEvent>(TmfEvent.class,range,NB_EVENTS,BLOCK_SIZE){
    @Override public void handleData(){
      TmfEvent[] events=getData();
      for (      TmfEvent e : events) {
        requestedEvents.add(e);
      }
    }
  }
;
  provider.sendRequest(request);
  request.waitForCompletion();
  assertEquals("String_Node_Str",NB_EVENTS,requestedEvents.size());
  assertTrue("String_Node_Str",request.isCompleted());
  assertFalse("String_Node_Str",request.isCancelled());
  for (int i=0; i < NB_EVENTS; i++) {
    assertEquals("String_Node_Str",i + 1,requestedEvents.get(i).getTimestamp().getValue());
  }
}
Program: 92942
Project: 92942
Buggy source:
public void testGetSyntheticEvents_LargerBlock(){
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  getSyntheticData(range,1000,TmfSyntheticEventProviderStub.BLOCK_SIZE * 2);
}

Fixed version (ground truth):
public void testGetSyntheticEvents_LargerBlock() throws InterruptedException {
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  getSyntheticData(range,1000,TmfSyntheticEventProviderStub.BLOCK_SIZE * 2);
}
Program: 92943
Project: 92943
Buggy source:
public void testGetSyntheticEvents_WeirdTimeRange2(){
  TmfTimestamp start=new TmfTimestamp(0,(byte)-3,0);
  TmfTimestamp end=TmfTimestamp.BigCrunch;
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}

Fixed version (ground truth):
public void testGetSyntheticEvents_WeirdTimeRange2() throws InterruptedException {
  TmfTimestamp start=new TmfTimestamp(0,(byte)-3,0);
  TmfTimestamp end=TmfTimestamp.BigCrunch;
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}
Program: 92944
Project: 92944
Buggy source:
public void testGetSyntheticEvents_TimeRange(){
  TmfTimestamp start=new TmfTimestamp(1,(byte)-3,0);
  TmfTimestamp end=new TmfTimestamp(1000,(byte)-3,0);
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}

Fixed version (ground truth):
public void testGetSyntheticEvents_TimeRange() throws InterruptedException {
  TmfTimestamp start=new TmfTimestamp(1,(byte)-3,0);
  TmfTimestamp end=new TmfTimestamp(1000,(byte)-3,0);
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}
Program: 92945
Project: 92945
Buggy source:
public void testGetSyntheticEvents_WeirdTimeRange1(){
  TmfTimestamp start=TmfTimestamp.BigBang;
  TmfTimestamp end=new TmfTimestamp(0,(byte)-3,0);
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}

Fixed version (ground truth):
public void testGetSyntheticEvents_WeirdTimeRange1() throws InterruptedException {
  TmfTimestamp start=TmfTimestamp.BigBang;
  TmfTimestamp end=new TmfTimestamp(0,(byte)-3,0);
  TmfTimeRange range=new TmfTimeRange(start,end);
  getSyntheticData(range,-1,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}
Program: 92946
Project: 92946
Buggy source:
public void testGetSyntheticEvents_EqualBlockSizes(){
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  getSyntheticData(range,1000,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}

Fixed version (ground truth):
public void testGetSyntheticEvents_EqualBlockSizes() throws InterruptedException {
  TmfTimeRange range=new TmfTimeRange(TmfTimestamp.BigBang,TmfTimestamp.BigCrunch);
  getSyntheticData(range,1000,TmfSyntheticEventProviderStub.BLOCK_SIZE);
}