nus-yam/ex-repair huggingface dataset:
Program: 11664
Project: 11664
Buggy source:
/** 
 * Sets whether or not locking of the selected region is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow locking of the selected region
 * @see AxisMouseListener#setAllowSelectionLock(boolean)
 */
public void setAllowSelectionLock(boolean lock){
  this.allowSelectionLock=lock;
  this.timelineMouseListener.setAllowSelectionLock(lock);
  for (  TimePlotInfo info : getAllTimePlots()) {
    info.getTimelineMouseListener().setAllowSelectionLock(lock);
  }
}

Fixed version (ground truth):
/** 
 * Sets whether or not locking of the selected region is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow locking of the selected region
 * @see AxisMouseListener#setAllowSelectionLock(boolean)
 */
public void setAllowSelectionLock(boolean lock){
  this.lock.lock();
  try {
    this.allowSelectionLock=lock;
    this.timelineMouseListener.setAllowSelectionLock(lock);
    for (    TimePlotInfo info : getAllTimePlots()) {
      info.getTimelineMouseListener().setAllowSelectionLock(lock);
    }
  }
  finally {
    this.lock.unlock();
  }
}
Program: 11665
Project: 11665
Buggy source:
public void setTimelineMouseListener1D(AxisMouseListener1D listener){
  if (this.timelineMouseListener != null) {
    this.timeLayout.removeGlimpseMouseAllListener(this.timelineMouseListener);
  }
  this.timelineMouseListener=listener;
  if (this.timelineMouseListener != null) {
    this.timeLayout.addGlimpseMouseAllListener(this.timelineMouseListener);
  }
}

Fixed version (ground truth):
public void setTimelineMouseListener1D(AxisMouseListener1D listener){
  this.lock.lock();
  try {
    if (this.timelineMouseListener != null) {
      this.timeLayout.removeGlimpseMouseAllListener(this.timelineMouseListener);
    }
    this.timelineMouseListener=listener;
    if (this.timelineMouseListener != null) {
      this.timeLayout.addGlimpseMouseAllListener(this.timelineMouseListener);
    }
  }
  finally {
    this.lock.unlock();
  }
}
Program: 11666
Project: 11666
Buggy source:
/** 
 * Sets whether or not panning of the Y axis is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow panning of the Y axis
 * @see AxisMouseListener#setAllowPanY(boolean)
 */
public void setAllowPanY(boolean lock){
  this.allowPanY=lock;
  if (this.getOrientation() == Orientation.HORIZONTAL) {
    this.timelineMouseListener.setAllowPan(lock);
  }
  for (  TimePlotInfo info : getAllTimePlots()) {
    info.getTimelineMouseListener().setAllowPanY(lock);
  }
}

Fixed version (ground truth):
/** 
 * Sets whether or not panning of the Y axis is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow panning of the Y axis
 * @see AxisMouseListener#setAllowPanY(boolean)
 */
public void setAllowPanY(boolean lock){
  this.lock.lock();
  try {
    this.allowPanY=lock;
    if (this.getOrientation() == Orientation.HORIZONTAL) {
      this.timelineMouseListener.setAllowPan(lock);
    }
    for (    TimePlotInfo info : getAllTimePlots()) {
      info.getTimelineMouseListener().setAllowPanY(lock);
    }
  }
  finally {
    this.lock.unlock();
  }
}
Program: 11667
Project: 11667
Buggy source:
/** 
 * Sets whether or not panning of the X axis is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow panning of the X axis
 * @see AxisMouseListener#setAllowPanX(boolean)
 */
public void setAllowPanX(boolean lock){
  this.allowPanX=lock;
  if (this.getOrientation() == Orientation.VERTICAL) {
    this.timelineMouseListener.setAllowPan(lock);
  }
  for (  TimePlotInfo info : getAllTimePlots()) {
    info.getTimelineMouseListener().setAllowPanX(lock);
  }
}

Fixed version (ground truth):
/** 
 * Sets whether or not panning of the X axis is allowed for all timeline and plot axes. This setting will also affect newly created plots.
 * @param lock whether to allow panning of the X axis
 * @see AxisMouseListener#setAllowPanX(boolean)
 */
public void setAllowPanX(boolean lock){
  this.lock.lock();
  try {
    this.allowPanX=lock;
    if (this.getOrientation() == Orientation.VERTICAL) {
      this.timelineMouseListener.setAllowPan(lock);
    }
    for (    TimePlotInfo info : getAllTimePlots()) {
      info.getTimelineMouseListener().setAllowPanX(lock);
    }
  }
  finally {
    this.lock.unlock();
  }
}
Program: 11668
Project: 11668
Buggy source:
public void setTimeAxisPainter(TimeAxisPainter painter){
  this.timeAxisDelegate.removePainter(this.timeAxisPainter);
  this.timeAxisPainter=painter;
  this.timeAxisDelegate.addPainter(this.timeAxisPainter);
}

Fixed version (ground truth):
public void setTimeAxisPainter(TimeAxisPainter painter){
  this.lock.lock();
  try {
    this.timeAxisDelegate.removePainter(this.timeAxisPainter);
    this.timeAxisPainter=painter;
    this.timeAxisDelegate.addPainter(this.timeAxisPainter);
  }
  finally {
    this.lock.unlock();
  }
}
Program: 11669
Project: 11669
Buggy source:
public void removeAll(){
  lock.lock();
  try {
    layoutChildren.clear();
    layoutDelegate.removeAll();
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
public void removeAll(){
  lock.lock();
  try {
    manager.removeAllLayouts();
    layoutDelegate.removeAll();
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}
Program: 11670
Project: 11670
Buggy source:
public void addLayout(GlimpseLayout layout,GlimpsePainterCallback callback,int zOrder){
  lock.lock();
  try {
    layoutChildren.add(layout);
    layoutDelegate.addLayout(layout,callback,zOrder);
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
public void addLayout(GlimpseLayout layout,GlimpsePainterCallback callback,int zOrder){
  lock.lock();
  try {
    manager.addLayout(layout,zOrder);
    layoutDelegate.addLayout(layout,callback,zOrder);
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}
Program: 11671
Project: 11671
Buggy source:
@Override public List<GlimpseTarget> getTargetChildren(){
  return unmodifiableLayoutChildren;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public List<GlimpseTarget> getTargetChildren(){
  return (List)manager.getLayoutList();
}
Program: 11672
Project: 11672
Buggy source:
public void addPainter(GlimpsePainter painter,GlimpsePainterCallback callback,int zOrder){
  lock.lock();
  try {
    layoutDelegate.addPainter(painter,callback,zOrder);
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
public void addPainter(GlimpsePainter painter,GlimpsePainterCallback callback,int zOrder){
  if (painter instanceof GlimpseLayout) {
    addLayout((GlimpseLayout)painter,callback,zOrder);
  }
 else {
    lock.lock();
    try {
      layoutDelegate.addPainter(painter,callback,zOrder);
      invalidateLayout();
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 11673
Project: 11673
Buggy source:
@Override public void removeLayout(GlimpseLayout layout){
  lock.lock();
  try {
    layoutChildren.remove(layout);
    layoutDelegate.removeLayout(layout);
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public void removeLayout(GlimpseLayout layout){
  lock.lock();
  try {
    manager.removeLayout(layout);
    layoutDelegate.removeLayout(layout);
    invalidateLayout();
  }
  finally {
    lock.unlock();
  }
}
Program: 11674
Project: 11674
Buggy source:
/** 
 * <p>Sets the relative ordering constant for this painter. Painters with low z order will be painter first (in the back) and those with high z order will be painted last (in the front).</p> <p>The value itself has no meaning; it is relative to the z orders of the other painters in the GlimpseLayout. For   {@link com.metsci.glimpse.layout.com.metsciGlimpseLayout} instances,the z order also affects the order in which mouse events are delivered to overlapping components.</p> <p>The z order is set to 0 by default. GlimpsePainters with the same z order are painted in the order they were added to the GlimpseLayout. This means the first painters added will be obscured by later painters.</p>
 */
public void setZOrder(GlimpsePainter painter,int zOrder){
  lock.lock();
  try {
    layoutDelegate.setZOrder(painter,zOrder);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * <p>Sets the relative ordering constant for this painter. Painters with low z order will be painter first (in the back) and those with high z order will be painted last (in the front).</p> <p>The value itself has no meaning; it is relative to the z orders of the other painters in the GlimpseLayout. For   {@link com.metsci.glimpse.layout.com.metsciGlimpseLayout} instances,the z order also affects the order in which mouse events are delivered to overlapping components.</p> <p>The z order is set to 0 by default. GlimpsePainters with the same z order are painted in the order they were added to the GlimpseLayout. This means the first painters added will be obscured by later painters.</p>
 */
public void setZOrder(GlimpsePainter painter,int zOrder){
  if (painter instanceof GlimpseLayout) {
    setZOrder((GlimpseLayout)painter,zOrder);
  }
 else {
    lock.lock();
    try {
      layoutDelegate.setZOrder(painter,zOrder);
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 11675
Project: 11675
Buggy source:
protected void initializeArrays(){
  this.stackedPlots=new HashMap<String,PlotInfo>();
}

Fixed version (ground truth):
protected void initializeArrays(){
  this.stackedPlots=new LinkedHashMap<String,PlotInfo>();
}
Program: 11676
Project: 11676
Buggy source:
/** 
 * Creates a StackedTimePlot2D with specified orientation. The provided epoch determines what absolute timestamp corresponds to value 0.0 on the time Axis1D.
 */
public StackedTimePlot2D(Orientation orientation,Epoch epoch){
  super(StackedTimePlot2D.class.getSimpleName());
  this.epoch=epoch;
  this.stackedTimePlots=new HashMap<String,TimePlotInfo>();
  this.delegatePlot=new StackedPlot2D(orientation){
    @Override protected TaggedAxis1D createCommonAxis(){
      return new TaggedAxis1D();
    }
  }
;
  this.initialize();
}

Fixed version (ground truth):
/** 
 * Creates a StackedTimePlot2D with specified orientation. The provided epoch determines what absolute timestamp corresponds to value 0.0 on the time Axis1D.
 */
public StackedTimePlot2D(Orientation orientation,Epoch epoch){
  super(StackedTimePlot2D.class.getSimpleName());
  this.epoch=epoch;
  this.stackedTimePlots=new LinkedHashMap<String,TimePlotInfo>();
  this.delegatePlot=new StackedPlot2D(orientation){
    @Override protected TaggedAxis1D createCommonAxis(){
      return new TaggedAxis1D();
    }
  }
;
  this.initialize();
}
Program: 11678
Project: 11678
Buggy source:
public ExampleRunner(){
  setOrientation(JSplitPane.HORIZONTAL_SPLIT);
  exampleList=new JList();
  codeArea=new JTextArea();
  codeArea.setFont(Font.decode("String_Node_Str"));
  codeArea.setEditable(false);
  runExampleButton=new JButton("String_Node_Str");
  runExampleButton.setEnabled(false);
  exampleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  exampleList.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      selectClass((Class<?>)exampleList.getSelectedValue());
    }
  }
);
  exampleList.setCellRenderer(new DefaultListCellRenderer(){
    @Override public Component getListCellRendererComponent(    JList list,    Object value,    int index,    boolean isSelected,    boolean cellHasFocus){
      Class<?> clazz=(Class<?>)value;
      value=clazz.getSimpleName();
      return super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
    }
  }
);
  runExampleButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      runExample(exampleClass);
    }
  }
);
  JPanel rightPanel=new JPanel(new BorderLayout());
  rightPanel.add(new JScrollPane(codeArea),BorderLayout.CENTER);
  JPanel buttonPanel=new JPanel(new BorderLayout());
  buttonPanel.add(runExampleButton,BorderLayout.EAST);
  rightPanel.add(buttonPanel,BorderLayout.SOUTH);
  setLeftComponent(new JScrollPane(exampleList));
  setRightComponent(rightPanel);
}

Fixed version (ground truth):
public ExampleRunner(){
  setOrientation(JSplitPane.HORIZONTAL_SPLIT);
  exampleTree=new JTree(new DefaultTreeModel(new DefaultMutableTreeNode("String_Node_Str")));
  codeArea=new JTextArea();
  codeArea.setFont(Font.decode("String_Node_Str"));
  codeArea.setEditable(false);
  runExampleButton=new JButton("String_Node_Str");
  runExampleButton.setEnabled(false);
  exampleTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  exampleTree.addTreeSelectionListener(new TreeSelectionListener(){
    @Override public void valueChanged(    TreeSelectionEvent e){
      if (exampleTree.getSelectionCount() > 0) {
        TreePath selectionPath=exampleTree.getSelectionPath();
        DefaultMutableTreeNode node=(DefaultMutableTreeNode)selectionPath.getLastPathComponent();
        if (node.getUserObject() instanceof Class<?>) {
          Class<?> clazz=(Class<?>)node.getUserObject();
          selectClass(clazz);
        }
 else {
          selectClass(null);
        }
      }
    }
  }
);
  runExampleButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      runExample(exampleClass);
    }
  }
);
  JPanel rightPanel=new JPanel(new BorderLayout());
  rightPanel.add(new JScrollPane(codeArea),BorderLayout.CENTER);
  JPanel buttonPanel=new JPanel(new BorderLayout());
  buttonPanel.add(runExampleButton,BorderLayout.EAST);
  rightPanel.add(buttonPanel,BorderLayout.SOUTH);
  setLeftComponent(new JScrollPane(exampleTree));
  setRightComponent(rightPanel);
  setDividerLocation(300);
}
Program: 11679
Project: 11679
Buggy source:
@Override public void valueChanged(ListSelectionEvent e){
  selectClass((Class<?>)exampleList.getSelectedValue());
}

Fixed version (ground truth):
@Override public void valueChanged(TreeSelectionEvent e){
  if (exampleTree.getSelectionCount() > 0) {
    TreePath selectionPath=exampleTree.getSelectionPath();
    DefaultMutableTreeNode node=(DefaultMutableTreeNode)selectionPath.getLastPathComponent();
    if (node.getUserObject() instanceof Class<?>) {
      Class<?> clazz=(Class<?>)node.getUserObject();
      selectClass(clazz);
    }
 else {
      selectClass(null);
    }
  }
}
Program: 11680
Project: 11680
Buggy source:
public void populateExamples(){
  new SwingWorker<Collection<Class<?>>,Void>(){
    @Override protected Collection<Class<?>> doInBackground() throws Exception {
      return getExamples();
    }
    @Override protected void done(){
      try {
        Collection<Class<?>> classes=get();
        DefaultListModel model=new DefaultListModel();
        for (        Class<?> exampleClass : classes) {
          model.addElement(exampleClass);
        }
        exampleList.setModel(model);
      }
 catch (      Exception e) {
        JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
    }
  }
.execute();
}

Fixed version (ground truth):
public void populateExamples(){
  new SwingWorker<Collection<Class<?>>,Void>(){
    @Override protected Collection<Class<?>> doInBackground() throws Exception {
      return getExamples();
    }
    @Override protected void done(){
      try {
        Collection<Class<?>> classes=get();
        exampleTree.setModel(createTreeModel(classes));
      }
 catch (      Exception e) {
        JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
    }
  }
.execute();
}
Program: 11681
Project: 11681
Buggy source:
private void selectClass(final Class<?> clazz){
  runExampleButton.setEnabled(false);
  new SwingWorker<String,Void>(){
    @Override protected String doInBackground() throws Exception {
      return getSource(clazz);
    }
    @Override protected void done(){
      try {
        codeArea.setText(get());
        exampleClass=clazz;
        runExampleButton.setEnabled(true);
      }
 catch (      Exception e) {
        JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
    }
  }
.execute();
}

Fixed version (ground truth):
private void selectClass(final Class<?> clazz){
  runExampleButton.setEnabled(false);
  if (clazz == null) {
    codeArea.setText(null);
    return;
  }
  new SwingWorker<String,Void>(){
    @Override protected String doInBackground() throws Exception {
      return getSource(clazz);
    }
    @Override protected void done(){
      try {
        codeArea.setText(get());
        codeArea.setCaretPosition(0);
        exampleClass=clazz;
        runExampleButton.setEnabled(true);
      }
 catch (      Exception e) {
        JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
    }
  }
.execute();
}
Program: 11682
Project: 11682
Buggy source:
private Collection<Class<?>> getExamples() throws ClassNotFoundException, IOException {
  List<Class<?>> exampleClasses=new ArrayList<Class<?>>();
  URL url=ExampleRunner.class.getResource(ExampleRunner.class.getSimpleName() + "String_Node_Str");
  URLConnection connection=url.openConnection();
  if (connection instanceof JarURLConnection) {
    JarFile jar=((JarURLConnection)connection).getJarFile();
    Enumeration<JarEntry> entries=jar.entries();
    while (entries.hasMoreElements()) {
      JarEntry entry=entries.nextElement();
      String name=entry.getName();
      if (name.endsWith("String_Node_Str")) {
        String className=name.replace('/','.').substring(0,name.length() - "String_Node_Str".length());
        Class<?> clazz=Class.forName(className);
        exampleClasses.add(clazz);
      }
    }
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return exampleClasses;
}

Fixed version (ground truth):
private Collection<Class<?>> getExamples() throws ClassNotFoundException, IOException {
  List<Class<?>> exampleClasses=new ArrayList<Class<?>>();
  URL url=ExampleRunner.class.getResource(ExampleRunner.class.getSimpleName() + "String_Node_Str");
  URLConnection connection=url.openConnection();
  if (connection instanceof JarURLConnection) {
    JarFile jar=((JarURLConnection)connection).getJarFile();
    Enumeration<JarEntry> entries=jar.entries();
    while (entries.hasMoreElements()) {
      JarEntry entry=entries.nextElement();
      String name=entry.getName();
      if (name.endsWith("String_Node_Str")) {
        String className=name.replace('/','.').substring(0,name.length() - "String_Node_Str".length());
        Class<?> clazz=Class.forName(className);
        if (clazz.getSimpleName().equals("String_Node_Str")) {
          continue;
        }
 else {
          exampleClasses.add(clazz);
        }
      }
    }
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  return exampleClasses;
}
Program: 11683
Project: 11683
Buggy source:
@Override protected void done(){
  try {
    codeArea.setText(get());
    exampleClass=clazz;
    runExampleButton.setEnabled(true);
  }
 catch (  Exception e) {
    JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
@Override protected void done(){
  try {
    codeArea.setText(get());
    codeArea.setCaretPosition(0);
    exampleClass=clazz;
    runExampleButton.setEnabled(true);
  }
 catch (  Exception e) {
    JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ExampleRunner.this),e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 11684
Project: 11684
Buggy source:
public static void main(String[] args){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception e) {
  }
  JFrame frame=new JFrame("String_Node_Str");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setPreferredSize(new Dimension(1280,800));
  ExampleRunner runnerPanel=new ExampleRunner();
  frame.setContentPane(runnerPanel);
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);
  runnerPanel.populateExamples();
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception e) {
  }
  final JFrame runnerFrame=new JFrame("String_Node_Str");
  runnerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  runnerFrame.setPreferredSize(new Dimension(1280,800));
  ExampleRunner runnerPanel=new ExampleRunner();
  runnerFrame.setContentPane(runnerPanel);
  runnerFrame.pack();
  runnerFrame.setLocationRelativeTo(null);
  runnerFrame.setVisible(true);
  runnerPanel.populateExamples();
  Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){
    @Override public void eventDispatched(    AWTEvent event){
      if (event instanceof WindowEvent) {
        Window window=((WindowEvent)event).getWindow();
        if (window != runnerFrame) {
          if (window instanceof JFrame) {
            JFrame frame=(JFrame)window;
            if (frame.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE) {
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            }
          }
 else           if (window instanceof JDialog) {
            JDialog dialog=(JDialog)window;
            if (dialog.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE) {
              dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            }
          }
        }
      }
    }
  }
,AWTEvent.WINDOW_EVENT_MASK);
}
Program: 11687
Project: 11687
Buggy source:
/** 
 * TODO Not yet tested
 */
public TranslationModel2D createInverse(){
  final TranslationModel2D ict=new TranslationModel2D();
  ict.tx=-tx;
  ict.ty=-ty;
  ict.cost=cost;
  return ict;
}

Fixed version (ground truth):
/** 
 * TODO Not yet tested
 */
@Override public TranslationModel2D createInverse(){
  final TranslationModel2D ict=new TranslationModel2D();
  ict.tx=-tx;
  ict.ty=-ty;
  ict.cost=cost;
  return ict;
}
Program: 11688
Project: 11688
Buggy source:
@Override public void toArray(final double[] data){
  data[0]=1;
  data[1]=0;
  data[2]=1;
  data[3]=0;
  data[4]=tx;
  data[5]=ty;
}

Fixed version (ground truth):
@Override public void toArray(final double[] data){
  data[0]=1;
  data[1]=0;
  data[2]=0;
  data[3]=1;
  data[4]=tx;
  data[5]=ty;
}
Program: 11689
Project: 11689
Buggy source:
public void estimateInverseBounds(float[] min,float[] max) throws NoninvertibleModelException {
  applyInverseInPlace(min);
  applyInverseInPlace(max);
}

Fixed version (ground truth):
@Override public void estimateInverseBounds(final float[] min,final float[] max) throws NoninvertibleModelException {
  applyInverseInPlace(min);
  applyInverseInPlace(max);
}
Program: 11690
Project: 11690
Buggy source:
/** 
 * TODO Not yet tested
 */
public TranslationModel3D createInverse(){
  final TranslationModel3D ict=new TranslationModel3D();
  ict.translation[0]=-translation[0];
  ict.translation[1]=-translation[1];
  ict.translation[2]=-translation[2];
  ict.cost=cost;
  return ict;
}

Fixed version (ground truth):
/** 
 * TODO Not yet tested
 */
@Override public TranslationModel3D createInverse(){
  final TranslationModel3D ict=new TranslationModel3D();
  ict.translation[0]=-translation[0];
  ict.translation[1]=-translation[1];
  ict.translation[2]=-translation[2];
  ict.cost=cost;
  return ict;
}
Program: 11691
Project: 11691
Buggy source:
public void estimateBounds(float[] min,float[] max){
  applyInPlace(min);
  applyInPlace(max);
}

Fixed version (ground truth):
@Override public void estimateBounds(final float[] min,final float[] max){
  applyInPlace(min);
  applyInPlace(max);
}
Program: 11692
Project: 11692
Buggy source:
@Override public void toMatrix(final double[][] data){
  data[0][0]=0;
  data[0][1]=0;
  data[0][2]=0;
  data[0][3]=translation[0];
  data[1][0]=0;
  data[1][1]=0;
  data[1][2]=0;
  data[1][3]=translation[1];
  data[2][0]=0;
  data[2][1]=0;
  data[2][2]=0;
  data[2][3]=translation[2];
}

Fixed version (ground truth):
@Override public void toMatrix(final double[][] data){
  data[0][0]=1;
  data[0][1]=0;
  data[0][2]=0;
  data[0][3]=translation[0];
  data[1][0]=0;
  data[1][1]=1;
  data[1][2]=0;
  data[1][3]=translation[1];
  data[2][0]=0;
  data[2][1]=0;
  data[2][2]=1;
  data[2][3]=translation[2];
}
Program: 11693
Project: 11693
Buggy source:
@Override public float[] getMatrix(final float[] m){
  final float[] a;
  if (m == null || m.length != 12)   a=new float[12];
 else   a=m;
  a[0]=0;
  a[1]=0;
  a[2]=0;
  a[3]=translation[0];
  a[4]=0;
  a[5]=0;
  a[6]=0;
  a[7]=translation[1];
  a[8]=0;
  a[9]=0;
  a[10]=0;
  a[11]=translation[2];
  return a;
}

Fixed version (ground truth):
@Override public float[] getMatrix(final float[] m){
  final float[] a;
  if (m == null || m.length != 12)   a=new float[12];
 else   a=m;
  a[0]=1;
  a[1]=0;
  a[2]=0;
  a[3]=translation[0];
  a[4]=0;
  a[5]=1;
  a[6]=0;
  a[7]=translation[1];
  a[8]=0;
  a[9]=0;
  a[10]=1;
  a[11]=translation[2];
  return a;
}
Program: 11694
Project: 11694
Buggy source:
@Override public void toArray(final double[] data){
  data[0]=0;
  data[1]=0;
  data[2]=0;
  data[3]=0;
  data[4]=0;
  data[5]=0;
  data[6]=0;
  data[7]=0;
  data[8]=0;
  data[9]=translation[0];
  data[10]=translation[1];
  data[11]=translation[2];
}

Fixed version (ground truth):
@Override public void toArray(final double[] data){
  data[0]=1;
  data[1]=0;
  data[2]=0;
  data[3]=0;
  data[4]=1;
  data[5]=0;
  data[6]=0;
  data[7]=0;
  data[8]=1;
  data[9]=translation[0];
  data[10]=translation[1];
  data[11]=translation[2];
}
Program: 11695
Project: 11695
Buggy source:
public TranslationModel3D copy(){
  final TranslationModel3D m=new TranslationModel3D();
  m.translation[0]=translation[0];
  m.translation[1]=translation[1];
  m.translation[2]=translation[2];
  m.cost=cost;
  return m;
}

Fixed version (ground truth):
@Override public TranslationModel3D copy(){
  final TranslationModel3D m=new TranslationModel3D();
  m.translation[0]=translation[0];
  m.translation[1]=translation[1];
  m.translation[2]=translation[2];
  m.cost=cost;
  return m;
}
Program: 11696
Project: 11696
Buggy source:
/** 
 * Performs one optimization step.
 * @param observer collecting the error after update
 * @throws NotEnoughDataPointsException
 */
protected void optimizeStep(final ErrorStatistic observer) throws NotEnoughDataPointsException {
  float maxSpeed=Float.MIN_VALUE;
  minForce=Double.MAX_VALUE;
  maxForce=0.0;
  force=0;
synchronized (this) {
    for (    final Vertex vertex : vertices) {
      vertex.update(damp);
      force+=vertex.getForce();
      final float speed=vertex.getSpeed();
      if (speed > maxSpeed)       maxSpeed=speed;
      if (force < minForce)       minForce=force;
      if (force > maxForce)       maxForce=force;
    }
    for (    final Vertex vertex : vertices)     vertex.move(Math.min(1000.0f,2.0f / maxSpeed));
    updateAffines();
    updatePassiveVertices();
  }
  observer.add(force);
}

Fixed version (ground truth):
/** 
 * Performs one optimization step.
 * @param observer collecting the error after update
 * @throws NotEnoughDataPointsException
 */
protected void optimizeStep(final ErrorStatistic observer) throws NotEnoughDataPointsException {
  maxSpeed=Double.MIN_VALUE;
  minForce=Double.MAX_VALUE;
  maxForce=0.0;
  force=0;
synchronized (this) {
    for (    final Vertex vertex : vertices) {
      vertex.update(damp);
      final float vertexForce=vertex.getForce();
      force+=vertexForce;
      final float speed=vertex.getSpeed();
      if (speed > maxSpeed)       maxSpeed=speed;
      if (vertexForce < minForce)       minForce=vertexForce;
      if (vertexForce > maxForce)       maxForce=vertexForce;
    }
    force/=vertices.size();
    for (    final Vertex vertex : vertices)     vertex.move(Math.min(1000.0f,(float)(2.0 / maxSpeed)));
    updateAffines();
    updatePassiveVertices();
  }
  observer.add(force);
}
Program: 11698
Project: 11698
Buggy source:
/** 
 * Smooth with a Gaussian kernel that represents downsampling at a given scale factor and sourceSigma.
 */
final static public void smoothForScale(final ImageProcessor source,final float scale,final float sourceSigma,final float targetSigma){
  if (scale >= 1.0f)   return;
  float s=targetSigma / scale;
  float sigma=(float)Math.sqrt(s * s - sourceSigma * sourceSigma);
  new GaussianBlur().blurGaussian(source,sigma,sigma,0.01);
}

Fixed version (ground truth):
/** 
 * Smooth with a Gaussian kernel that represents downsampling at a given scale factor and sourceSigma.
 */
final static public void smoothForScale(final ImageProcessor source,final float scale,final float sourceSigma,final float targetSigma){
  float s=targetSigma / scale;
  final float v=s * s - sourceSigma * sourceSigma;
  if (v <= 0)   return;
  final float sigma=(float)Math.sqrt(v);
  new GaussianBlur().blurGaussian(source,sigma,sigma,0.01);
}
Program: 11699
Project: 11699
Buggy source:
/** 
 * Create a downsampled ImageProcessor.
 * @param source the source image
 * @param scale scaling factor
 * @param sourceSigma the Gaussian at which the source was sampled (guess 0.5 if you do not know)
 * @param targetSigma the Gaussian at which the target will be sampled
 * @return a new {@link FloatProcessor}
 */
final static public ImageProcessor createDownsampled(final ImageProcessor source,final float scale,final float sourceSigma,final float targetSigma){
  final int ow=source.getWidth();
  final int oh=source.getHeight();
  final int w=Math.round(ow * scale);
  final int h=Math.round(oh * scale);
  final ImageProcessor temp=source.duplicate();
  temp.setMinAndMax(source.getMin(),source.getMax());
  if (scale >= 1.0f)   return temp;
  smoothForScale(temp,scale,sourceSigma,targetSigma);
  final ImageProcessor target=temp.resize(w,h);
  target.setMinAndMax(source.getMin(),source.getMax());
  return target;
}

Fixed version (ground truth):
/** 
 * Create a downsampled ImageProcessor.
 * @param source the source image
 * @param scale scaling factor
 * @param sourceSigma the Gaussian at which the source was sampled (guess 0.5 if you do not know)
 * @param targetSigma the Gaussian at which the target will be sampled
 * @return a new {@link FloatProcessor}
 */
final static public ImageProcessor createDownsampled(final ImageProcessor source,final float scale,final float sourceSigma,final float targetSigma){
  final int ow=source.getWidth();
  final int oh=source.getHeight();
  final int w=Math.round(ow * scale);
  final int h=Math.round(oh * scale);
  final ImageProcessor temp=source.duplicate();
  temp.setMinAndMax(source.getMin(),source.getMax());
  smoothForScale(temp,scale,sourceSigma,targetSigma);
  if (scale >= 1.0f)   return temp;
  final ImageProcessor target=temp.resize(w,h);
  target.setMinAndMax(source.getMin(),source.getMax());
  return target;
}
Program: 11700
Project: 11700
Buggy source:
@Override public void init(){
  ipOriginal=imp.getProcessor();
  if (imp.getType() == ImagePlus.GRAY32)   fp=(FloatProcessor)ipOriginal.duplicate();
 else   fp=(FloatProcessor)ipOriginal.convertToFloat();
  imp.setProcessor(fp);
  std=new BlockStatistics(fp);
}

Fixed version (ground truth):
@Override final protected void init(){
  ipOriginal=imp.getProcessor();
  if (imp.getType() == ImagePlus.GRAY32)   fp=(FloatProcessor)ipOriginal.duplicate();
 else   fp=(FloatProcessor)ipOriginal.convertToFloat();
  imp.setProcessor(fp);
  std=new BlockStatistics(fp);
}
Program: 11701
Project: 11701
Buggy source:
final static private int colorVector(float xs,float ys){
  xs/=maxDistance;
  ys/=maxDistance;
  final double a=Math.sqrt(xs * xs + ys * ys);
  if (a == 0.0)   return 0;
  double o=(Math.atan2(xs / a,ys / a) + Math.PI) / Math.PI * 3;
  final double r, g, b;
  if (o < 3)   r=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   r=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  o+=2;
  if (o >= 6)   o-=6;
  if (o < 3)   g=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   g=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  o+=2;
  if (o >= 6)   o-=6;
  if (o < 3)   b=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   b=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  return (((int)(r * 255) << 8) + (int)(g * 255) << 8) + (int)(b * 255);
}

Fixed version (ground truth):
final static private int colorVector(float xs,float ys){
  xs/=maxDistance;
  ys/=maxDistance;
  final double a=Math.sqrt(xs * xs + ys * ys);
  if (a == 0.0)   return 0;
  double o=(Math.atan2(xs / a,ys / a) + Math.PI) / Math.PI * 3;
  final double r, g, b;
  if (o < 3)   r=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   r=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  o+=2;
  if (o >= 6)   o-=6;
  if (o < 3)   g=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   g=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  o+=2;
  if (o >= 6)   o-=6;
  if (o < 3)   b=Math.min(1.0,Math.max(0.0,2.0 - o)) * a;
 else   b=Math.min(1.0,Math.max(0.0,o - 4.0)) * a;
  return ((((int)(r * 255) << 8) | (int)(g * 255)) << 8) | (int)(b * 255);
}
Program: 11702
Project: 11702
Buggy source:
final static private void algebraicToPolarAndColor(final byte[] ipXPixels,final byte[] ipYPixels,final float[] ipRPixels,final float[] ipPhiPixels,final int[] ipColorPixels,final double max){
  final int n=ipXPixels.length;
  for (int i=0; i < n; ++i) {
    final double x=ipXPixels[i] / max;
    final double y=ipYPixels[i] / max;
    final double r=Math.sqrt(x * x + y * y);
    final double phi=Math.atan2(x / r,y / r);
    ipRPixels[i]=(float)r;
    ipPhiPixels[i]=(float)phi;
    if (r == 0.0)     ipColorPixels[i]=0;
 else {
      final double red, green, blue;
      double o=(phi + Math.PI) / Math.PI * 3;
      if (o < 3)       red=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       red=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      o+=2;
      if (o >= 6)       o-=6;
      if (o < 3)       green=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       green=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      o+=2;
      if (o >= 6)       o-=6;
      if (o < 3)       blue=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       blue=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      ipColorPixels[i]=(((int)(red * 255) << 8) | (int)(green * 255) << 8) | (int)(blue * 255);
    }
  }
}

Fixed version (ground truth):
final static private void algebraicToPolarAndColor(final byte[] ipXPixels,final byte[] ipYPixels,final float[] ipRPixels,final float[] ipPhiPixels,final int[] ipColorPixels,final double max){
  final int n=ipXPixels.length;
  for (int i=0; i < n; ++i) {
    final double x=ipXPixels[i] / max;
    final double y=ipYPixels[i] / max;
    final double r=Math.sqrt(x * x + y * y);
    final double phi=Math.atan2(x / r,y / r);
    ipRPixels[i]=(float)r;
    ipPhiPixels[i]=(float)phi;
    if (r == 0.0)     ipColorPixels[i]=0;
 else {
      final double red, green, blue;
      double o=(phi + Math.PI) / Math.PI * 3;
      if (o < 3)       red=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       red=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      o+=2;
      if (o >= 6)       o-=6;
      if (o < 3)       green=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       green=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      o+=2;
      if (o >= 6)       o-=6;
      if (o < 3)       blue=Math.min(1.0,Math.max(0.0,2.0 - o)) * r;
 else       blue=Math.min(1.0,Math.max(0.0,o - 4.0)) * r;
      ipColorPixels[i]=((((int)(red * 255) << 8) | (int)(green * 255)) << 8) | (int)(blue * 255);
    }
  }
}
Program: 11704
Project: 11704
Buggy source:
@Override final public void set(final HomographyModel2D m){
  m00=m.m00;
  m01=m.m01;
  m02=m.m02;
  m10=m.m00;
  m11=m.m11;
  m12=m.m12;
  m20=m.m20;
  m21=m.m21;
  m22=m.m22;
  i00=m.i00;
  i01=m.i01;
  i02=m.i02;
  i10=m.i00;
  i11=m.i11;
  i12=m.i12;
  i20=m.i20;
  i21=m.i21;
  i22=m.i22;
  cost=m.getCost();
}

Fixed version (ground truth):
@Override final public void set(final HomographyModel2D m){
  m00=m.m00;
  m01=m.m01;
  m02=m.m02;
  m10=m.m10;
  m11=m.m11;
  m12=m.m12;
  m20=m.m20;
  m21=m.m21;
  m22=m.m22;
  i00=m.i00;
  i01=m.i01;
  i02=m.i02;
  i10=m.i10;
  i11=m.i11;
  i12=m.i12;
  i20=m.i20;
  i21=m.i21;
  i22=m.i22;
  cost=m.getCost();
}
Program: 11705
Project: 11705
Buggy source:
public void estimateInverseBounds(final float[] min,final float[] max) throws NoninvertibleModelException {
}

Fixed version (ground truth):
@Override public void estimateInverseBounds(final float[] min,final float[] max) throws NoninvertibleModelException {
}
Program: 11706
Project: 11706
Buggy source:
final private float[] fitToUnitSquare(final float[] p1,final float[] p2,final float[] p3,final float[] p4){
  final float x1=p1[0];
  final float x2=p2[0];
  final float x3=p3[0];
  final float x4=p4[0];
  final float y1=p1[1];
  final float y2=p2[1];
  final float y3=p3[1];
  final float y4=p4[1];
  final float s=(x2 - x3) * (y4 - y3) - (x4 - x3) * (y2 - y3);
  final float b00, b01, b02, b10, b11, b12, b20, b21, b22;
  b20=((x1 - x2 + x3 - x4) * (y4 - y3) - (y1 - y2 + y3 - y4) * (x4 - x3)) / s;
  b21=((y1 - y2 + y3 - y4) * (x2 - x3) - (x1 - x2 + x3 - x4) * (y2 - y3)) / s;
  b00=x2 - x1 + b20 * x2;
  b01=x4 - x1 + b21 * x4;
  b02=x1;
  b10=y2 - y1 + b20 * y2;
  b11=y4 - y1 + b21 * y4;
  b12=y1;
  b22=1;
  return new float[]{b00,b01,b02,b10,b11,b12,b20,b21,b22};
}

Fixed version (ground truth):
final static private float[] fitToUnitSquare(final float[] p1,final float[] p2,final float[] p3,final float[] p4){
  final float x1=p1[0];
  final float x2=p2[0];
  final float x3=p3[0];
  final float x4=p4[0];
  final float y1=p1[1];
  final float y2=p2[1];
  final float y3=p3[1];
  final float y4=p4[1];
  final float s=(x2 - x3) * (y4 - y3) - (x4 - x3) * (y2 - y3);
  final float b00, b01, b02, b10, b11, b12, b20, b21, b22;
  b20=((x1 - x2 + x3 - x4) * (y4 - y3) - (y1 - y2 + y3 - y4) * (x4 - x3)) / s;
  b21=((y1 - y2 + y3 - y4) * (x2 - x3) - (x1 - x2 + x3 - x4) * (y2 - y3)) / s;
  b00=x2 - x1 + b20 * x2;
  b01=x4 - x1 + b21 * x4;
  b02=x1;
  b10=y2 - y1 + b20 * y2;
  b11=y4 - y1 + b21 * y4;
  b12=y1;
  b22=1;
  return new float[]{b00,b01,b02,b10,b11,b12,b20,b21,b22};
}
Program: 11707
Project: 11707
Buggy source:
public void estimateBounds(final float[] min,final float[] max){
}

Fixed version (ground truth):
@Override public void estimateBounds(final float[] min,final float[] max){
}
Program: 11708
Project: 11708
Buggy source:
@Override final public HomographyModel2D copy(){
  final HomographyModel2D m=new HomographyModel2D();
  m.m00=m00;
  m.m01=m01;
  m.m02=m02;
  m.m10=m00;
  m.m11=m11;
  m.m12=m12;
  m.m20=m20;
  m.m21=m21;
  m.m22=m22;
  m.i00=i00;
  m.i01=i01;
  m.i02=i02;
  m.i10=i00;
  m.i11=i11;
  m.i12=i12;
  m.i20=i20;
  m.i21=i21;
  m.i22=i22;
  m.cost=getCost();
  return m;
}

Fixed version (ground truth):
@Override final public HomographyModel2D copy(){
  final HomographyModel2D m=new HomographyModel2D();
  m.m00=m00;
  m.m01=m01;
  m.m02=m02;
  m.m10=m10;
  m.m11=m11;
  m.m12=m12;
  m.m20=m20;
  m.m21=m21;
  m.m22=m22;
  m.i00=i00;
  m.i01=i01;
  m.i02=i02;
  m.i10=i10;
  m.i11=i11;
  m.i12=i12;
  m.i20=i20;
  m.i21=i21;
  m.i22=i22;
  m.cost=getCost();
  return m;
}
Program: 11711
Project: 11711
Buggy source:
final static protected void subtractShifted(final FloatProcessor a,final FloatProcessor b,final FloatProcessor c,final int xo,final int yo){
  final float[] af=(float[])a.getPixels();
  final float[] bf=(float[])b.getPixels();
  final float[] cf=(float[])c.getPixels();
  final int w=a.getWidth();
  final int h=a.getHeight();
  for (int y=0; y < h; ++y) {
    int yb=y + yo;
    if (yb < 0 || yb >= h)     yb=pingPong(yb,h);
    final int yAdd=y * w;
    final int ybAdd=yb * w;
    for (int x=0; x < a.getWidth(); ++x) {
      int xb=x + xo;
      if (xb < 0 || xb >= w)       xb=pingPong(xb,h);
      final int i=yAdd + x;
      final float d=bf[ybAdd + xb] - af[i];
      cf[i]=d * d;
    }
  }
}

Fixed version (ground truth):
final static protected void subtractShifted(final FloatProcessor a,final FloatProcessor b,final FloatProcessor c,final int xo,final int yo){
  final float[] af=(float[])a.getPixels();
  final float[] bf=(float[])b.getPixels();
  final float[] cf=(float[])c.getPixels();
  final int w=a.getWidth();
  final int h=a.getHeight();
  for (int y=0; y < h; ++y) {
    int yb=y + yo;
    if (yb < 0 || yb >= h)     yb=pingPong(yb,h);
    final int yAdd=y * w;
    final int ybAdd=yb * w;
    for (int x=0; x < a.getWidth(); ++x) {
      int xb=x + xo;
      if (xb < 0 || xb >= w)       xb=pingPong(xb,w);
      final int i=yAdd + x;
      final float d=bf[ybAdd + xb] - af[i];
      cf[i]=d * d;
    }
  }
}
Program: 11712
Project: 11712
Buggy source:
final public void add(double new_value){
  if (values.size() > 1)   slope.add(new_value - values.get(values.size() - 1));
 else   slope.add(0.0);
  mean=(mean * values.size() + new_value);
  values.add(new_value);
  mean/=values.size();
  var0+=new_value * new_value / (double)(values.size());
  std0=Math.sqrt(var0);
  double tmp=new_value - mean;
  var+=tmp * tmp / (double)(values.size());
  std=Math.sqrt(var);
  Collections.sort(values);
  if (values.size() % 2 == 0) {
    int m=values.size() / 2;
    median=(values.get(m - 1) + values.get(m)) / 2.0;
  }
 else   median=values.get(values.size() / 2);
  if (new_value < min)   min=new_value;
  if (new_value > max)   max=new_value;
}

Fixed version (ground truth):
final public void add(double new_value){
  if (values.size() > 1)   slope.add(new_value - values.get(values.size() - 1));
 else   slope.add(0.0);
  mean=(mean * values.size() + new_value);
  values.add(new_value);
  mean/=values.size();
  var0+=new_value * new_value / (double)(values.size());
  std0=Math.sqrt(var0);
  double tmp=new_value - mean;
  var+=tmp * tmp / (double)(values.size());
  std=Math.sqrt(var);
  sortedValues.add(new_value);
  Collections.sort(sortedValues);
  if (sortedValues.size() % 2 == 0) {
    int m=sortedValues.size() / 2;
    median=(sortedValues.get(m - 1) + sortedValues.get(m)) / 2.0;
  }
 else   median=sortedValues.get(sortedValues.size() / 2);
  if (new_value < min)   min=new_value;
  if (new_value > max)   max=new_value;
}
Program: 11713
Project: 11713
Buggy source:
final public void add(double new_value){
  if (values.size() > 1)   slope.add(new_value - values.get(values.size() - 1));
 else   slope.add(0.0);
  mean=(mean * values.size() + new_value);
  values.add(new_value);
  mean/=values.size();
  var0+=new_value * new_value / (double)(values.size());
  std0=Math.sqrt(var0);
  double tmp=new_value - mean;
  var+=tmp * tmp / (double)(values.size());
  std=Math.sqrt(var);
  sortedValues.add(new_value);
  Collections.sort(sortedValues);
  if (sortedValues.size() % 2 == 0) {
    int m=sortedValues.size() / 2;
    median=(sortedValues.get(m - 1) + sortedValues.get(m)) / 2.0;
  }
 else   median=sortedValues.get(sortedValues.size() / 2);
  if (new_value < min)   min=new_value;
  if (new_value > max)   max=new_value;
}

Fixed version (ground truth):
final public void add(double new_value){
  if (values.size() > 1)   slope.add(new_value - values.get(values.size() - 1));
 else   slope.add(0.0);
  mean=(mean * values.size() + new_value);
  values.add(new_value);
  mean/=values.size();
  var0+=new_value * new_value / (double)(values.size() - 1);
  std0=Math.sqrt(var0);
  double tmp=new_value - mean;
  var+=tmp * tmp / (double)(values.size() - 1);
  std=Math.sqrt(var);
  sortedValues.add(new_value);
  Collections.sort(sortedValues);
  if (sortedValues.size() % 2 == 0) {
    int m=sortedValues.size() / 2;
    median=(sortedValues.get(m - 1) + sortedValues.get(m)) / 2.0;
  }
 else   median=sortedValues.get(sortedValues.size() / 2);
  if (new_value < min)   min=new_value;
  if (new_value > max)   max=new_value;
}
Program: 11714
Project: 11714
Buggy source:
final public double getWideSlope(int width) throws IndexOutOfBoundsException {
  if (width > slope.size())   throw new IndexOutOfBoundsException("String_Node_Str");
  ListIterator<Double> li=slope.listIterator(slope.size() - 1);
  int i=0;
  double s=0.0;
  while (i < width && li.hasPrevious()) {
    s+=li.previous();
  }
  s/=(double)width;
  return s;
}

Fixed version (ground truth):
final public double getWideSlope(int width) throws IndexOutOfBoundsException {
  if (width > slope.size())   throw new IndexOutOfBoundsException("String_Node_Str");
  ListIterator<Double> li=slope.listIterator(slope.size() - 1);
  int i=0;
  double s=0.0;
  while (i < width && li.hasPrevious()) {
    s+=li.previous();
    ++i;
  }
  s/=(double)width;
  return s;
}
Program: 11716
Project: 11716
Buggy source:
/** 
 * Sets the object at the index of the last call to   {@link #next() next} or {@link #previous previous}. This implementation delegates to   {@link AbstractEList#set set}.
 * @param object the object to set.
 * @exception IllegalStateException if <code>next</code> or <code>previous</code> have not yet been called, or  {@link #remove(Object) remove} or {@link #add add} have already been calledafter the last call to <code>next</code> or <code>previous</code>.
 */
protected void doSet(E object){
  if (lastCursor == -1) {
    throw new IllegalStateException();
  }
  checkModCount();
  try {
    AbstractEList.this.set(lastCursor,object);
  }
 catch (  IndexOutOfBoundsException exception) {
    throw new ConcurrentModificationException();
  }
}

Fixed version (ground truth):
/** 
 * Sets the object at the index of the last call to   {@link #next() next} or {@link #previous previous}. This implementation delegates to   {@link AbstractEList#set set}.
 * @param object the object to set.
 * @exception IllegalStateException if <code>next</code> or <code>previous</code> have not yet been called, or  {@link #remove(Object) remove} or {@link #add add} have already been calledafter the last call to <code>next</code> or <code>previous</code>.
 */
protected void doSet(E object){
  if (lastCursor == -1) {
    throw new IllegalStateException();
  }
  checkModCount();
  try {
    AbstractEList.this.set(lastCursor,object);
    expectedModCount=modCount;
  }
 catch (  IndexOutOfBoundsException exception) {
    throw new ConcurrentModificationException();
  }
}
Program: 11717
Project: 11717
Buggy source:
/** 
 * Removes the object at the index from the list and returns it. This implementation delegates to   {@link #didRemove didRemove} and {@link #didChange didChange}.
 * @param index the position of the object to remove.
 * @return the removed object.
 * @exception IndexOutOfBoundsException if the index isn't within the size range.
 */
@SuppressWarnings("String_Node_Str") @Override public E remove(int index){
  Object[] data=data();
  int size=data == null ? 0 : data.length;
  if (index >= size)   throw new BasicIndexOutOfBoundsException(index,size);
  @SuppressWarnings("String_Node_Str") E oldObject=(E)data[index];
  Object[] newData;
  if (size == 1) {
    newData=null;
  }
 else {
    newData=newData(size - 1);
    System.arraycopy(data,0,newData,0,index);
    int shifted=size - index - 1;
    if (shifted > 0) {
      System.arraycopy(data,index + 1,newData,index,shifted);
    }
  }
  setData(newData);
  didRemove(index,oldObject);
  didChange();
  return oldObject;
}

Fixed version (ground truth):
@Override public void remove(){
  super.remove();
  expectedData=data();
}