nus-yam/ex-repair huggingface dataset:
Program: 66029
Project: 66029
Buggy source:
public void doPreview(){
  final Chart chart=getPreviewChartModel();
  if (chart instanceof ChartWithAxes) {
    ChartAdapter.beginIgnoreNotifications();
    checkDataTypeForChartWithAxes();
    ChartAdapter.endIgnoreNotifications();
  }
 else {
    ChartWizard.removeAllExceptions(ChartWizard.CheckSeriesBindingType_ID);
  }
  LivePreviewTask lpt=new LivePreviewTask(Messages.getString("String_Node_Str"),null);
  lpt.addTask(new LivePreviewTask(){
    public void run(){
      if (previewPainter != null) {
        setParameter(ChartLivePreviewThread.PARAM_CHART_MODEL,ChartUIUtil.prepareLivePreview(chart,getDataServiceProvider(),((ChartWizardContext)context).getActionEvaluator()));
      }
    }
  }
);
  lpt.addTask(new LivePreviewTask(){
    public void run(){
      if (previewCanvas != null && previewCanvas.getDisplay() != null && !previewCanvas.getDisplay().isDisposed()) {
        previewCanvas.getDisplay().syncExec(new Runnable(){
          public void run(){
            if (previewPainter != null) {
              Chart cm=(Chart)getParameter(ChartLivePreviewThread.PARAM_CHART_MODEL);
              previewPainter.renderModel(cm);
            }
          }
        }
);
      }
    }
  }
);
  ((ChartLivePreviewThread)((ChartWizardContext)context).getLivePreviewThread()).setParentShell(getPreviewCanvas().getShell());
  ((ChartLivePreviewThread)((ChartWizardContext)context).getLivePreviewThread()).add(lpt);
}

Fixed version (ground truth):
public void doPreview(){
  try {
    final Chart chart=getPreviewChartModel();
    if (chart instanceof ChartWithAxes) {
      ChartAdapter.beginIgnoreNotifications();
      checkDataTypeForChartWithAxes();
      ChartAdapter.endIgnoreNotifications();
    }
 else {
      ChartWizard.removeAllExceptions(ChartWizard.CheckSeriesBindingType_ID);
    }
    LivePreviewTask lpt=new LivePreviewTask(Messages.getString("String_Node_Str"),null);
    lpt.addTask(new LivePreviewTask(){
      public void run(){
        if (previewPainter != null) {
          setParameter(ChartLivePreviewThread.PARAM_CHART_MODEL,ChartUIUtil.prepareLivePreview(chart,getDataServiceProvider(),((ChartWizardContext)context).getActionEvaluator()));
        }
      }
    }
);
    lpt.addTask(new LivePreviewTask(){
      public void run(){
        if (previewCanvas != null && previewCanvas.getDisplay() != null && !previewCanvas.getDisplay().isDisposed()) {
          previewCanvas.getDisplay().syncExec(new Runnable(){
            public void run(){
              if (previewPainter != null) {
                Chart cm=(Chart)getParameter(ChartLivePreviewThread.PARAM_CHART_MODEL);
                previewPainter.renderModel(cm);
              }
            }
          }
);
        }
      }
    }
);
    ((ChartLivePreviewThread)((ChartWizardContext)context).getLivePreviewThread()).setParentShell(getPreviewCanvas().getShell());
    ((ChartLivePreviewThread)((ChartWizardContext)context).getLivePreviewThread()).add(lpt);
  }
 catch (  ChartException e) {
    WizardBase.showException(e.getMessage());
  }
}
Program: 66030
Project: 66030
Buggy source:
protected Chart getPreviewChartModel(){
  if (getContext() == null) {
    return null;
  }
  return getContext().getModel();
}

Fixed version (ground truth):
protected Chart getPreviewChartModel() throws ChartException {
  if (getContext() == null) {
    return null;
  }
  return getContext().getModel();
}
Program: 66031
Project: 66031
Buggy source:
public void handleEvent(Event event){
  if (event.widget.equals(txtTitle)) {
    seriesDefn.getDesignTimeSeries().setSeriesIdentifier(txtTitle.getText());
  }
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.widget.equals(txtTitle)) {
    String text=txtTitle.getText();
    if (text == null || text.trim().length() == 0) {
      seriesDefn.getDesignTimeSeries().setSeriesIdentifier(null);
    }
 else {
      seriesDefn.getDesignTimeSeries().setSeriesIdentifier(txtTitle.getText());
    }
  }
}
Program: 66032
Project: 66032
Buggy source:
public void placeComponents(Composite parent){
  Series series=seriesDefn.getDesignTimeSeries();
  linkSeries=new Link(parent,SWT.NONE);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    linkSeries.setLayoutData(gd);
    linkSeries.setText("String_Node_Str" + seriesName + "String_Node_Str");
    linkSeries.addSelectionListener(this);
  }
  List<String> keys=null;
  if (getContext().getUIServiceProvider() != null) {
    keys=getContext().getUIServiceProvider().getRegisteredKeys();
  }
  txtTitle=new ExternalizedTextEditorComposite(parent,SWT.BORDER | SWT.SINGLE,-1,-1,keys,getContext().getUIServiceProvider(),series.getSeriesIdentifier().toString());
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    txtTitle.setLayoutData(gd);
    txtTitle.addListener(this);
  }
  cmbTypes=new Combo(parent,SWT.DROP_DOWN | SWT.READ_ONLY);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmbTypes.setLayoutData(gd);
    cmbTypes.addSelectionListener(this);
    if (iSeriesDefinitionIndex == 0) {
      cmbTypes.setEnabled(false);
    }
  }
  if (!series.getClass().isAssignableFrom(SeriesImpl.class)) {
    initZOrderUI(parent);
    initVisibleUI(parent,series);
    initStackUI(parent,series);
    initTranslucentUI(parent,series);
    setTypeComboState();
    setStackedBoxState();
  }
 else {
    Label dummy=new Label(parent,SWT.CHECK);
    GridData gd=new GridData();
    gd.horizontalSpan=4;
    dummy.setLayoutData(gd);
  }
  populateLists(seriesDefn.getDesignTimeSeries());
}

Fixed version (ground truth):
public void placeComponents(Composite parent){
  Series series=seriesDefn.getDesignTimeSeries();
  linkSeries=new Link(parent,SWT.NONE);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    linkSeries.setLayoutData(gd);
    linkSeries.setText("String_Node_Str" + seriesName + "String_Node_Str");
    linkSeries.addSelectionListener(this);
  }
  List<String> keys=null;
  if (getContext().getUIServiceProvider() != null) {
    keys=getContext().getUIServiceProvider().getRegisteredKeys();
  }
  txtTitle=new ExternalizedTextEditorComposite(parent,SWT.BORDER | SWT.SINGLE,-1,-1,keys,getContext().getUIServiceProvider(),getSeriesIdentifierText(series));
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    txtTitle.setLayoutData(gd);
    txtTitle.addListener(this);
  }
  cmbTypes=new Combo(parent,SWT.DROP_DOWN | SWT.READ_ONLY);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmbTypes.setLayoutData(gd);
    cmbTypes.addSelectionListener(this);
    if (iSeriesDefinitionIndex == 0) {
      cmbTypes.setEnabled(false);
    }
  }
  if (!series.getClass().isAssignableFrom(SeriesImpl.class)) {
    initZOrderUI(parent);
    initVisibleUI(parent,series);
    initStackUI(parent,series);
    initTranslucentUI(parent,series);
    setTypeComboState();
    setStackedBoxState();
  }
 else {
    Label dummy=new Label(parent,SWT.CHECK);
    GridData gd=new GridData();
    gd.horizontalSpan=4;
    dummy.setLayoutData(gd);
  }
  populateLists(seriesDefn.getDesignTimeSeries());
}
Program: 66033
Project: 66033
Buggy source:
private static boolean needSeriesName(String name,String seriesText){
  String pattern=MessageFormat.format(seriesText,new Object[]{"String_Node_Str"});
  return name.trim().matches(pattern) || name.trim().length() == 0;
}

Fixed version (ground truth):
private static boolean needSeriesName(String name,String seriesText){
  if (name == null) {
    return false;
  }
  String pattern=MessageFormat.format(seriesText,new Object[]{"String_Node_Str"});
  return name.trim().matches(pattern) || name.trim().length() == 0;
}
Program: 66034
Project: 66034
Buggy source:
/** 
 * Returns all chart type instances.
 * @return
 */
public static Iterator<IChartType> getChartTypeInstancesIterator(){
  return htTypes.values().iterator();
}

Fixed version (ground truth):
/** 
 * Returns all chart type instances.
 * @return chart type iterator.
 */
public static Iterator<IChartType> getChartTypeInstancesIterator(){
  return htTypes.values().iterator();
}
Program: 66035
Project: 66035
Buggy source:
/** 
 * Add default name for series.
 * @param chart
 * @param series
 * @since 2.3
 */
public static void setSeriesName(Chart chart){
  List<SeriesDefinition> seriesDefinitions=getAllOrthogonalSeriesDefinitions(chart);
  String seriesText=Messages.getString("String_Node_Str");
  SeriesDefinition sd;
  for (int i=0; i < seriesDefinitions.size(); i++) {
    sd=seriesDefinitions.get(i);
    if (needSeriesName(sd.getDesignTimeSeries().getSeriesIdentifier().toString(),seriesText)) {
      sd.getDesignTimeSeries().setSeriesIdentifier(MessageFormat.format(seriesText,new Object[]{Integer.valueOf(i + 1)}));
    }
  }
}

Fixed version (ground truth):
/** 
 * Add default name for series.
 * @param chart
 * @param series
 * @since 2.3
 */
public static void setSeriesName(Chart chart){
  List<SeriesDefinition> seriesDefinitions=getAllOrthogonalSeriesDefinitions(chart);
  String seriesText=Messages.getString("String_Node_Str");
  SeriesDefinition sd;
  for (int i=0; i < seriesDefinitions.size(); i++) {
    sd=seriesDefinitions.get(i);
    if (needSeriesName(sd.getDesignTimeSeries().getSeriesIdentifier() == null ? null : sd.getDesignTimeSeries().getSeriesIdentifier().toString(),seriesText)) {
      sd.getDesignTimeSeries().setSeriesIdentifier(MessageFormat.format(seriesText,new Object[]{Integer.valueOf(i + 1)}));
    }
  }
}
Program: 66036
Project: 66036
Buggy source:
public void startPage(float pageWidth,float pageHeight,String orientation){
  this.orientation=orientation;
  this.pageHeight=pageHeight;
  out.println("String_Node_Str" + pageIndex + "String_Node_Str"+ pageIndex);
  boolean isLandscape=orientation != null && orientation.equalsIgnoreCase("String_Node_Str");
  if (autoPaperSizeSelection) {
    if (isLandscape) {
      setPaperSize("String_Node_Str",(int)pageHeight,(int)pageWidth);
    }
 else {
      setPaperSize("String_Node_Str",(int)pageWidth,(int)pageHeight);
    }
    setPaperTray(AUTO_PAPER_TRAY_STRING);
  }
  out.println("String_Node_Str" + (int)Math.round(pageWidth) + "String_Node_Str"+ (int)Math.round(pageHeight));
  out.println("String_Node_Str");
  if (fitToPaper && paperWidth != 0 && paperHeight != 0) {
    int height=isLandscape ? (int)pageWidth : (int)pageHeight;
    int width=isLandscape ? (int)pageHeight : (int)pageWidth;
    out.println(paperWidth + "String_Node_Str" + width+ "String_Node_Str"+ paperHeight+ "String_Node_Str"+ height+ "String_Node_Str");
  }
  if (isLandscape) {
    gSave();
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.print("String_Node_Str");
    out.println(pageHeight + "String_Node_Str");
  }
  setScale((int)pageHeight,scale);
  ++pageIndex;
}

Fixed version (ground truth):
public void startPage(float pageWidth,float pageHeight,String orientation){
  boolean isLandscape=isLandscape(orientation);
  boolean paperChanged=this.pageHeight == pageHeight && this.pageWidth == pageWidth && isLandscape == isLandscape(this.orientation);
  this.orientation=orientation;
  this.pageHeight=pageHeight;
  this.pageWidth=pageWidth;
  out.println("String_Node_Str" + pageIndex + "String_Node_Str"+ pageIndex);
  if (autoPaperSizeSelection && (!isDuplex || paperChanged)) {
    if (isLandscape) {
      setPaperSize("String_Node_Str",(int)pageHeight,(int)pageWidth);
    }
 else {
      setPaperSize("String_Node_Str",(int)pageWidth,(int)pageHeight);
    }
    setPaperTray(AUTO_PAPER_TRAY_STRING);
  }
  out.println("String_Node_Str" + (int)Math.round(pageWidth) + "String_Node_Str"+ (int)Math.round(pageHeight));
  out.println("String_Node_Str");
  if (fitToPaper && paperWidth != 0 && paperHeight != 0) {
    int height=isLandscape ? (int)pageWidth : (int)pageHeight;
    int width=isLandscape ? (int)pageHeight : (int)pageWidth;
    out.println(paperWidth + "String_Node_Str" + width+ "String_Node_Str"+ paperHeight+ "String_Node_Str"+ height+ "String_Node_Str");
  }
  if (isLandscape) {
    gSave();
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.print("String_Node_Str");
    out.println(pageHeight + "String_Node_Str");
  }
  setScale((int)pageHeight,scale);
  ++pageIndex;
}
Program: 66037
Project: 66037
Buggy source:
private void setDuplex(Object duplex){
  String duplexValue=null;
  boolean tumble=false;
  if (duplex instanceof String) {
    String value=(String)duplex;
    if ("String_Node_Str".equalsIgnoreCase(value)) {
      return;
    }
    if ("String_Node_Str".equalsIgnoreCase(value)) {
      duplexValue="String_Node_Str";
      tumble=false;
    }
 else     if ("String_Node_Str".equalsIgnoreCase(value)) {
      duplexValue="String_Node_Str";
      tumble=true;
    }
  }
 else   if (duplex instanceof Integer) {
    int value=(Integer)duplex;
    if (value == IPostscriptRenderOption.DUPLEX_SIMPLEX) {
      return;
    }
    if (value == IPostscriptRenderOption.DUPLEX_FLIP_ON_LONG_EDGE) {
      duplexValue="String_Node_Str";
      tumble=false;
    }
 else     if (value == IPostscriptRenderOption.DUPLEX_FLIP_ON_SHORT_EDGE) {
      duplexValue="String_Node_Str";
      tumble=true;
    }
  }
  out.println("String_Node_Str" + duplexValue);
  out.println("String_Node_Str" + tumble + "String_Node_Str");
  if (tumble) {
    out.println("String_Node_Str");
  }
  out.println("String_Node_Str");
}

Fixed version (ground truth):
private void setDuplex(Object duplex){
  String duplexValue=null;
  boolean tumble=false;
  if (duplex instanceof String) {
    String value=(String)duplex;
    if ("String_Node_Str".equalsIgnoreCase(value)) {
      return;
    }
    isDuplex=true;
    if ("String_Node_Str".equalsIgnoreCase(value)) {
      duplexValue="String_Node_Str";
      tumble=false;
    }
 else     if ("String_Node_Str".equalsIgnoreCase(value)) {
      duplexValue="String_Node_Str";
      tumble=true;
    }
  }
 else   if (duplex instanceof Integer) {
    int value=(Integer)duplex;
    if (value == IPostscriptRenderOption.DUPLEX_SIMPLEX) {
      return;
    }
    isDuplex=true;
    if (value == IPostscriptRenderOption.DUPLEX_FLIP_ON_LONG_EDGE) {
      duplexValue="String_Node_Str";
      tumble=false;
    }
 else     if (value == IPostscriptRenderOption.DUPLEX_FLIP_ON_SHORT_EDGE) {
      duplexValue="String_Node_Str";
      tumble=true;
    }
  }
  out.println("String_Node_Str" + duplexValue);
  out.println("String_Node_Str" + tumble + "String_Node_Str");
  if (tumble) {
    out.println("String_Node_Str");
  }
  out.println("String_Node_Str");
}
Program: 66041
Project: 66041
Buggy source:
public TimeMember getResult(TimeMember member){
  String[] levels=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar(TimeMemberUtil.getTimeZone(),TimeMemberUtil.getDefaultLocale());
  cal.clear();
  translateToCal(cal,levels,values);
  if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_YEAR))   cal.add(Calendar.YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_QUARTER))   cal.add(Calendar.MONTH,offset * 3);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_MONTH))   cal.add(Calendar.MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH))   cal.add(Calendar.WEEK_OF_MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR))   cal.add(Calendar.WEEK_OF_YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH))   cal.add(Calendar.DAY_OF_MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR))   cal.add(Calendar.DAY_OF_YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK))   cal.add(Calendar.DAY_OF_WEEK,offset);
  setReferenceDate(new ReferenceDate(cal.getTime()));
  int[] newValues=getValueFromCal(cal,levels);
  TimeMember newMember=new TimeMember(newValues,levels);
  return newMember;
}

Fixed version (ground truth):
public TimeMember getResult(TimeMember member){
  String[] levels=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar(TimeMemberUtil.getTimeZone(),TimeMemberUtil.getDefaultLocale());
  cal.clear();
  translateToCal(cal,levels,values);
  if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_YEAR))   cal.add(Calendar.YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_QUARTER))   cal.add(Calendar.MONTH,offset * 3);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_MONTH))   cal.add(Calendar.MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH))   cal.add(Calendar.WEEK_OF_MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR))   cal.add(Calendar.WEEK_OF_YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH))   cal.add(Calendar.DAY_OF_MONTH,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR))   cal.add(Calendar.DAY_OF_YEAR,offset);
 else   if (levelName.equals(TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK))   cal.add(Calendar.DAY_OF_WEEK,offset);
  int[] newValues=getValueFromCal(cal,levels);
  TimeMember newMember=new TimeMember(newValues,levels);
  return newMember;
}
Program: 66042
Project: 66042
Buggy source:
protected void initUIComponents(Group grpLine){
  liacStock=new LineAttributesComposite(grpLine,SWT.NONE,context,series.getLineAttributes(),true,true,false,true,true);
  GridData gdLIACStock=new GridData(GridData.FILL_HORIZONTAL);
  gdLIACStock.verticalSpan=3;
  liacStock.setLayoutData(gdLIACStock);
  liacStock.addListener(this);
  if (series.isShowAsBarStick()) {
    new Label(grpLine,SWT.NONE).setText(Messages.getString("String_Node_Str"));
    iscStick=new Spinner(grpLine,SWT.BORDER);
    iscStick.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    iscStick.setMinimum(0);
    iscStick.setMaximum(Integer.MAX_VALUE);
    iscStick.setSelection(series.getStickLength());
    iscStick.addSelectionListener(this);
    btnAuto=new Button(grpLine,SWT.CHECK);
    btnAuto.setText(ChartUIExtensionUtil.getAutoMessage());
    btnAuto.addSelectionListener(this);
    GridData gd=new GridData();
    btnAuto.setLayoutData(gd);
    btnAuto.setSelection(!series.isSetStickLength());
    iscStick.setEnabled(!btnAuto.getSelection());
  }
}

Fixed version (ground truth):
protected void initUIComponents(Group grpLine){
  liacStock=new LineAttributesComposite(grpLine,SWT.NONE,context,series.getLineAttributes(),true,true,false,true,true);
  GridData gdLIACStock=new GridData(GridData.FILL_HORIZONTAL);
  gdLIACStock.verticalSpan=3;
  liacStock.setLayoutData(gdLIACStock);
  liacStock.addListener(this);
  if (needStickLength()) {
    Composite comp=new Composite(grpLine,SWT.NONE);
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan=2;
    comp.setLayoutData(gd);
    GridLayout gl=new GridLayout();
    gl.numColumns=3;
    gl.marginBottom=0;
    gl.marginHeight=0;
    gl.marginLeft=0;
    gl.marginRight=0;
    gl.marginTop=0;
    gl.marginWidth=0;
    comp.setLayout(gl);
    new Label(comp,SWT.NONE).setText(Messages.getString("String_Node_Str"));
    iscStick=new Spinner(comp,SWT.BORDER);
    iscStick.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    iscStick.setMinimum(0);
    iscStick.setMaximum(Integer.MAX_VALUE);
    iscStick.setSelection(series.getStickLength());
    iscStick.addSelectionListener(this);
    btnAuto=new Button(comp,SWT.CHECK);
    btnAuto.setText(ChartUIExtensionUtil.getAutoMessage());
    btnAuto.addSelectionListener(this);
    gd=new GridData();
    btnAuto.setLayoutData(gd);
    btnAuto.setSelection(!series.isSetShowAsBarStick() || series.isShowAsBarStick());
    iscStick.setEnabled(!btnAuto.getSelection());
  }
}
Program: 66043
Project: 66043
Buggy source:
protected void placeComponents(){
  this.setLayout(new GridLayout());
  Group grpLine=new Group(this,SWT.NONE);
{
    grpLine.setText(Messages.getString("String_Node_Str"));
    GridLayout glLine=new GridLayout();
    glLine.numColumns=series.isShowAsBarStick() ? 4 : 1;
    grpLine.setLayout(glLine);
    grpLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
  initUIComponents(grpLine);
}

Fixed version (ground truth):
protected void placeComponents(){
  this.setLayout(new GridLayout());
  Group grpLine=new Group(this,SWT.NONE);
{
    grpLine.setText(Messages.getString("String_Node_Str"));
    GridLayout glLine=new GridLayout();
    glLine.numColumns=needStickLength() ? 4 : 1;
    grpLine.setLayout(glLine);
    grpLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
  initUIComponents(grpLine);
}
Program: 66045
Project: 66045
Buggy source:
protected void bindBinding(IBinding colBinding,ICubeQueryDefinition cubeQuery,CubeHandle cube) throws BirtException {
  if (colBinding == null) {
    return;
  }
  String bindingName=colBinding.getBindingName();
  String expr=registeredQueries.get(bindingName);
  if (!cubeQuery.getBindings().contains(colBinding)) {
    cubeQuery.addBinding(colBinding);
  }
  String measure=exprCodec.getMeasureName(expr);
  if (measure != null) {
    if (registeredMeasures.containsKey(bindingName)) {
      return;
    }
    IMeasureDefinition mDef=cubeQuery.createMeasure(measure);
    String aggFun=DataAdapterUtil.adaptModelAggregationType(cube.getMeasure(measure).getFunction());
    mDef.setAggrFunction(aggFun);
    registeredMeasures.put(bindingName,mDef);
  }
 else   if (exprCodec.isDimensionExpresion()) {
    registerDimensionLevel(cubeQuery,cube,bindingName);
  }
 else   if (exprCodec.isCubeBinding(true)) {
    bindExpression(expr,cubeQuery,cube);
    return;
  }
}

Fixed version (ground truth):
protected void bindBinding(IBinding colBinding,ICubeQueryDefinition cubeQuery,CubeHandle cube) throws BirtException {
  if (colBinding == null) {
    return;
  }
  String bindingName=colBinding.getBindingName();
  String expr=registeredQueries.get(bindingName);
  if (!cubeQuery.getBindings().contains(colBinding)) {
    cubeQuery.addBinding(colBinding);
  }
  String measure=exprCodec.getMeasureName(expr);
  if (measure != null) {
    if (registeredMeasures.containsKey(bindingName)) {
      return;
    }
    IMeasureDefinition mDef=null;
    MeasureHandle measureHandle=cube.getMeasure(measure);
    if (measureHandle != null && measureHandle.isCalculated()) {
      mDef=cubeQuery.createDerivedMeasure(measure,DataAdapterUtil.adaptModelDataType(measureHandle.getDataType()),modelAdapter.adaptExpression((Expression)measureHandle.getExpressionProperty(IMeasureModel.MEASURE_EXPRESSION_PROP).getValue(),ExpressionLocation.CUBE));
    }
 else {
      mDef=cubeQuery.createMeasure(measure);
    }
    registeredMeasures.put(bindingName,mDef);
    String aggFun=DataAdapterUtil.adaptModelAggregationType(cube.getMeasure(measure).getFunction());
    mDef.setAggrFunction(aggFun);
  }
 else   if (exprCodec.isDimensionExpresion()) {
    registerDimensionLevel(cubeQuery,cube,bindingName);
  }
 else   if (exprCodec.isCubeBinding(true)) {
    bindExpression(expr,cubeQuery,cube);
    return;
  }
}
Program: 66046
Project: 66046
Buggy source:
public void translateFrom(Series series,int iSeriesDefinitionIndex,Chart chart){
  super.translateFrom(series,iSeriesDefinitionIndex,chart);
  for (Iterator<Marker> itr=getMarkers().iterator(); itr.hasNext(); ) {
    Marker mk=itr.next();
    mk.setVisible(false);
  }
}

Fixed version (ground truth):
public void translateFrom(Series series,int iSeriesDefinitionIndex,Chart chart){
  super.translateFrom(series,iSeriesDefinitionIndex,chart);
  for (Iterator<Marker> itr=getMarkers().iterator(); itr.hasNext(); ) {
    Marker mk=itr.next();
    mk.unsetVisible();
  }
}
Program: 66050
Project: 66050
Buggy source:
/** 
 * Get valid marker refenerce.
 * @param marker parentthe parent object which contains markers.
 * @param attribute attribute name of marker.
 * @param index the index of marker object.
 * @generated
 */
private Marker getValidMarkerRef(EObject obj,String attribute,int index){
  try {
    String methodName="String_Node_Str" + attribute.substring(0,1).toUpperCase() + attribute.substring(1);
    Method m=obj.getClass().getMethod(methodName);
    List<Marker> mList=(List<Marker>)m.invoke(obj);
    if ((mList.size() - 1) >= index) {
      return mList.get(index);
    }
 else     if (mList.size() == 1) {
      return mList.get(0);
    }
  }
 catch (  Exception e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get valid marker refenerce.
 * @param marker parentthe parent object which contains markers.
 * @param attribute attribute name of marker.
 * @param index the index of marker object.
 * @generated
 */
private Marker getValidMarkerRef(EObject obj,String attribute,int index){
  if (obj == null) {
    return null;
  }
  try {
    String methodName="String_Node_Str" + attribute.substring(0,1).toUpperCase() + attribute.substring(1);
    Method m=obj.getClass().getMethod(methodName);
    List<Marker> mList=(List<Marker>)m.invoke(obj);
    if ((mList.size() - 1) >= index) {
      return mList.get(index);
    }
 else     if (mList.size() == 1) {
      return mList.get(0);
    }
  }
 catch (  Exception e) {
  }
  return null;
}
Program: 66052
Project: 66052
Buggy source:
/** 
 * Check if the chart type supports axes.
 * @return
 */
boolean isChartWithAxes();

Fixed version (ground truth):
/** 
 * Check if the chart type supports axes.
 * @return true if chart has axis.
 */
boolean isChartWithAxes();
Program: 66053
Project: 66053
Buggy source:
/** 
 * Creates the corresponding series model with set 'isSet' flag for series properties.
 * @param needInitialing
 * @return
 */
public Series getSeries(boolean needInitialing);

Fixed version (ground truth):
/** 
 * Creates the corresponding series model with set 'isSet' flag for series properties.
 * @param needInitialing
 * @return series instance
 */
public Series getSeries(boolean needInitialing);
Program: 66056
Project: 66056
Buggy source:
private void dataFileSeek() throws IOException {
  int blockIndex=(int)(position / FileDocumentManager.BLOCK_SIZE);
  int posInBlock=(int)(position % FileDocumentManager.BLOCK_SIZE);
  int dataFilePosition=((Integer)blockList.get(blockIndex)).intValue() * FileDocumentManager.BLOCK_SIZE + posInBlock;
  dataFile.seek(dataFilePosition);
}

Fixed version (ground truth):
private void dataFileSeek() throws IOException {
  int blockIndex=(int)(position / FileDocumentManager.BLOCK_SIZE);
  int posInBlock=(int)(position % FileDocumentManager.BLOCK_SIZE);
  long dataFilePosition=(long)(((Integer)blockList.get(blockIndex)).intValue()) * FileDocumentManager.BLOCK_SIZE + posInBlock;
  dataFile.seek(dataFilePosition);
}
Program: 66057
Project: 66057
Buggy source:
private static SeriesDefinition createDefaultSeriesDefinition(int paletteShift){
  SeriesDefinition sd=SeriesDefinitionImpl.createDefault();
  sd.getSeries().add(SeriesImpl.createDefault());
  return sd;
}

Fixed version (ground truth):
protected static SeriesDefinition createDefaultSeriesDefinition(int paletteShift){
  SeriesDefinition sd=SeriesDefinitionImpl.createDefault();
  sd.getSeries().add(SeriesImpl.createDefault());
  return sd;
}
Program: 66058
Project: 66058
Buggy source:
@SuppressWarnings("String_Node_Str") protected void checkScriptSyntax(String string) throws RhinoException {
  if (string == null)   return;
  if (!isJavaClassName(string)) {
    try {
      Context cx=Context.enter();
      cx.compileString(string,"String_Node_Str",1,null);
    }
  finally {
      Context.exit();
    }
  }
}

Fixed version (ground truth):
protected void checkScriptSyntax(String string) throws RhinoException {
  if (string == null)   return;
  if (!isJavaClassName(string)) {
    try {
      Context cx=Context.enter();
      cx.compileString(string,"String_Node_Str",1,null);
    }
  finally {
      Context.exit();
    }
  }
}
Program: 66059
Project: 66059
Buggy source:
@SuppressWarnings("String_Node_Str") public IMethodInfo[] getMethods(String scriptName){
  if (scriptName != null && scriptName.equals(ChartReportItemUtil.PROPERTY_ONRENDER)) {
    ScriptClassInfo info=new ScriptClassInfo(IChartEventHandler.class);
    List<IMethodInfo> list=info.getMethods();
    Collections.sort(list,new Comparator<IMethodInfo>(){
      public int compare(      IMethodInfo arg0,      IMethodInfo arg1){
        String name0=arg0.getName();
        String name1=arg1.getName();
        if (name0.startsWith("String_Node_Str") && name1.startsWith("String_Node_Str")) {
          return -1;
        }
        if (name0.startsWith("String_Node_Str") && name1.startsWith("String_Node_Str")) {
          return 1;
        }
        return (name0.compareToIgnoreCase(name1));
      }
    }
);
    return list.toArray(new IMethodInfo[list.size()]);
  }
 else   return null;
}

Fixed version (ground truth):
public IMethodInfo[] getMethods(String scriptName){
  if (scriptName != null && scriptName.equals(ChartReportItemUtil.PROPERTY_ONRENDER)) {
    ScriptClassInfo info=new ScriptClassInfo(IChartEventHandler.class);
    List<IMethodInfo> list=info.getMethods();
    Collections.sort(list,new Comparator<IMethodInfo>(){
      public int compare(      IMethodInfo arg0,      IMethodInfo arg1){
        String name0=arg0.getName();
        String name1=arg1.getName();
        if (name0.startsWith("String_Node_Str") && name1.startsWith("String_Node_Str")) {
          return -1;
        }
        if (name0.startsWith("String_Node_Str") && name1.startsWith("String_Node_Str")) {
          return 1;
        }
        return (name0.compareToIgnoreCase(name1));
      }
    }
);
    return list.toArray(new IMethodInfo[list.size()]);
  }
 else   return null;
}
Program: 66060
Project: 66060
Buggy source:
public void testMTD4() throws IOException {
  int[] values=new int[]{2002,1,2,4};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=new MonthToDateFunction().getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testMTD4() throws IOException {
  int[] values=new int[]{2002,1,2,4};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  MonthToDateFunction monthToDate=new MonthToDateFunction();
  ReferenceDate referenceDate=new ReferenceDate(new Date(2002,1,27));
  monthToDate.setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=monthToDate.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66061
Project: 66061
Buggy source:
public void testMTD3() throws IOException {
  int[] values=new int[]{2011,3,9,4};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=new MonthToDateFunction().getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testMTD3() throws IOException {
  int[] values=new int[]{2011,3,9,4};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  MonthToDateFunction monthToDate=new MonthToDateFunction();
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,28));
  monthToDate.setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=monthToDate.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66062
Project: 66062
Buggy source:
public void testMTD6() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=new MonthToDateFunction().getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testMTD6() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  MonthToDateFunction monthToDate=new MonthToDateFunction();
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,22));
  monthToDate.setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=monthToDate.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66063
Project: 66063
Buggy source:
public void testMTD9() throws IOException {
  int[] values=new int[]{2011,4,10,2};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  MonthToDateFunction func=new MonthToDateFunction();
  func.setIsCurrent(true);
  List<TimeMember> timeMembers=func.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testMTD9() throws IOException {
  int[] values=new int[]{2011,4,10,2};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember timeMember=new TimeMember(values,types);
  MonthToDateFunction func=new MonthToDateFunction();
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,9,12));
  func.setReferenceDate(referenceDate);
  func.setIsCurrent(true);
  List<TimeMember> timeMembers=func.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66064
Project: 66064
Buggy source:
public void testFunctions9() throws IOException {
  int[] values=new int[]{2002,23};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR};
  TimeMember member=new TimeMember(values,levels);
  TimeMember resultMember=TimeFunctionFactory.createParallelPeriodFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,-10).getResult(member);
  int[] result=new int[]{2002,13};
  assertEquals(resultMember.getMemberValue()[0],result[0]);
  assertEquals(resultMember.getMemberValue()[1],result[1]);
}

Fixed version (ground truth):
public void testFunctions9() throws IOException {
  int[] values=new int[]{2002,23};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR};
  TimeMember member=new TimeMember(values,levels);
  IParallelPeriod parallelPeriod=TimeFunctionFactory.createParallelPeriodFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,-10);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2002,5,5));
  ((AbstractMDX)parallelPeriod).setReferenceDate(referenceDate);
  TimeMember resultMember=parallelPeriod.getResult(member);
  int[] result=new int[]{2002,13};
  assertEquals(resultMember.getMemberValue()[0],result[0]);
  assertEquals(resultMember.getMemberValue()[1],result[1]);
}
Program: 66065
Project: 66065
Buggy source:
public void testFunctions7() throws IOException {
  int[] values=new int[]{2002,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  TimeMember resultMember=TimeFunctionFactory.createParallelPeriodFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,-5).getResult(member);
  int[] result=new int[]{2002,7,3};
  assertEquals(resultMember.getMemberValue()[0],result[0]);
  assertEquals(resultMember.getMemberValue()[1],result[1]);
  assertEquals(resultMember.getMemberValue()[2],result[2]);
}

Fixed version (ground truth):
public void testFunctions7() throws IOException {
  int[] values=new int[]{2002,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  IParallelPeriod parallelPeriod=TimeFunctionFactory.createParallelPeriodFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,-5);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2002,7,20));
  ((AbstractMDX)parallelPeriod).setReferenceDate(referenceDate);
  TimeMember resultMember=parallelPeriod.getResult(member);
  int[] result=new int[]{2002,7,3};
  assertEquals(resultMember.getMemberValue()[0],result[0]);
  assertEquals(resultMember.getMemberValue()[1],result[1]);
  assertEquals(resultMember.getMemberValue()[2],result[2]);
}
Program: 66066
Project: 66066
Buggy source:
public void testFunctions4() throws IOException {
  int[] values=new int[]{2002,3,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  List<TimeMember> resultMember=TimeFunctionFactory.createPeriodsToDateFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,false).getResult(member);
  printResult(resultMember);
  this.checkOutputFile();
}

Fixed version (ground truth):
public void testFunctions4() throws IOException {
  int[] values=new int[]{2002,3,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2002,7,20));
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createPeriodsToDateFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,false);
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> resultMember=periodsFunction.getResult(member);
  printResult(resultMember);
  this.checkOutputFile();
}
Program: 66067
Project: 66067
Buggy source:
public void testFunctions5() throws IOException {
  int[] values=new int[]{2002,3,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  List<TimeMember> resultMember=TimeFunctionFactory.createPeriodsToDateFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,true).getResult(member);
  printResult(resultMember);
  this.checkOutputFile();
}

Fixed version (ground truth):
public void testFunctions5() throws IOException {
  int[] values=new int[]{2002,3,8,3};
  String[] levels=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH};
  TimeMember member=new TimeMember(values,levels);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2002,7,20));
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createPeriodsToDateFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,true);
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> resultMember=periodsFunction.getResult(member);
  printResult(resultMember);
  this.checkOutputFile();
}
Program: 66068
Project: 66068
Buggy source:
public void testTrailing13() throws IOException {
  int[] values=new int[]{2011,3,9,4,39};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_MONTH,-3).getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testTrailing13() throws IOException {
  int[] values=new int[]{2011,3,9,4,39};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_MONTH,-3);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,28));
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=periodsFunction.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66069
Project: 66069
Buggy source:
public void testTrailing5() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR,3).getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testTrailing5() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR,3);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,22));
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=periodsFunction.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66070
Project: 66070
Buggy source:
public void testTrailing4() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,3).getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testTrailing4() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,3);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,22));
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=periodsFunction.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66071
Project: 66071
Buggy source:
public void testTrailing3() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_MONTH,-3).getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testTrailing3() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_MONTH,-3);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,22));
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=periodsFunction.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}
Program: 66072
Project: 66072
Buggy source:
public void testTrailing2() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  List<TimeMember> timeMembers=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,-3).getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}

Fixed version (ground truth):
public void testTrailing2() throws IOException {
  int[] values=new int[]{2011,3,9,4,39,5,22,265};
  String[] types=new String[]{TimeMember.TIME_LEVEL_TYPE_YEAR,TimeMember.TIME_LEVEL_TYPE_QUARTER,TimeMember.TIME_LEVEL_TYPE_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR,TimeMember.TIME_LEVEL_TYPE_DAY_OF_WEEK,TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH,TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR};
  TimeMember timeMember=new TimeMember(values,types);
  IPeriodsFunction periodsFunction=TimeFunctionFactory.createTrailingFunction(TimeMember.TIME_LEVEL_TYPE_QUARTER,-3);
  ReferenceDate referenceDate=new ReferenceDate(new Date(2011,8,22));
  ((AbstractMDX)periodsFunction).setReferenceDate(referenceDate);
  List<TimeMember> timeMembers=periodsFunction.getResult(timeMember);
  printMembers(timeMembers);
  checkOutputFile();
}