nus-yam/ex-repair huggingface dataset:
Program: 87286
Project: 87286
Buggy source:
public void loadApplication(){
  window.setLoaded(false);
  loader=new Loader();
  updater=new Updater();
  loadExecutor.submit(loader);
  loadExecutor.scheduleAtFixedRate(updater,0,10,TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
public void loadApplication(){
  window.setLoaded(false);
  loader=new Loader();
  updater=new Updater();
  Future<?> future=loadExecutor.submit(loader);
  try {
    future.get();
  }
 catch (  ExecutionException e) {
    Throwable cause=e.getCause();
    cause.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  loadExecutor.scheduleAtFixedRate(updater,0,10,TimeUnit.MILLISECONDS);
}
Program: 87287
Project: 87287
Buggy source:
/** 
 * @param buffer
 */
public void igualaImagem(BufferedImage buffer){
  buffer=new BufferedImage((int)w,(int)h,BufferedImage.TYPE_INT_ARGB);
  buffer.getGraphics().drawImage(buffer,0,0,null);
  w=buffer.getWidth();
  h=buffer.getHeight();
  resetImage();
}

Fixed version (ground truth):
/** 
 * @param buffer
 */
public void igualaImagem(BufferedImage buffer){
  this.buffer=new BufferedImage((int)w,(int)h,BufferedImage.TYPE_INT_ARGB);
  this.buffer.getGraphics().drawImage(buffer,0,0,null);
  w=buffer.getWidth();
  h=buffer.getHeight();
  resetImage();
}
Program: 87288
Project: 87288
Buggy source:
public void update(long now){
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getViews());
  Context application=activeWindow.getApplication();
  components.add(application);
  application.update(getTimeNow());
  updateActiveWindow();
  updateGui(components);
  updateMouse(components);
  keyboard.update(now);
  JoystickLoader.getInstance().update(now);
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}

Fixed version (ground truth):
public void update(long now){
  if (!activeWindow.isLoaded()) {
    return;
  }
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getViews());
  Context application=activeWindow.getApplication();
  components.add(application);
  application.update(getTimeNow());
  updateActiveWindow();
  updateGui(components);
  updateMouse(components);
  keyboard.update(now);
  JoystickLoader.getInstance().update(now);
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}
Program: 87289
Project: 87289
Buggy source:
public FadeOutAnimation(Layer target,long time){
  super(target,time);
  startValue=0;
  endValue=255;
}

Fixed version (ground truth):
public FadeOutAnimation(Layer target,long time){
  super(target,time);
  startValue=255;
  endValue=0;
}
Program: 87290
Project: 87290
Buggy source:
private Method getMethod(Class<?> cls,String methodName,Class<?>[] classes){
  for (  Method method : cls.getMethods()) {
    if (method.getName().equals(methodName)) {
      if (method.getParameterTypes().length == classes.length) {
        for (int i=0; i < classes.length; i++) {
          Class<?> clazz=method.getParameterTypes()[i];
          if (clazz.isPrimitive()) {
            String name=classes[i].getSimpleName().toLowerCase();
            String parameterName=method.getParameterTypes()[i].getName();
            if (!name.startsWith(parameterName)) {
              return null;
            }
          }
 else {
            if (!classes[i].getName().equals(method.getParameterTypes()[i].getComponentType())) {
              return null;
            }
          }
        }
        return method;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private Method getMethod(Class<?> cls,String methodName,Class<?>[] classes){
  for (  Method method : cls.getMethods()) {
    if (method.getName().equals(methodName)) {
      if (method.getParameterTypes().length == classes.length) {
        for (int i=0; i < classes.length; i++) {
          Class<?> clazz=method.getParameterTypes()[i];
          if (clazz.isPrimitive()) {
            String name=classes[i].getSimpleName().toLowerCase();
            String parameterName=method.getParameterTypes()[i].getName();
            if (!name.startsWith(parameterName)) {
              return null;
            }
          }
 else {
            Class<?> typ=method.getParameterTypes()[i].getComponentType();
            if (typ != null) {
              if (!classes[i].getName().equals(typ.getName())) {
                return null;
              }
            }
          }
        }
        return method;
      }
    }
  }
  return null;
}
Program: 87291
Project: 87291
Buggy source:
public void gerencia(){
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getApplication().getViews());
  components.addAll(activeWindow.getViews());
  updateActiveWindow();
  updateGui(components);
  updateMouse(components);
  updateKeyboard();
  if (JoystickLoader.getInstance().isStarted()) {
    updateJoystick();
  }
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}

Fixed version (ground truth):
public void gerencia(){
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getViews());
  components.add(activeWindow.getApplication());
  updateActiveWindow();
  updateGui(components);
  updateMouse(components);
  updateKeyboard();
  if (JoystickLoader.getInstance().isStarted()) {
    updateJoystick();
  }
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}
Program: 87292
Project: 87292
Buggy source:
private void updateKeyboardEvents(KeyEvent event){
  if (event.isKeyDown(KeyEvent.TSK_ALT_DIREITA) || event.isKeyDown(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ALT_DIREITA) || event.isKeyUp(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ENTER)) {
    enter=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ENTER)) {
    enter=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ESC)) {
    esc=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ESC)) {
    esc=false;
  }
  if (alt && enter) {
    alt=false;
    enter=false;
    enableFullScreen=true;
  }
  if (esc) {
    esc=false;
    if (fullScreenEnable) {
      disableFullScreen=true;
    }
  }
}

Fixed version (ground truth):
private void updateKeyboardEvents(KeyEvent event){
  if (event.isKeyDown(KeyEvent.TSK_ALT_DIREITA) || event.isKeyDown(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ALT_DIREITA) || event.isKeyUp(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ENTER)) {
    enter=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ENTER)) {
    enter=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ESC)) {
    esc=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ESC)) {
    esc=false;
  }
  if (alt && enter) {
    alt=false;
    enter=false;
    if (!fullScreenEnable) {
      enableFullScreen=true;
    }
  }
  if (esc) {
    esc=false;
    if (fullScreenEnable) {
      disableFullScreen=true;
    }
  }
}
Program: 87293
Project: 87293
Buggy source:
public void disableFullScreen(){
  telaCheia.dispose();
  telaCheia=null;
  innerCore.fullScreenEnable=false;
}

Fixed version (ground truth):
public void disableFullScreen(){
  telaCheia.dispose();
  innerCore.fullScreenEnable=false;
}
Program: 87294
Project: 87294
Buggy source:
private VolatileImage createBackBuffer(int largura,int altura,int transparency){
  return configuration.createCompatibleVolatileImage(largura,altura,transparency);
}

Fixed version (ground truth):
private VolatileImage createBackBuffer(int width,int height,int transparency){
  return configuration.createCompatibleVolatileImage(width,height,transparency);
}
Program: 87295
Project: 87295
Buggy source:
public void draw(BufferedImage volatileImage){
  int y=offsetY;
  BufferedImage resized=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  Graphics2D g=resized.createGraphics();
  g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  g.drawImage(volatileImage,0,y,w,h,0,0,volatileImage.getWidth(),y + volatileImage.getHeight(),null);
  g.dispose();
  getGraphics().drawImage(resized,0,0,null);
}

Fixed version (ground truth):
public void draw(BufferedImage volatileImage){
  int y=offsetY;
  BufferedImage resized=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  Graphics2D g=resized.createGraphics();
  g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
  g.drawImage(volatileImage,0,y,w,h,0,0,volatileImage.getWidth(),y + volatileImage.getHeight(),null);
  g.dispose();
  getGraphics().drawImage(resized,0,0,null);
}
Program: 87296
Project: 87296
Buggy source:
public FullScreenWindow(EngineCore core){
  super(new Frame());
  Dimension ss=Toolkit.getDefaultToolkit().getScreenSize();
  this.core=core;
  setBounds(0,0,ss.width,ss.height);
  w=ss.width;
  h=ss.height;
  int wfactor=ss.width / 16;
  utilHeight=9 * wfactor;
  offsetY=(ss.height - utilHeight) / 2;
  hideCursor();
  setVisible(true);
  setAlwaysOnTop(true);
  setListeners();
}

Fixed version (ground truth):
public FullScreenWindow(EngineCore core){
  super(new Frame());
  Dimension ss=Toolkit.getDefaultToolkit().getScreenSize();
  this.core=core;
  setBounds(0,0,ss.width,ss.height);
  w=ss.width;
  h=ss.height;
  int wfactor=ss.width / 16;
  utilHeight=9 * wfactor;
  offsetY=(ss.height - utilHeight) / 2;
  core.hideCursor();
  setVisible(true);
  setAlwaysOnTop(true);
  setListeners();
}
Program: 87297
Project: 87297
Buggy source:
private void updateKeyboardEvents(KeyEvent event){
  if (event.isKeyDown(KeyEvent.TSK_ALT_DIREITA) || event.isKeyDown(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ALT_DIREITA) || event.isKeyUp(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ENTER)) {
    enter=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ENTER)) {
    enter=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ESC)) {
    esc=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ESC)) {
    esc=false;
  }
  if (alt && enter) {
    alt=false;
    enter=false;
    enableFullScreen=true;
  }
  if (esc) {
    esc=false;
    disableFullScreen=true;
  }
}

Fixed version (ground truth):
private void updateKeyboardEvents(KeyEvent event){
  if (event.isKeyDown(KeyEvent.TSK_ALT_DIREITA) || event.isKeyDown(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ALT_DIREITA) || event.isKeyUp(KeyEvent.TSK_ALT_ESQUERDA)) {
    alt=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ENTER)) {
    enter=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ENTER)) {
    enter=false;
  }
  if (event.isKeyDown(KeyEvent.TSK_ESC)) {
    esc=true;
  }
 else   if (event.isKeyUp(KeyEvent.TSK_ESC)) {
    esc=false;
  }
  if (alt && enter) {
    alt=false;
    enter=false;
    enableFullScreen=true;
  }
  if (esc) {
    esc=false;
    if (fullScreenEnable) {
      disableFullScreen=true;
    }
  }
}
Program: 87298
Project: 87298
Buggy source:
/** 
 * @param point
 * @param radius
 */
public void drawCircle(Ponto2D point,int radius){
  screen.drawOval((int)point.getX() - radius,(int)point.getY() - radius,radius * 2,radius * 2);
}

Fixed version (ground truth):
/** 
 * @param point
 * @param radius
 */
public void drawCircle(Point2D point,int radius){
  screen.drawOval((int)point.getX() - radius,(int)point.getY() - radius,radius * 2,radius * 2);
}
Program: 87299
Project: 87299
Buggy source:
/** 
 * @param p
 * @param q
 */
public void drawLine(Ponto2D p,Ponto2D q){
  screen.drawLine((int)p.getX(),(int)p.getY(),(int)q.getX(),(int)q.getY());
}

Fixed version (ground truth):
/** 
 * @param p
 * @param q
 */
public void drawLine(Point2D p,Point2D q){
  screen.drawLine((int)p.getX(),(int)p.getY(),(int)q.getX(),(int)q.getY());
}
Program: 87300
Project: 87300
Buggy source:
/** 
 * @param point
 * @param radius
 */
public void fillCircle(Ponto2D point,int radius){
  screen.fillOval((int)point.getX() - radius,(int)point.getY() - radius,radius * 2,radius * 2);
}

Fixed version (ground truth):
/** 
 * @param point
 * @param radius
 */
public void fillCircle(Point2D point,int radius){
  screen.fillOval((int)point.getX() - radius,(int)point.getY() - radius,radius * 2,radius * 2);
}
Program: 87301
Project: 87301
Buggy source:
private void initLoaders(){
  core.addLoader(ImageLoader.getInstance());
  core.addLoader(FontLoader.getInstance());
  core.initDefault();
}

Fixed version (ground truth):
private void initLoaders(){
  addLoader(ImageLoader.getInstance());
  addLoader(FontLoader.getInstance());
  core.setLoaders(loaders);
  core.initDefault();
}
Program: 87302
Project: 87302
Buggy source:
protected void addLoader(Loader loader){
  core.addLoader(loader);
}

Fixed version (ground truth):
protected void addLoader(Loader loader){
  loaders.add(loader);
}
Program: 87303
Project: 87303
Buggy source:
private void initLoaders(){
  core.addLoader(ImageLoader.getInstance());
  core.addLoader(FontLoader.getInstance());
  core.initDefault();
}

Fixed version (ground truth):
private void initLoaders(){
  addLoader(ImageLoader.getInstance());
  addLoader(FontLoader.getInstance());
  core.setLoaders(loaders);
  core.initDefault();
}
Program: 87304
Project: 87304
Buggy source:
protected void addLoader(Loader loader){
  core.addLoader(loader);
}

Fixed version (ground truth):
protected void addLoader(Loader loader){
  loaders.add(loader);
}
Program: 87305
Project: 87305
Buggy source:
private Method getMethod(Class<?> cls,String methodName,Class<?>[] classes){
  for (  Method method : cls.getMethods()) {
    if (method.getName().equals(methodName)) {
      if (method.getParameterTypes().length == classes.length) {
        for (int i=0; i < classes.length; i++) {
          Class<?> clazz=method.getParameterTypes()[i];
          if (clazz.isPrimitive()) {
            String name=classes[i].getSimpleName().toLowerCase();
            String parameterName=method.getParameterTypes()[i].getName();
            if (!name.equals(parameterName)) {
              return null;
            }
          }
 else {
            if (!classes[i].getName().equals(method.getParameterTypes()[i].getComponentType())) {
              return null;
            }
          }
        }
        return method;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private Method getMethod(Class<?> cls,String methodName,Class<?>[] classes){
  for (  Method method : cls.getMethods()) {
    if (method.getName().equals(methodName)) {
      if (method.getParameterTypes().length == classes.length) {
        for (int i=0; i < classes.length; i++) {
          Class<?> clazz=method.getParameterTypes()[i];
          if (clazz.isPrimitive()) {
            String name=classes[i].getSimpleName().toLowerCase();
            String parameterName=method.getParameterTypes()[i].getName();
            if (!name.startsWith(parameterName)) {
              return null;
            }
          }
 else {
            if (!classes[i].getName().equals(method.getParameterTypes()[i].getComponentType())) {
              return null;
            }
          }
        }
        return method;
      }
    }
  }
  return null;
}
Program: 87306
Project: 87306
Buggy source:
private void updateForcedEvents(List<GUIEvent> guiEvents){
  for (  GUIEvent event : guiEvents) {
    updateForcedEvent(event);
  }
}

Fixed version (ground truth):
private void updateForcedEvents(List<GUIEvent> guiEvents){
  for (  GUIEvent event : guiEvents) {
    updateForcedEvent(event);
  }
  guiEvents.clear();
}
Program: 87307
Project: 87307
Buggy source:
@Override public void update(GUIEvent event){
  if (event == GUIEvent.WINDOW_CLOSE) {
    close();
  }
}

Fixed version (ground truth):
@Override public void update(GUIEvent event){
  if (event == GUIEvent.APPLICATION_CHANGED) {
    changeApplication();
  }
  if (event == GUIEvent.WINDOW_CLOSE) {
    close();
  }
}
Program: 87308
Project: 87308
Buggy source:
private void gerenciaEvento(GUIComponent componente,GUIEvent lastEvent){
switch (lastEvent) {
case GAIN_FOCUS:
    if (focus != null) {
      focus.update(GUIEvent.LOST_FOCUS);
    }
  focus=componente;
break;
case LOST_FOCUS:
if (componente == focus) {
}
break;
case MOUSE_OVER:
if (!mouseOver) {
mouseOver=true;
mouseOverClickable=true;
}
break;
case MOUSE_OVER_WITH_FOCUS:
break;
case NEXT_COMPONENT:
System.out.println("String_Node_Str");
componente.update(GUIEvent.LOST_FOCUS);
break;
case WINDOW_CLOSE:
requestClose((Window)componente);
break;
case APPLICATION_CHANGED:
activeWindow.changeApplication(activeWindow.getApplication().getReturnApplication());
break;
default :
if (componente.isMouseOver()) {
componente.update(GUIEvent.MOUSE_OUT);
}
break;
}
componente.setLastEvent(lastEvent);
componente.update(lastEvent);
componente.executeAction(lastEvent);
}

Fixed version (ground truth):
private void gerenciaEvento(GUIComponent componente,GUIEvent lastEvent){
switch (lastEvent) {
case GAIN_FOCUS:
    if (focus != null) {
      focus.update(GUIEvent.LOST_FOCUS);
    }
  focus=componente;
break;
case LOST_FOCUS:
if (componente == focus) {
focus=null;
}
break;
case MOUSE_OVER:
if (!mouseOver) {
mouseOver=true;
mouseOverClickable=true;
}
break;
case MOUSE_OVER_WITH_FOCUS:
break;
case NEXT_COMPONENT:
System.out.println("String_Node_Str");
componente.update(GUIEvent.LOST_FOCUS);
break;
case WINDOW_CLOSE:
requestClose((Window)componente);
break;
case APPLICATION_CHANGED:
activeWindow.changeApplication(activeWindow.getApplication().getReturnApplication());
break;
default :
if (componente.isMouseOver()) {
componente.update(GUIEvent.MOUSE_OUT);
}
break;
}
componente.setLastEvent(lastEvent);
componente.update(lastEvent);
componente.executeAction(lastEvent);
}
Program: 87310
Project: 87310
Buggy source:
private int getErrors(int trial){
  int errors=0;
  for (int i=0, n=_patterns.size(); i < n; ++i) {
    if (_responses.get(trial).get(i).equals(_patterns.get(i).getSecond())) {
    }
 else {
      errors+=1;
    }
  }
  return errors;
}

Fixed version (ground truth):
private int getErrors(int trial){
  int errors=0;
  for (int i=0, n=_patterns.size(); i < n; ++i) {
    ListPattern target=_responses.get(trial).get(i).clone();
    ListPattern response=_patterns.get(i).getSecond().clone();
    target.setNotFinished();
    response.setNotFinished();
    if (response.equals(target)) {
    }
 else {
      errors+=1;
    }
  }
  return errors;
}
Program: 87311
Project: 87311
Buggy source:
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn() - 1;
      _fixationY=ios.getRow() - 1;
      for (      Link link : hypothesisChildren) {
        if (link.getTest().size() == 1) {
          if (link.getTest().getItem(0) instanceof ItemSquarePattern) {
            ItemSquarePattern testIos=(ItemSquarePattern)link.getTest().getItem(0);
            if (testIos.getColumn() - 1 == _fixationX && testIos.getRow() - 1 == _fixationY && testIos.getItem().equals(_currentScene.getItem(_fixationY,_fixationX))) {
              _visualStm.replaceHypothesis(link.getChildNode());
              _lastHeuristic=1;
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn() - 1;
      _fixationY=ios.getRow() - 1;
      for (      Link link : hypothesisChildren) {
        if (link.getTest().size() == 1) {
          if (link.getTest().getItem(0) instanceof ItemSquarePattern) {
            ItemSquarePattern testIos=(ItemSquarePattern)link.getTest().getItem(0);
            if (testIos.getColumn() - 1 == _fixationX && testIos.getRow() - 1 == _fixationY && testIos.getItem().equals(_currentScene.getItem(_fixationY,_fixationX))) {
              _visualStm.replaceHypothesis(link.getChildNode());
              _lastHeuristic=1;
              _fixationsX.add(_fixationX);
              _fixationsY.add(_fixationY);
              _fixationsType.add(_lastHeuristic);
              addFixation(new Fixation(_lastHeuristic,_fixationX,_fixationY));
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}
Program: 87313
Project: 87313
Buggy source:
public void learnLateralLinks(Chrest model){
  if (_items.size() >= 2) {
    _items.get(1).setFollowedBy(_items.get(0));
    model.advanceClock(model.getAddLinkTime());
  }
}

Fixed version (ground truth):
public void learnLateralLinks(Chrest model){
  if (_items.size() >= 2 && _items.get(1).getFollowedBy() != _items.get(0)) {
    _items.get(1).setFollowedBy(_items.get(0));
    model.advanceClock(model.getAddLinkTime());
  }
}
Program: 87314
Project: 87314
Buggy source:
/** 
 * Discrimination learning extends the LTM network by adding new  nodes.
 */
Node discriminate(Chrest model,ListPattern pattern){
  ListPattern newInformation=pattern.remove(_contents);
  if (newInformation.isEmpty()) {
    if (newInformation.isFinished()) {
      return addTest(model,newInformation);
    }
 else {
      return this;
    }
  }
  Node retrievedChunk=model.recognise(newInformation);
  if (retrievedChunk == model.getLtmByModality(pattern)) {
    return model.getLtmByModality(newInformation).learnPrimitive(model,newInformation.getFirstItem());
  }
 else   if (retrievedChunk.getImage().isEmpty()) {
    return retrievedChunk.familiarise(model,newInformation);
  }
 else   if (retrievedChunk.getImage().matches(newInformation)) {
    return addTest(model,retrievedChunk.getImage());
  }
 else {
    ListPattern firstItem=newInformation.getFirstItem();
    firstItem.setNotFinished();
    return addTest(model,firstItem);
  }
}

Fixed version (ground truth):
/** 
 * Discrimination learning extends the LTM network by adding new  nodes.
 */
Node discriminate(Chrest model,ListPattern pattern){
  ListPattern newInformation=pattern.remove(_contents);
  if (newInformation.isEmpty()) {
    if (newInformation.isFinished()) {
      return addTest(model,newInformation);
    }
 else {
      return this;
    }
  }
  Node retrievedChunk=model.recognise(newInformation);
  if (retrievedChunk == model.getLtmByModality(pattern)) {
    return model.getLtmByModality(newInformation).learnPrimitive(model,newInformation.getFirstItem());
  }
 else   if (retrievedChunk.getImage().isEmpty()) {
    return retrievedChunk.familiarise(model,newInformation);
  }
 else   if (retrievedChunk.getImage().matches(newInformation)) {
    ListPattern testPattern=retrievedChunk.getImage().clone();
    testPattern.setNotFinished();
    return addTest(model,testPattern);
  }
 else {
    ListPattern firstItem=newInformation.getFirstItem();
    firstItem.setNotFinished();
    return addTest(model,firstItem);
  }
}
Program: 87315
Project: 87315
Buggy source:
private List<ListPattern> readItems(BufferedReader input) throws IOException {
  List<ListPattern> items=new ArrayList<ListPattern>();
  String line=input.readLine();
  while (line != null) {
    ListPattern pattern=Pattern.makeVisualList(line.trim().split("String_Node_Str"));
    pattern.setFinished();
    items.add(pattern);
    line=input.readLine();
  }
  return items;
}

Fixed version (ground truth):
private List<ListPattern> readItems(BufferedReader input,boolean verbal) throws IOException {
  List<ListPattern> items=new ArrayList<ListPattern>();
  String line=input.readLine();
  while (line != null) {
    ListPattern pattern;
    if (verbal) {
      pattern=Pattern.makeVerbalList(line.trim().split("String_Node_Str"));
    }
 else {
      pattern=Pattern.makeVisualList(line.trim().split("String_Node_Str"));
    }
    pattern.setFinished();
    items.add(pattern);
    line=input.readLine();
  }
  return items;
}
Program: 87316
Project: 87316
Buggy source:
private List<PairedPattern> readPairedItems(BufferedReader input,boolean secondVerbal) throws IOException {
  List<PairedPattern> items=new ArrayList<PairedPattern>();
  String line=input.readLine();
  while (line != null) {
    String[] pair=line.split("String_Node_Str");
    if (pair.length != 2)     throw new IOException();
    ListPattern pat1=Pattern.makeVisualList(pair[0].trim().split("String_Node_Str"));
    pat1.setFinished();
    ListPattern pat2;
    if (secondVerbal) {
      pat2=Pattern.makeVerbalList(pair[1].trim().split("String_Node_Str"));
    }
 else {
      pat2=Pattern.makeVisualList(pair[1].trim().split("String_Node_Str"));
    }
    pat2.setFinished();
    items.add(new PairedPattern(pat1,pat2));
    line=input.readLine();
  }
  return items;
}

Fixed version (ground truth):
private List<PairedPattern> readPairedItems(BufferedReader input,boolean categorisation) throws IOException {
  List<PairedPattern> items=new ArrayList<PairedPattern>();
  String line=input.readLine();
  while (line != null) {
    String[] pair=line.split("String_Node_Str");
    if (pair.length != 2)     throw new IOException();
    ListPattern pat1;
    if (categorisation) {
      pat1=Pattern.makeVisualList(pair[0].trim().split("String_Node_Str"));
    }
 else {
      pat1=Pattern.makeVerbalList(pair[0].trim().split("String_Node_Str"));
    }
    pat1.setFinished();
    ListPattern pat2=Pattern.makeVerbalList(pair[1].trim().split("String_Node_Str"));
    pat2.setFinished();
    items.add(new PairedPattern(pat1,pat2));
    line=input.readLine();
  }
  return items;
}
Program: 87317
Project: 87317
Buggy source:
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn();
      _fixationY=ios.getRow();
      for (      Link link : hypothesisChildren) {
        if (link.getTest().size() == 1) {
          if (link.getTest().getItem(0) instanceof ItemSquarePattern) {
            ItemSquarePattern testIos=(ItemSquarePattern)link.getTest().getItem(0);
            if (testIos.getColumn() == _fixationX && testIos.getRow() == _fixationY && testIos.getItem().equals(_currentScene.getItem(_fixationY,_fixationX))) {
              _visualStm.replaceHypothesis(link.getChildNode());
              _lastHeuristic=1;
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn() - 1;
      _fixationY=ios.getRow() - 1;
      for (      Link link : hypothesisChildren) {
        if (link.getTest().size() == 1) {
          if (link.getTest().getItem(0) instanceof ItemSquarePattern) {
            ItemSquarePattern testIos=(ItemSquarePattern)link.getTest().getItem(0);
            if (testIos.getColumn() - 1 == _fixationX && testIos.getRow() - 1 == _fixationY && testIos.getItem().equals(_currentScene.getItem(_fixationY,_fixationX))) {
              _visualStm.replaceHypothesis(link.getChildNode());
              _lastHeuristic=1;
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}
Program: 87318
Project: 87318
Buggy source:
/** 
 * Try to move eye to random item in periphery.
 */
private boolean randomItemHeuristic(){
  for (int i=0; i < 10; ++i) {
    int xDisplacement=_random.nextInt(_fieldOfView * 2 + 1) - _fieldOfView;
    int yDisplacement=_random.nextInt(_fieldOfView * 2 + 1) - _fieldOfView;
    if (!_currentScene.isEmpty(_fixationY + yDisplacement,_fixationX + xDisplacement)) {
      _fixationX+=xDisplacement;
      _fixationY+=yDisplacement;
      _lastHeuristic=2;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Try to move eye to random item in periphery.
 */
private boolean randomItemHeuristic(){
  for (int i=0; i < 10; ++i) {
    int xDisplacement=_random.nextInt(_fieldOfView * 2 + 1) - _fieldOfView;
    int yDisplacement=_random.nextInt(_fieldOfView * 2 + 1) - _fieldOfView;
    if (!_currentScene.isEmpty(_fixationY + yDisplacement,_fixationX + xDisplacement) && _fixationX < _currentScene.getWidth() && _fixationY < _currentScene.getHeight()) {
      _fixationX+=xDisplacement;
      _fixationY+=yDisplacement;
      _lastHeuristic=2;
      return true;
    }
  }
  return false;
}
Program: 87319
Project: 87319
Buggy source:
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  int fov=2;
  g2.setBackground(Color.WHITE);
  g2.clearRect(0,0,_maxX,_maxY);
  for (int i=0; i <= _scene.getHeight(); ++i) {
    g2.drawLine(offsetX,offsetY + scale * i,offsetX + scale * _scene.getWidth(),offsetY + scale * i);
  }
  for (int i=0; i <= _scene.getWidth(); ++i) {
    g2.drawLine(offsetX + scale * i,offsetY,offsetX + scale * i,offsetY + scale * _scene.getHeight());
  }
  for (int i=0; i < _scene.getHeight(); ++i) {
    g2.drawString("String_Node_Str" + (i + 1),offsetX + scale * (_scene.getWidth() + 1),offsetY + scale * (i + 1) - 5);
  }
  for (int i=0; i < _scene.getWidth(); ++i) {
    g2.drawString("String_Node_Str" + (i + 1),offsetX + scale * i + 5,offsetY + scale * (_scene.getHeight() + 1));
  }
  for (int i=0; i < _scene.getHeight(); ++i) {
    for (int j=0; j < _scene.getWidth(); ++j) {
      if (!_scene.isEmpty(i,j)) {
        g2.drawString(_scene.getItem(i,j),offsetX + 5 + scale * j,offsetY + scale - 5 + scale * i);
      }
    }
  }
  int prevX=-1;
  int prevY=-1;
  if (_showFixations) {
    for (    Fixation fixation : _fixations) {
      g2.setColor(Color.BLUE);
      g2.setStroke(new BasicStroke(2));
      int nextX=offsetX + scale * fixation.getX() - 2;
      int nextY=offsetY + scale * fixation.getY() - 2;
      if (prevX == -1 && prevY == -1) {
        ;
      }
 else {
        g2.drawLine(prevX,prevY,nextX,nextY);
      }
      g2.drawOval(nextX,nextY,scale - 4,scale - 4);
    }
  }
}

Fixed version (ground truth):
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  int fov=2;
  g2.setBackground(Color.WHITE);
  g2.clearRect(0,0,_maxX,_maxY);
  for (int i=0; i <= _scene.getHeight(); ++i) {
    g2.drawLine(offsetX,offsetY + scale * i,offsetX + scale * _scene.getWidth(),offsetY + scale * i);
  }
  for (int i=0; i <= _scene.getWidth(); ++i) {
    g2.drawLine(offsetX + scale * i,offsetY,offsetX + scale * i,offsetY + scale * _scene.getHeight());
  }
  for (int i=0; i < _scene.getHeight(); ++i) {
    g2.drawString("String_Node_Str" + (i + 1),offsetX + scale * (_scene.getWidth() + 1),offsetY + scale * (i + 1) - 5);
  }
  for (int i=0; i < _scene.getWidth(); ++i) {
    g2.drawString("String_Node_Str" + (i + 1),offsetX + scale * i + 5,offsetY + scale * (_scene.getHeight() + 1));
  }
  for (int i=0; i < _scene.getHeight(); ++i) {
    for (int j=0; j < _scene.getWidth(); ++j) {
      if (!_scene.isEmpty(i,j)) {
        g2.drawString(_scene.getItem(i,j),offsetX + 5 + scale * j,offsetY + scale - 5 + scale * i);
      }
    }
  }
  int prevX=-1;
  int prevY=-1;
  if (_showFixations) {
    for (    Fixation fixation : _fixations) {
      g2.setColor(Color.BLUE);
      g2.setStroke(new BasicStroke(2));
      int nextX=offsetX + scale * fixation.getX() + 5;
      int nextY=offsetY + scale * fixation.getY() + 5;
      if (prevX == -1 && prevY == -1) {
        ;
      }
 else {
        g2.drawLine(prevX,prevY,nextX + 5,nextY + 5);
      }
      g2.drawOval(nextX,nextY,scale - 10,scale - 10);
      prevX=nextX + 5;
      prevY=nextY + 5;
    }
  }
}
Program: 87320
Project: 87320
Buggy source:
/** 
 * Retrieve all items within given row +/- size, column +/- size TODO: Convert this to use a circular field of view.
 */
public ListPattern getItems(int row,int column,int size){
  ListPattern items=new ListPattern();
  for (int i=column - size; i <= column + size; ++i) {
    if (i >= 0 && i < _height) {
      for (int j=row - size; j <= row + size; ++j) {
        if (j >= 0 && j < _width) {
          if (!_scene[i][j].equals("String_Node_Str")) {
            items.add(new ItemSquarePattern(_scene[i][j],i,j));
          }
        }
      }
    }
  }
  return items;
}

Fixed version (ground truth):
/** 
 * Retrieve all items within given row +/- size, column +/- size TODO: Convert this to use a circular field of view.
 */
public ListPattern getItems(int startRow,int startColumn,int size){
  ListPattern items=new ListPattern();
  for (int col=startColumn - size; col <= startColumn + size; ++col) {
    if (col >= 0 && col < _width) {
      for (int row=startRow - size; row <= startRow + size; ++row) {
        if (row >= 0 && row < _height) {
          if (!_scene[row][col].equals("String_Node_Str")) {
            items.add(new ItemSquarePattern(_scene[row][col],col + 1,row + 1));
          }
        }
      }
    }
  }
  return items;
}
Program: 87321
Project: 87321
Buggy source:
AboutAction(Shell parent){
  super("String_Node_Str",new ImageIcon(jchrest.gui.Shell.class.getResource("String_Node_Str")));
  _parent=parent;
}

Fixed version (ground truth):
AboutAction(Shell parent){
  super("String_Node_Str");
  _parent=parent;
}
Program: 87322
Project: 87322
Buggy source:
ModelPropertiesAction(Shell parent){
  super("String_Node_Str",new ImageIcon(jchrest.gui.Shell.class.getResource("String_Node_Str")));
  _parent=parent;
}

Fixed version (ground truth):
ModelPropertiesAction(Shell parent){
  super("String_Node_Str");
  _parent=parent;
}
Program: 87323
Project: 87323
Buggy source:
LoadDataAction(Shell parent){
  super("String_Node_Str",new ImageIcon(jchrest.gui.Shell.class.getResource("String_Node_Str")));
  _parent=parent;
}

Fixed version (ground truth):
LoadDataAction(Shell parent){
  super("String_Node_Str");
  _parent=parent;
}
Program: 87324
Project: 87324
Buggy source:
SaveModelAction(Shell parent){
  super("String_Node_Str",new ImageIcon(jchrest.gui.Shell.class.getResource("String_Node_Str")));
  _parent=parent;
}

Fixed version (ground truth):
SaveModelAction(Shell parent){
  super("String_Node_Str");
  _parent=parent;
}
Program: 87325
Project: 87325
Buggy source:
LoadModelAction(Shell parent){
  super("String_Node_Str",new ImageIcon(jchrest.gui.Shell.class.getResource("String_Node_Str")));
  _parent=parent;
}

Fixed version (ground truth):
LoadModelAction(Shell parent){
  super("String_Node_Str");
  _parent=parent;
}
Program: 87326
Project: 87326
Buggy source:
/** 
 * Read an item-on-square pattern from given reader object.  Assumes that column/row cannot be -1.
 */
public static ItemSquarePattern readPattern(BufferedReader reader) throws ParsingErrorException {
  int column=-1;
  int row=-1;
  String item=null;
  FileUtilities.acceptOpenTag(reader,"String_Node_Str");
  while (!FileUtilities.checkCloseTag(reader,"String_Node_Str")) {
    if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      item=FileUtilities.readStringInTag(reader,"String_Node_Str");
    }
 else     if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      column=FileUtilities.readIntInTag(reader,"String_Node_Str");
    }
 else     if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      row=FileUtilities.readIntInTag(reader,"String_Node_Str");
    }
 else {
      throw new ParsingErrorException();
    }
  }
  FileUtilities.acceptCloseTag(reader,"String_Node_Str");
  int number=FileUtilities.readIntInTag(reader,"String_Node_Str");
  if (item == null || column == -1 || row == -1) {
    throw new ParsingErrorException();
  }
  return new ItemSquarePattern(item,column,row);
}

Fixed version (ground truth):
/** 
 * Read an item-on-square pattern from given reader object.  Assumes that column/row cannot be -1.
 */
public static ItemSquarePattern readPattern(BufferedReader reader) throws ParsingErrorException {
  int column=-1;
  int row=-1;
  String item=null;
  FileUtilities.acceptOpenTag(reader,"String_Node_Str");
  while (!FileUtilities.checkCloseTag(reader,"String_Node_Str")) {
    if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      item=FileUtilities.readStringInTag(reader,"String_Node_Str");
    }
 else     if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      column=FileUtilities.readIntInTag(reader,"String_Node_Str");
    }
 else     if (FileUtilities.checkOpenTag(reader,"String_Node_Str")) {
      row=FileUtilities.readIntInTag(reader,"String_Node_Str");
    }
 else {
      throw new ParsingErrorException();
    }
  }
  FileUtilities.acceptCloseTag(reader,"String_Node_Str");
  if (item == null || column == -1 || row == -1) {
    throw new ParsingErrorException();
  }
  return new ItemSquarePattern(item,column,row);
}
Program: 87327
Project: 87327
Buggy source:
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn();
      _fixationY=ios.getRow();
      for (      Link link : hypothesisChildren) {
        if (_currentScene.getItem(_fixationY,_fixationX).equals(link.getTest())) {
          _visualStm.replaceHypothesis(link.getChildNode());
          _lastHeuristic=1;
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Try to move eye using LTM heuristic, return true if: -- square suggested by first child yields a piece which  allows model to follow a test link.
 */
private boolean ltmHeuristic(){
  if (_visualStm.getCount() >= 1) {
    List<Link> hypothesisChildren=_visualStm.getItem(0).getChildren();
    if (hypothesisChildren.isEmpty())     return false;
    ListPattern test=hypothesisChildren.get(0).getTest();
    if (test.isEmpty())     return false;
    Pattern first=test.getItem(0);
    if (first instanceof ItemSquarePattern) {
      ItemSquarePattern ios=(ItemSquarePattern)first;
      _fixationX=ios.getColumn();
      _fixationY=ios.getRow();
      for (      Link link : hypothesisChildren) {
        if (link.getTest().size() == 1) {
          if (link.getTest().getItem(0) instanceof ItemSquarePattern) {
            ItemSquarePattern testIos=(ItemSquarePattern)link.getTest().getItem(0);
            if (testIos.getColumn() == _fixationX && testIos.getRow() == _fixationY && testIos.getItem().equals(_currentScene.getItem(_fixationY,_fixationX))) {
              _visualStm.replaceHypothesis(link.getChildNode());
              _lastHeuristic=1;
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}
Program: 87328
Project: 87328
Buggy source:
private JMenu createModelMenu(){
  JMenu menu=new JMenu("String_Node_Str");
  menu.add(new ClearModelAction(this));
  menu.add(new ModelPropertiesAction(this));
  menu.add(new JSeparator());
  menu.add(new ModelInformationAction(this));
  menu.add(new ViewModelAction(this));
  return menu;
}

Fixed version (ground truth):
private JMenu createModelMenu(){
  JMenu menu=new JMenu("String_Node_Str");
  menu.add(new ClearModelAction(this));
  menu.add(new LoadModelAction(this));
  menu.add(new SaveModelAction(this));
  menu.add(new ModelPropertiesAction(this));
  menu.add(new JSeparator());
  menu.add(new ModelInformationAction(this));
  menu.add(new ViewModelAction(this));
  return menu;
}
Program: 87329
Project: 87329
Buggy source:
/** 
 * Two ItemSquarePatterns only match if they are the same.
 */
public boolean matches(Pattern givenPattern){
  if (!(givenPattern instanceof ItemSquarePattern))   return false;
  return this.equals(givenPattern);
}

Fixed version (ground truth):
/** 
 * Two ItemSquarePatterns only match if they are the same.
 */
public boolean matches(Pattern givenPattern){
  if (!(givenPattern instanceof ItemSquarePattern))   return false;
  return this.equalPrimitive((ItemSquarePattern)givenPattern);
}
Program: 87330
Project: 87330
Buggy source:
/** 
 * Used in constructing instances by   {@link Pattern} class.Add pattern to list, unless the pattern is 'finished'.
 */
public void add(Pattern pattern){
  if (!_finished) {
    _list.add(pattern);
  }
}

Fixed version (ground truth):
/** 
 * Used in constructing instances by   {@link Pattern} class.Add pattern to list, unless the pattern is 'finished'.
 */
public void add(PrimitivePattern pattern){
  if (!_finished) {
    _list.add(pattern);
  }
}
Program: 87331
Project: 87331
Buggy source:
/** 
 * Write a description of the list pattern to the given Writer object.
 */
public void writePattern(Writer writer) throws IOException {
  FileUtilities.writeOpenTag(writer,"String_Node_Str");
  FileUtilities.writeOpenTag(writer,"String_Node_Str");
  for (  Pattern pattern : _list) {
    pattern.writePattern(writer);
  }
  FileUtilities.writeCloseTag(writer,"String_Node_Str");
  FileUtilities.writeTaggedString(writer,"String_Node_Str",_modality.toString());
  FileUtilities.writeTaggedBoolean(writer,"String_Node_Str",_finished);
  FileUtilities.writeCloseTag(writer,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Write a description of the list pattern to the given Writer object.
 */
public void writePattern(Writer writer) throws IOException {
  FileUtilities.writeOpenTag(writer,"String_Node_Str");
  FileUtilities.writeOpenTag(writer,"String_Node_Str");
  for (  PrimitivePattern pattern : _list) {
    pattern.writePattern(writer);
  }
  FileUtilities.writeCloseTag(writer,"String_Node_Str");
  FileUtilities.writeTaggedString(writer,"String_Node_Str",_modality.toString());
  FileUtilities.writeTaggedBoolean(writer,"String_Node_Str",_finished);
  FileUtilities.writeCloseTag(writer,"String_Node_Str");
}
Program: 87332
Project: 87332
Buggy source:
/** 
 * Retrieve the indexed item from the list pattern. There is no check on the validity of the index.
 */
public Pattern getItem(int index){
  return _list.get(index);
}

Fixed version (ground truth):
/** 
 * Retrieve the indexed item from the list pattern. There is no check on the validity of the index.
 */
public PrimitivePattern getItem(int index){
  return _list.get(index);
}
Program: 87333
Project: 87333
Buggy source:
/** 
 * Two patterns match if they are both ListPatterns and this ListPattern contains a subset of the given pattern. 
 */
public boolean matches(Pattern givenPattern){
  if (!(givenPattern instanceof ListPattern))   return false;
  ListPattern pattern=(ListPattern)givenPattern;
  if (_modality != pattern._modality)   return false;
  if (isFinished()) {
    if (size() != pattern.size())     return false;
    if (!pattern.isFinished())     return false;
  }
 else {
    if (size() > pattern.size())     return false;
  }
  for (int i=0, n=size(); i < n; ++i) {
    if (!pattern.getItem(i).equals(getItem(i))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Two patterns match if they are both ListPatterns and this ListPattern contains a subset of the given pattern. 
 */
public boolean matches(Pattern givenPattern){
  if (!(givenPattern instanceof ListPattern))   return false;
  ListPattern pattern=(ListPattern)givenPattern;
  if (_modality != pattern._modality)   return false;
  if (isFinished()) {
    if (size() != pattern.size())     return false;
    if (!pattern.isFinished())     return false;
  }
 else {
    if (size() > pattern.size())     return false;
  }
  for (int i=0, n=size(); i < n; ++i) {
    if (!pattern.getItem(i).equalPrimitive(getItem(i))) {
      return false;
    }
  }
  return true;
}
Program: 87334
Project: 87334
Buggy source:
public ListPattern(Modality modality){
  _list=new ArrayList<Pattern>();
  _modality=modality;
  _finished=false;
}

Fixed version (ground truth):
public ListPattern(Modality modality){
  _list=new ArrayList<PrimitivePattern>();
  _modality=modality;
  _finished=false;
}