nus-yam/ex-repair huggingface dataset:
Program: 31069
Project: 31069
Buggy source:
private String GetBin(long value,int nr_of_bits){
  StringBuffer Bits=new StringBuffer();
  long mask=(1 << (nr_of_bits - 1));
  int count;
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  for (count=0; count < nr_of_bits; count++) {
    if ((value & mask) != 0)     Bits.append("String_Node_Str");
 else     Bits.append("String_Node_Str");
    mask>>=1;
  }
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  return Bits.toString();
}

Fixed version (ground truth):
private String GetBin(long value,int nr_of_bits){
  StringBuffer Bits=new StringBuffer();
  long mask=(1L << (nr_of_bits - 1));
  int count;
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  for (count=0; count < nr_of_bits; count++) {
    if ((value & mask) != 0)     Bits.append("String_Node_Str");
 else     Bits.append("String_Node_Str");
    mask>>=1;
  }
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  return Bits.toString();
}
Program: 31070
Project: 31070
Buggy source:
private String GetBin(long value,int nr_of_bits){
  StringBuffer Bits=new StringBuffer();
  long mask=(1 << (nr_of_bits - 1));
  int count;
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  for (count=0; count < nr_of_bits; count++) {
    if ((value & mask) != 0)     Bits.append("String_Node_Str");
 else     Bits.append("String_Node_Str");
    mask>>=1;
  }
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  return Bits.toString();
}

Fixed version (ground truth):
private String GetBin(long value,int nr_of_bits){
  StringBuffer Bits=new StringBuffer();
  long mask=(1L << (nr_of_bits - 1));
  int count;
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  for (count=0; count < nr_of_bits; count++) {
    if ((value & mask) != 0)     Bits.append("String_Node_Str");
 else     Bits.append("String_Node_Str");
    mask>>=1;
  }
  if (nr_of_bits == 1)   Bits.append("String_Node_Str");
 else   Bits.append("String_Node_Str");
  return Bits.toString();
}
Program: 31071
Project: 31071
Buggy source:
public static void main(String[] args) throws Exception {
  Startup startup=Startup.parseArgs(args);
  if (startup == null) {
    System.exit(0);
  }
 else {
    if (!startup.autoUpdate()) {
      try {
        startup.run();
      }
 catch (      Throwable e) {
        Writer result=new StringWriter();
        PrintWriter printWriter=new PrintWriter(result);
        e.printStackTrace(printWriter);
        ScaledOptionPane.showMessageDialog(null,result.toString());
        System.exit(-1);
      }
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Startup startup=Startup.parseArgs(args);
  if (startup == null) {
    System.exit(0);
  }
 else {
    if (!startup.autoUpdate()) {
      try {
        startup.run();
      }
 catch (      Throwable e) {
        Writer result=new StringWriter();
        PrintWriter printWriter=new PrintWriter(result);
        e.printStackTrace(printWriter);
        JOptionPane.showMessageDialog(null,result.toString());
        System.exit(-1);
      }
    }
  }
}
Program: 31072
Project: 31072
Buggy source:
public void setDimensions(int addrBits,int width,boolean IsRom){
  if (addrBits == this.addrBits && width == this.width)   return;
  this.addrBits=addrBits;
  this.width=width;
  this.mask=width == 32 ? 0xffffffff : ((1 << width) - 1);
  MemContentsSub.ContentsInterface[] oldPages=pages;
  int pageCount;
  int pageLength;
  if (addrBits < PAGE_SIZE_BITS) {
    pageCount=1;
    pageLength=1 << addrBits;
  }
 else {
    pageCount=1 << (addrBits - PAGE_SIZE_BITS);
    pageLength=PAGE_SIZE;
  }
  pages=new MemContentsSub.ContentsInterface[pageCount];
  if (oldPages != null) {
    int n=Math.min(oldPages.length,pages.length);
    for (int i=0; i < n; i++) {
      if (oldPages[i] != null) {
        pages[i]=MemContentsSub.createContents(pageLength,width);
        int m=Math.max(oldPages[i].getLength(),pageLength);
        for (int j=0; j < m; j++) {
          pages[i].set(j,oldPages[i].get(j));
        }
      }
    }
  }
 else   if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
    for (int i=0; i < pageCount; i++)     pages[i]=MemContentsSub.createContents(pageLength,width);
  }
  if (pageCount == 0 && pages[0] == null) {
    pages[0]=MemContentsSub.createContents(pageLength,width);
  }
  fireMetainfoChanged();
}

Fixed version (ground truth):
public void setDimensions(int addrBits,int width,boolean IsRom){
  if (addrBits == this.addrBits && width == this.width)   return;
  this.addrBits=addrBits;
  this.width=width;
  this.mask=width == 32 ? 0xffffffff : ((1 << width) - 1);
  MemContentsSub.ContentsInterface[] oldPages=pages;
  int pageCount;
  int pageLength;
  if (addrBits < PAGE_SIZE_BITS) {
    pageCount=1;
    pageLength=1 << addrBits;
  }
 else {
    pageCount=1 << (addrBits - PAGE_SIZE_BITS);
    pageLength=PAGE_SIZE;
  }
  pages=new MemContentsSub.ContentsInterface[pageCount];
  if (oldPages != null) {
    int n=Math.min(oldPages.length,pages.length);
    for (int i=0; i < n; i++) {
      if (oldPages[i] != null) {
        pages[i]=MemContentsSub.createContents(pageLength,width);
        int m=Math.min(oldPages[i].getLength(),pageLength);
        for (int j=0; j < m; j++) {
          pages[i].set(j,oldPages[i].get(j));
        }
      }
    }
    if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
      for (int i=oldPages.length; i < pages.length; i++)       pages[i]=MemContentsSub.createContents(pageLength,width);
    }
  }
 else   if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
    for (int i=0; i < pageCount; i++)     pages[i]=MemContentsSub.createContents(pageLength,width);
  }
  if (pageCount == 0 && pages[0] == null) {
    pages[0]=MemContentsSub.createContents(pageLength,width);
  }
  fireMetainfoChanged();
}
Program: 31074
Project: 31074
Buggy source:
boolean concernsSupercircuit(){
switch (type) {
case CLEAR:
    return true;
case ADD:
case REMOVE:
  return comp.getFactory() instanceof Pin;
case ADD_ALL:
case REMOVE_ALL:
for (Component comp : comps) {
  if (comp.getFactory() instanceof Pin)   return true;
}
return false;
case REPLACE:
ReplacementMap repl=(ReplacementMap)newValue;
for (Component comp : repl.getRemovals()) {
if (comp.getFactory() instanceof Pin) return true;
}
for (Component comp : repl.getAdditions()) {
if (comp.getFactory() instanceof Pin) return true;
}
return false;
case SET:
return comp.getFactory() instanceof Pin && (attr == StdAttr.WIDTH || attr == Pin.ATTR_TYPE);
case SET_FOR_CIRCUIT:
return (attr == CircuitAttributes.NAME_ATTR || attr == CircuitAttributes.NAMED_CIRCUIT_BOX);
default :
return false;
}
}

Fixed version (ground truth):
boolean concernsSupercircuit(){
switch (type) {
case CLEAR:
    return true;
case ADD:
case REMOVE:
  return comp.getFactory() instanceof Pin;
case ADD_ALL:
case REMOVE_ALL:
for (Component comp : comps) {
  if (comp.getFactory() instanceof Pin)   return true;
}
return false;
case REPLACE:
ReplacementMap repl=(ReplacementMap)newValue;
for (Component comp : repl.getRemovals()) {
if (comp.getFactory() instanceof Pin) return true;
}
for (Component comp : repl.getAdditions()) {
if (comp.getFactory() instanceof Pin) return true;
}
return false;
case SET:
return comp.getFactory() instanceof Pin && (attr == StdAttr.WIDTH || attr == Pin.ATTR_TYPE || attr == StdAttr.LABEL);
case SET_FOR_CIRCUIT:
return (attr == CircuitAttributes.NAME_ATTR || attr == CircuitAttributes.NAMED_CIRCUIT_BOX);
default :
return false;
}
}
Program: 31076
Project: 31076
Buggy source:
MessageDialog(Component parentComponent,Object message,String title,Icon icon){
  super();
  super.addKeyListener(this);
  if (parentComponent != null)   parentComponent.addComponentListener(this);
  setModal(true);
  setResizable(false);
  GridBagLayout thisLayout=new GridBagLayout();
  GridBagConstraints gbc=new GridBagConstraints();
  setLayout(thisLayout);
  setTitle(title);
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=1;
  if (message instanceof JScrollPane)   add((JScrollPane)message,gbc);
 else   if (message instanceof JPanel)   add((JPanel)message,gbc);
 else   add(new ScaledLabel(message.toString(),icon,JLabel.LEFT),gbc);
  gbc.gridy=1;
  add(new ScaledLabel("String_Node_Str"),gbc);
  gbc.gridy=2;
  OKButton=new ScaledButton("String_Node_Str");
  OKButton.setActionCommand("String_Node_Str");
  OKButton.addActionListener(this);
  OKButton.addKeyListener(this);
  add(OKButton,gbc);
  gbc.gridy=3;
  add(new ScaledLabel("String_Node_Str"),gbc);
  pack();
  setPreferredSize(new Dimension(getWidth() + 2 * AppPreferences.getScaled(getFont().getSize()),getHeight()));
  pack();
  if (parentComponent != null)   this.setLocationRelativeTo(parentComponent);
 else {
    PointerInfo mouseloc=MouseInfo.getPointerInfo();
    Point mlocation=mouseloc.getLocation();
    int xpos=mlocation.x;
    int ypos=mlocation.y;
    xpos-=getWidth() >> 1;
    ypos-=getHeight() >> 1;
    if (xpos < 0)     xpos=0;
    if (ypos < 0)     ypos=0;
    setLocation(xpos,ypos);
  }
}

Fixed version (ground truth):
MessageDialog(Component parentComponent,Object message,String title,Icon icon){
  super();
  super.addKeyListener(this);
  if (parentComponent != null)   parentComponent.addComponentListener(this);
  setModal(true);
  setResizable(false);
  GridBagLayout thisLayout=new GridBagLayout();
  GridBagConstraints gbc=new GridBagConstraints();
  setLayout(thisLayout);
  setTitle(title);
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=1;
  if (message instanceof JScrollPane)   add((JScrollPane)message,gbc);
 else   if (message instanceof JPanel)   add((JPanel)message,gbc);
 else   add(new ScaledLabel(message.toString(),icon,JLabel.LEFT),gbc);
  gbc.gridy=1;
  add(new ScaledLabel("String_Node_Str"),gbc);
  gbc.gridy=2;
  OKButton=new ScaledButton("String_Node_Str");
  OKButton.setActionCommand("String_Node_Str");
  OKButton.addActionListener(this);
  OKButton.addKeyListener(this);
  add(OKButton,gbc);
  gbc.gridy=3;
  add(new ScaledLabel("String_Node_Str"),gbc);
  pack();
  setSize(new Dimension(getWidth() + 2 * AppPreferences.getScaled(getFont().getSize()),getHeight()));
  pack();
  if (parentComponent != null)   this.setLocationRelativeTo(parentComponent);
 else {
    PointerInfo mouseloc=MouseInfo.getPointerInfo();
    Point mlocation=mouseloc.getLocation();
    int xpos=mlocation.x;
    int ypos=mlocation.y;
    xpos-=getWidth() >> 1;
    ypos-=getHeight() >> 1;
    if (xpos < 0)     xpos=0;
    if (ypos < 0)     ypos=0;
    setLocation(xpos,ypos);
  }
}
Program: 31078
Project: 31078
Buggy source:
public Dimension getDimension(Object orientation){
  if (icon == null) {
    return new Dimension(AppPreferences.getScaled(AppPreferences.IconSize),AppPreferences.getScaled(AppPreferences.IconSize));
  }
 else {
    return new Dimension(AppPreferences.getScaled(icon.getIconWidth() + 8),AppPreferences.getScaled(icon.getIconHeight() + 8));
  }
}

Fixed version (ground truth):
public Dimension getDimension(Object orientation){
  if (icon == null) {
    return new Dimension(AppPreferences.getScaled(AppPreferences.IconSize),AppPreferences.getScaled(AppPreferences.IconSize));
  }
 else {
    return new Dimension(icon.getIconWidth() + 4 * AppPreferences.IconBorder,icon.getIconHeight() + 4 * AppPreferences.IconBorder);
  }
}
Program: 31080
Project: 31080
Buggy source:
MessageDialog(Component parentComponent,Object message,String title,Icon icon){
  super();
  super.addKeyListener(this);
  if (parentComponent != null)   parentComponent.addComponentListener(this);
  setModal(true);
  setResizable(false);
  GridBagLayout thisLayout=new GridBagLayout();
  GridBagConstraints gbc=new GridBagConstraints();
  setLayout(thisLayout);
  setTitle(title);
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=1;
  if (message instanceof JScrollPane)   add((JScrollPane)message,gbc);
 else   if (message instanceof JPanel)   add((JPanel)message,gbc);
 else   add(new ScaledLabel(message.toString(),icon,JLabel.LEFT),gbc);
  gbc.gridy=1;
  add(new ScaledLabel("String_Node_Str"),gbc);
  gbc.gridy=2;
  OKButton=new ScaledButton("String_Node_Str");
  OKButton.setActionCommand("String_Node_Str");
  OKButton.addActionListener(this);
  OKButton.addKeyListener(this);
  add(OKButton,gbc);
  gbc.gridy=3;
  add(new ScaledLabel("String_Node_Str"),gbc);
  pack();
  setPreferredSize(new Dimension(getWidth() + 2 * AppPreferences.getScaled(getFont().getSize()),getHeight()));
  pack();
  if (parentComponent != null)   this.setLocationRelativeTo(parentComponent);
 else {
    PointerInfo mouseloc=MouseInfo.getPointerInfo();
    Point mlocation=mouseloc.getLocation();
    int xpos=mlocation.x;
    int ypos=mlocation.y;
    xpos-=getWidth() >> 1;
    ypos-=getHeight() >> 1;
    if (xpos < 0)     xpos=0;
    if (ypos < 0)     ypos=0;
    setLocation(xpos,ypos);
  }
}

Fixed version (ground truth):
MessageDialog(Component parentComponent,Object message,String title,Icon icon){
  super();
  super.addKeyListener(this);
  if (parentComponent != null)   parentComponent.addComponentListener(this);
  setModal(true);
  setResizable(false);
  GridBagLayout thisLayout=new GridBagLayout();
  GridBagConstraints gbc=new GridBagConstraints();
  setLayout(thisLayout);
  setTitle(title);
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=1;
  if (message instanceof JScrollPane)   add((JScrollPane)message,gbc);
 else   if (message instanceof JPanel)   add((JPanel)message,gbc);
 else   add(new ScaledLabel(message.toString(),icon,JLabel.LEFT),gbc);
  gbc.gridy=1;
  add(new ScaledLabel("String_Node_Str"),gbc);
  gbc.gridy=2;
  OKButton=new ScaledButton("String_Node_Str");
  OKButton.setActionCommand("String_Node_Str");
  OKButton.addActionListener(this);
  OKButton.addKeyListener(this);
  add(OKButton,gbc);
  gbc.gridy=3;
  add(new ScaledLabel("String_Node_Str"),gbc);
  pack();
  setSize(new Dimension(getWidth() + 2 * AppPreferences.getScaled(getFont().getSize()),getHeight()));
  pack();
  if (parentComponent != null)   this.setLocationRelativeTo(parentComponent);
 else {
    PointerInfo mouseloc=MouseInfo.getPointerInfo();
    Point mlocation=mouseloc.getLocation();
    int xpos=mlocation.x;
    int ypos=mlocation.y;
    xpos-=getWidth() >> 1;
    ypos-=getHeight() >> 1;
    if (xpos < 0)     xpos=0;
    if (ypos < 0)     ypos=0;
    setLocation(xpos,ypos);
  }
}
Program: 31083
Project: 31083
Buggy source:
public void actionPerformed(ActionEvent e){
  if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=true;
    panel.setVisible(false);
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    if (ScaleButton.getText().equals("String_Node_Str")) {
      scale=2;
      ScaleButton.setText("String_Node_Str");
    }
 else     if (ScaleButton.getText().equals("String_Node_Str")) {
      scale=3;
      ScaleButton.setText("String_Node_Str");
    }
 else {
      scale=1;
      ScaleButton.setText("String_Node_Str");
    }
    BoardPic.setPreferredSize(new Dimension(BoardPic.getWidth(),BoardPic.getHeight()));
    UnMappedPane.setPreferredSize(new Dimension((BoardPic.getWidth() * 2) / 5,175));
    MappedPane.setPreferredSize(new Dimension((BoardPic.getWidth() * 2) / 5,175));
    panel.pack();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    UnMapAll();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    UnMapOne();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    Save();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    Load();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    panel.dispose();
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=true;
    panel.setVisible(false);
    ResetScale();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    if (ScaleButton.getText().equals("String_Node_Str")) {
      scale=2;
      ScaleButton.setText("String_Node_Str");
    }
 else     if (ScaleButton.getText().equals("String_Node_Str")) {
      scale=3;
      ScaleButton.setText("String_Node_Str");
    }
 else {
      scale=1;
      ScaleButton.setText("String_Node_Str");
    }
    BoardPic.setPreferredSize(new Dimension(BoardPic.getWidth(),BoardPic.getHeight()));
    UnMappedPane.setPreferredSize(new Dimension((BoardPic.getWidth() * 2) / 5,175));
    MappedPane.setPreferredSize(new Dimension((BoardPic.getWidth() * 2) / 5,175));
    panel.pack();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    UnMapAll();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    UnMapOne();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    Save();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    Load();
  }
 else   if (e.getActionCommand().equals("String_Node_Str")) {
    doneAssignment=false;
    ResetScale();
    panel.dispose();
  }
}
Program: 31084
Project: 31084
Buggy source:
public static void main(String[] args) throws Exception {
  Startup startup=Startup.parseArgs(args);
  if (startup == null) {
    System.exit(0);
  }
 else {
    if (!startup.autoUpdate()) {
      try {
        startup.run();
      }
 catch (      Throwable e) {
        Writer result=new StringWriter();
        PrintWriter printWriter=new PrintWriter(result);
        e.printStackTrace(printWriter);
        ScaledOptionPane.showMessageDialog(null,result.toString());
        System.exit(-1);
      }
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Startup startup=Startup.parseArgs(args);
  if (startup == null) {
    System.exit(0);
  }
 else {
    if (!startup.autoUpdate()) {
      try {
        startup.run();
      }
 catch (      Throwable e) {
        Writer result=new StringWriter();
        PrintWriter printWriter=new PrintWriter(result);
        e.printStackTrace(printWriter);
        JOptionPane.showMessageDialog(null,result.toString());
        System.exit(-1);
      }
    }
  }
}
Program: 31085
Project: 31085
Buggy source:
@Override public void paintInstance(InstancePainter painter){
  painter.drawLabel();
  int xpos=painter.getLocation().getX();
  int ypos=painter.getLocation().getY();
  BitWidth widObj=painter.getAttributeValue(StdAttr.WIDTH);
  int wid=widObj.getWidth();
  Integer lenObj=painter.getAttributeValue(ATTR_LENGTH);
  int len=lenObj == null ? 8 : lenObj.intValue();
  Boolean parallelObj=painter.getAttributeValue(ATTR_LOAD);
  Boolean Negedge=painter.getAttributeValue(StdAttr.EDGE_TRIGGER).equals(StdAttr.TRIG_FALLING);
  DrawControl(painter,xpos,ypos,len,wid,parallelObj,Negedge);
  ShiftRegisterData data=(ShiftRegisterData)painter.getData();
  for (int stage=0; stage < len; stage++) {
    DrawDataBlock(painter,xpos,ypos,len,wid,stage,data.get(len - stage - 1).toIntValue(),parallelObj);
  }
}

Fixed version (ground truth):
@Override public void paintInstance(InstancePainter painter){
  painter.drawLabel();
  int xpos=painter.getLocation().getX();
  int ypos=painter.getLocation().getY();
  BitWidth widObj=painter.getAttributeValue(StdAttr.WIDTH);
  int wid=widObj.getWidth();
  Integer lenObj=painter.getAttributeValue(ATTR_LENGTH);
  int len=lenObj == null ? 8 : lenObj.intValue();
  Boolean parallelObj=painter.getAttributeValue(ATTR_LOAD);
  Boolean Negedge=painter.getAttributeValue(StdAttr.EDGE_TRIGGER).equals(StdAttr.TRIG_FALLING);
  DrawControl(painter,xpos,ypos,len,wid,parallelObj,Negedge);
  ShiftRegisterData data=(ShiftRegisterData)painter.getData();
  if (data == null) {
    for (int stage=0; stage < len; stage++) {
      DrawDataBlock(painter,xpos,ypos,len,wid,stage,data.get(len - stage - 1).toIntValue(),parallelObj);
    }
  }
 else {
    for (int stage=0; stage < len; stage++) {
      DrawDataBlock(painter,xpos,ypos,len,wid,stage,data.get(len - stage - 1).toIntValue(),parallelObj);
    }
  }
}
Program: 31086
Project: 31086
Buggy source:
private Clipboard(Selection sel,AttributeSet viewAttrs,boolean ClearLabels){
  components=new HashSet<Component>();
  oldAttrs=null;
  newAttrs=null;
  for (  Component base : sel.getComponents()) {
    AttributeSet baseAttrs=base.getAttributeSet();
    AttributeSet copyAttrs=(AttributeSet)baseAttrs.clone();
    if (copyAttrs.containsAttribute(StdAttr.LABEL) && ClearLabels) {
      if (!(base.getFactory() instanceof Tunnel)) {
        continue;
      }
    }
    Component copy=base.getFactory().createComponent(base.getLocation(),copyAttrs);
    components.add(copy);
    if (baseAttrs == viewAttrs) {
      oldAttrs=baseAttrs;
      newAttrs=copyAttrs;
    }
  }
}

Fixed version (ground truth):
private Clipboard(Selection sel,AttributeSet viewAttrs,boolean ClearLabels){
  components=new HashSet<Component>();
  oldAttrs=null;
  newAttrs=null;
  for (  Component base : sel.getComponents()) {
    AttributeSet baseAttrs=base.getAttributeSet();
    AttributeSet copyAttrs=(AttributeSet)baseAttrs.clone();
    if (copyAttrs.containsAttribute(StdAttr.LABEL) && ClearLabels) {
      if ((base.getFactory() instanceof Tunnel)) {
        continue;
      }
    }
    Component copy=base.getFactory().createComponent(base.getLocation(),copyAttrs);
    components.add(copy);
    if (baseAttrs == viewAttrs) {
      oldAttrs=baseAttrs;
      newAttrs=copyAttrs;
    }
  }
}
Program: 31090
Project: 31090
Buggy source:
public Button(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{StdAttr.FACING,Io.ATTR_COLOR,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Direction.EAST,Color.WHITE,"String_Node_Str",Io.LABEL_CENTER,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,true});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  setPorts(new Port[]{new Port(0,0,Port.OUTPUT,1)});
  setInstancePoker(Poker.class);
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(1,0,0,FPGAIOInformationContainer.IOComponentTypes.Button);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
}

Fixed version (ground truth):
public Button(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{StdAttr.FACING,Io.ATTR_COLOR,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Direction.EAST,Color.WHITE,"String_Node_Str",Direction.WEST,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,true});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  setPorts(new Port[]{new Port(0,0,Port.OUTPUT,1)});
  setInstancePoker(Poker.class);
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(1,0,0,FPGAIOInformationContainer.IOComponentTypes.Button);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
}
Program: 31091
Project: 31091
Buggy source:
public Led(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{StdAttr.FACING,Io.ATTR_ON_COLOR,Io.ATTR_OFF_COLOR,Io.ATTR_ACTIVE,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Direction.WEST,new Color(240,0,0),Color.DARK_GRAY,Boolean.TRUE,"String_Node_Str",Io.LABEL_CENTER,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,false});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  setPorts(new Port[]{new Port(0,0,Port.INPUT,1)});
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(0,1,0,FPGAIOInformationContainer.IOComponentTypes.LED);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
}

Fixed version (ground truth):
public Led(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{StdAttr.FACING,Io.ATTR_ON_COLOR,Io.ATTR_OFF_COLOR,Io.ATTR_ACTIVE,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Direction.WEST,new Color(240,0,0),Color.DARK_GRAY,Boolean.TRUE,"String_Node_Str",Direction.EAST,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,true});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  setPorts(new Port[]{new Port(0,0,Port.INPUT,1)});
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(0,1,0,FPGAIOInformationContainer.IOComponentTypes.LED);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
}
Program: 31092
Project: 31092
Buggy source:
public RGBLed(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{Io.ATTR_ACTIVE,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Boolean.TRUE,"String_Node_Str",Io.LABEL_CENTER,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,false});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  Port[] ps=new Port[3];
  ps[RED]=new Port(0,0,Port.INPUT,1);
  ps[GREEN]=new Port(10,-10,Port.INPUT,1);
  ps[BLUE]=new Port(10,10,Port.INPUT,1);
  ps[RED].setToolTip(Strings.getter("String_Node_Str"));
  ps[GREEN].setToolTip(Strings.getter("String_Node_Str"));
  ps[BLUE].setToolTip(Strings.getter("String_Node_Str"));
  setPorts(ps);
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(0,3,0,null,GetLabels(),null,FPGAIOInformationContainer.IOComponentTypes.RGBLED);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.LED);
}

Fixed version (ground truth):
public RGBLed(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{Io.ATTR_ACTIVE,StdAttr.LABEL,Io.ATTR_LABEL_LOC,StdAttr.LABEL_FONT,StdAttr.LABEL_COLOR,StdAttr.LABEL_VISABILITY},new Object[]{Boolean.TRUE,"String_Node_Str",Direction.EAST,StdAttr.DEFAULT_LABEL_FONT,StdAttr.DEFAULT_LABEL_COLOR,true});
  setFacingAttribute(StdAttr.FACING);
  setIconName("String_Node_Str");
  Port[] ps=new Port[3];
  ps[RED]=new Port(0,0,Port.INPUT,1);
  ps[GREEN]=new Port(10,-10,Port.INPUT,1);
  ps[BLUE]=new Port(10,10,Port.INPUT,1);
  ps[RED].setToolTip(Strings.getter("String_Node_Str"));
  ps[GREEN].setToolTip(Strings.getter("String_Node_Str"));
  ps[BLUE].setToolTip(Strings.getter("String_Node_Str"));
  setPorts(ps);
  setInstanceLogger(Logger.class);
  MyIOInformation=new IOComponentInformationContainer(0,3,0,null,GetLabels(),null,FPGAIOInformationContainer.IOComponentTypes.RGBLED);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.Pin);
  MyIOInformation.AddAlternateMapType(FPGAIOInformationContainer.IOComponentTypes.LED);
}
Program: 31094
Project: 31094
Buggy source:
@Override public boolean HDLTargetSupported(String HDLType,AttributeSet attrs){
  return true;
}

Fixed version (ground truth):
@Override public boolean HDLTargetSupported(String HDLType,AttributeSet attrs){
  return HDLType.equals(Settings.VHDL);
}
Program: 31095
Project: 31095
Buggy source:
@Override public boolean HDLTargetSupported(String HDLType,AttributeSet attrs){
  return true;
}

Fixed version (ground truth):
@Override public boolean HDLTargetSupported(String HDLType,AttributeSet attrs){
  return HDLType.equals(Settings.VHDL);
}
Program: 31101
Project: 31101
Buggy source:
public void Stop(){
  active=false;
}

Fixed version (ground truth):
public void Stop(Circuit circ){
  if (circ == null)   return;
  SetLabel("String_Node_Str",circ);
  active.put(circ,false);
}
Program: 31102
Project: 31102
Buggy source:
public AutoLabel(String Label,Circuit circ,boolean UseFirstLabel){
  this.circ=circ;
  update(Label,UseFirstLabel);
  active=!LabelBase.isEmpty() && !(circ == null);
}

Fixed version (ground truth):
public AutoLabel(String Label,Circuit circ,boolean UseFirstLabel){
  update(circ,Label,UseFirstLabel);
  Activate(circ);
}
Program: 31103
Project: 31103
Buggy source:
public boolean LabelKeyboardHandler(int KeyCode,AttributeSet attrs,String ComponentName,Component comp,Circuit circ,SetAttributeAction act,boolean CreateAction){
switch (KeyCode) {
case KeyEvent.VK_L:
    if (attrs.containsAttribute(StdAttr.LABEL)) {
      String OldLabel=attrs.getValue(StdAttr.LABEL);
      String NewLabel=AskAndSetLabel(ComponentName,OldLabel,circ,comp,attrs,act,CreateAction);
      if (!NewLabel.equals(OldLabel)) {
        if (LabelEndsWithNumber(NewLabel)) {
          this.circ=circ;
          update(NewLabel,true);
          active=true;
        }
 else {
          active=false;
        }
      }
    }
  return true;
case KeyEvent.VK_T:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY)) {
  if (CreateAction)   act.set(comp,StdAttr.LABEL_VISABILITY,!attrs.getValue(StdAttr.LABEL_VISABILITY));
 else   attrs.setValue(StdAttr.LABEL_VISABILITY,!attrs.getValue(StdAttr.LABEL_VISABILITY));
}
return true;
case KeyEvent.VK_V:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY) && !attrs.getValue(StdAttr.LABEL_VISABILITY)) {
if (CreateAction) act.set(comp,StdAttr.LABEL_VISABILITY,true);
 else attrs.setValue(StdAttr.LABEL_VISABILITY,true);
}
return true;
case KeyEvent.VK_H:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY) && attrs.getValue(StdAttr.LABEL_VISABILITY)) {
if (CreateAction) act.set(comp,StdAttr.LABEL_VISABILITY,false);
 else attrs.setValue(StdAttr.LABEL_VISABILITY,false);
}
return true;
}
return false;
}

Fixed version (ground truth):
public boolean LabelKeyboardHandler(int KeyCode,AttributeSet attrs,String ComponentName,Component comp,Circuit circ,SetAttributeAction act,boolean CreateAction){
switch (KeyCode) {
case KeyEvent.VK_L:
    if (attrs.containsAttribute(StdAttr.LABEL)) {
      String OldLabel=attrs.getValue(StdAttr.LABEL);
      String NewLabel=AskAndSetLabel(ComponentName,OldLabel,circ,comp,attrs,act,CreateAction);
      if (!NewLabel.equals(OldLabel)) {
        if (!NewLabel.isEmpty() && LabelEndsWithNumber(NewLabel)) {
          Activate(circ);
        }
 else {
          Stop(circ);
        }
      }
    }
  return true;
case KeyEvent.VK_T:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY)) {
  if (CreateAction)   act.set(comp,StdAttr.LABEL_VISABILITY,!attrs.getValue(StdAttr.LABEL_VISABILITY));
 else   attrs.setValue(StdAttr.LABEL_VISABILITY,!attrs.getValue(StdAttr.LABEL_VISABILITY));
}
return true;
case KeyEvent.VK_V:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY) && !attrs.getValue(StdAttr.LABEL_VISABILITY)) {
if (CreateAction) act.set(comp,StdAttr.LABEL_VISABILITY,true);
 else attrs.setValue(StdAttr.LABEL_VISABILITY,true);
}
return true;
case KeyEvent.VK_H:
if (attrs.containsAttribute(StdAttr.LABEL_VISABILITY) && attrs.getValue(StdAttr.LABEL_VISABILITY)) {
if (CreateAction) act.set(comp,StdAttr.LABEL_VISABILITY,false);
 else attrs.setValue(StdAttr.LABEL_VISABILITY,false);
}
return true;
case KeyEvent.VK_A:
Stop(circ);
return true;
}
return false;
}
Program: 31104
Project: 31104
Buggy source:
private void update(String Label,boolean UseFirstLabel){
  if (Label.isEmpty() || !SyntaxChecker.isVariableNameAcceptable(Label,false)) {
    LabelBase="String_Node_Str";
    CurrentIndex=0;
    UseLabelBaseOnly=false;
    return;
  }
  UseLabelBaseOnly=UseFirstLabel;
  if (LabelEndsWithNumber(Label)) {
    int Index=GetLabelBaseEndIndex(Label);
    CurrentIndex=Integer.valueOf(Label.substring(Index + 1,Label.length()));
    LabelBase=Label.substring(0,Index + 1);
    UseUnderscore=false;
    if (UseFirstLabel)     CurrentIndex--;
    UseLabelBaseOnly=false;
  }
 else {
    LabelBase=Label;
    CurrentIndex=0;
    UseUnderscore=!Label.substring(Label.length() - 1).equals("String_Node_Str");
  }
}

Fixed version (ground truth):
private void update(Circuit circ,String Label,boolean UseFirstLabel){
  if (circ == null)   return;
  if (Label.isEmpty() || !SyntaxChecker.isVariableNameAcceptable(Label,false)) {
    LabelBase.put(circ,"String_Node_Str");
    CurrentIndex.put(circ,0);
    UseLabelBaseOnly.put(circ,false);
    CurrentLabel.put(circ,"String_Node_Str");
    return;
  }
  UseLabelBaseOnly.put(circ,UseFirstLabel);
  if (LabelEndsWithNumber(Label)) {
    int Index=GetLabelBaseEndIndex(Label);
    CurrentIndex.put(circ,Integer.valueOf(Label.substring(Index + 1,Label.length())));
    LabelBase.put(circ,Label.substring(0,Index + 1));
    UseUnderscore.put(circ,false);
    UseLabelBaseOnly.put(circ,false);
  }
 else {
    LabelBase.put(circ,Label);
    CurrentIndex.put(circ,0);
    UseUnderscore.put(circ,!Label.substring(Label.length() - 1).equals("String_Node_Str"));
  }
  if (UseFirstLabel)   CurrentLabel.put(circ,Label);
 else   CurrentLabel.put(circ,GetNext(circ));
}
Program: 31105
Project: 31105
Buggy source:
public boolean hasNext(){
  return !LabelBase.isEmpty() && circ != null && active;
}

Fixed version (ground truth):
public boolean hasNext(Circuit circ){
  if (circ == null || !active.containsKey(circ))   return false;
  return active.get(circ);
}
Program: 31106
Project: 31106
Buggy source:
public String GetNext(){
  if (UseLabelBaseOnly) {
    UseLabelBaseOnly=false;
    return LabelBase;
  }
  if (circ == null)   return "String_Node_Str";
  String NewLabel="String_Node_Str";
  do {
    CurrentIndex++;
    NewLabel=LabelBase;
    if (UseUnderscore)     NewLabel=NewLabel.concat("String_Node_Str");
    NewLabel=NewLabel.concat(Integer.toString(CurrentIndex));
  }
 while (!Circuit.IsCorrectLabel(NewLabel,circ.getNonWires(),null,false));
  return NewLabel;
}

Fixed version (ground truth):
public String GetNext(Circuit circ){
  if (circ == null)   return "String_Node_Str";
  if (UseLabelBaseOnly.get(circ)) {
    UseLabelBaseOnly.put(circ,false);
    return LabelBase.get(circ);
  }
  String NewLabel="String_Node_Str";
  int CurIdx=CurrentIndex.get(circ);
  String BaseLab=LabelBase.get(circ);
  boolean Undescore=UseUnderscore.get(circ);
  do {
    CurIdx++;
    NewLabel=BaseLab;
    if (Undescore)     NewLabel=NewLabel.concat("String_Node_Str");
    NewLabel=NewLabel.concat(Integer.toString(CurIdx));
  }
 while (!Circuit.IsCorrectLabel(NewLabel,circ.getNonWires(),null,false));
  CurrentIndex.put(circ,CurIdx);
  CurrentLabel.put(circ,NewLabel);
  return NewLabel;
}
Program: 31107
Project: 31107
Buggy source:
public void Activate(){
  active=!LabelBase.isEmpty() && !(circ == null);
}

Fixed version (ground truth):
public void Activate(Circuit circ){
  if (circ == null)   return;
  if (LabelBase.containsKey(circ) && CurrentIndex.containsKey(circ) && UseLabelBaseOnly.containsKey(circ)&& UseUnderscore.containsKey(circ))   active.put(circ,!LabelBase.get(circ).isEmpty());
}
Program: 31108
Project: 31108
Buggy source:
public void SetLabel(String Label){
  update(Label,true);
  active=!LabelBase.isEmpty() && !(circ == null);
}

Fixed version (ground truth):
public void SetLabel(String Label,Circuit circ){
  if (circ == null)   return;
  update(circ,Label,true);
}
Program: 31109
Project: 31109
Buggy source:
public static String AskAndSetLabel(String ComponentName,String OldLabel,Circuit circ,Component comp,AttributeSet attrs,SetAttributeAction act,boolean CreateAction){
  boolean correct=false;
  String NewLabel=OldLabel;
  while (!correct) {
    NewLabel=(String)JOptionPane.showInputDialog(null,Strings.get("String_Node_Str") + "String_Node_Str" + ComponentName,Strings.get("String_Node_Str"),JOptionPane.QUESTION_MESSAGE,null,null,OldLabel);
    if (NewLabel != null) {
      if (Circuit.IsCorrectLabel(NewLabel,circ.getNonWires(),attrs,true) && SyntaxChecker.isVariableNameAcceptable(NewLabel,true) && !CorrectLabel.IsKeyword(NewLabel,true)) {
        if (CreateAction)         act.set(comp,StdAttr.LABEL,NewLabel);
 else         attrs.setValue(StdAttr.LABEL,NewLabel);
        correct=true;
      }
    }
 else {
      correct=true;
      NewLabel=OldLabel;
    }
  }
  return NewLabel;
}

Fixed version (ground truth):
public String AskAndSetLabel(String ComponentName,String OldLabel,Circuit circ,Component comp,AttributeSet attrs,SetAttributeAction act,boolean CreateAction){
  boolean correct=false;
  String NewLabel=OldLabel;
  while (!correct) {
    NewLabel=(String)JOptionPane.showInputDialog(null,Strings.get("String_Node_Str") + "String_Node_Str" + ComponentName,Strings.get("String_Node_Str"),JOptionPane.QUESTION_MESSAGE,null,null,OldLabel);
    if (NewLabel != null) {
      if (Circuit.IsCorrectLabel(NewLabel,circ.getNonWires(),attrs,true) && SyntaxChecker.isVariableNameAcceptable(NewLabel,true) && !CorrectLabel.IsKeyword(NewLabel,true)) {
        if (CreateAction)         act.set(comp,StdAttr.LABEL,NewLabel);
 else         SetLabel(NewLabel,circ);
        correct=true;
      }
    }
 else {
      correct=true;
      NewLabel=OldLabel;
    }
  }
  return NewLabel;
}
Program: 31110
Project: 31110
Buggy source:
@Override public void circuitChanged(CircuitEvent event){
  int ev=event.getAction();
  if (event.getData() instanceof InstanceComponent) {
    InstanceComponent inst=(InstanceComponent)event.getData();
    if (event.getCircuit().equals(MyCircuit)) {
      if (inst.getFactory() instanceof SubcircuitFactory) {
        SubcircuitFactory fac=(SubcircuitFactory)inst.getFactory();
        Circuit sub=fac.getSubcircuit();
switch (ev) {
case CircuitEvent.ACTION_ADD:
          DRCStatus=DRC_REQUIRED;
        if (MySubCircuitMap.containsKey(sub)) {
          MySubCircuitMap.put(sub,MySubCircuitMap.get(sub) + 1);
        }
 else {
          MySubCircuitMap.put(sub,1);
          sub.addCircuitListener(this);
        }
      break;
case CircuitEvent.ACTION_REMOVE:
    DRCStatus=DRC_REQUIRED;
  if (MySubCircuitMap.containsKey(sub)) {
    if (MySubCircuitMap.get(sub) == 1) {
      MySubCircuitMap.remove(sub);
      sub.removeCircuitListener(this);
    }
 else {
      MySubCircuitMap.put(sub,MySubCircuitMap.get(sub) - 1);
    }
  }
break;
case CircuitEvent.ACTION_CHANGE:
case CircuitEvent.ACTION_CLEAR:
case CircuitEvent.ACTION_INVALIDATE:
DRCStatus=DRC_REQUIRED;
break;
}
}
}
 else {
if (inst.getFactory() instanceof Pin) {
DRCStatus=DRC_REQUIRED;
}
}
}
}

Fixed version (ground truth):
@Override public void circuitChanged(CircuitEvent event){
  int ev=event.getAction();
  if (event.getData() instanceof InstanceComponent) {
    InstanceComponent inst=(InstanceComponent)event.getData();
    if (event.getCircuit().equals(MyCircuit)) {
switch (ev) {
case CircuitEvent.ACTION_ADD:
        DRCStatus=DRC_REQUIRED;
      if (inst.getFactory() instanceof SubcircuitFactory) {
        SubcircuitFactory fac=(SubcircuitFactory)inst.getFactory();
        Circuit sub=fac.getSubcircuit();
        if (MySubCircuitMap.containsKey(sub)) {
          MySubCircuitMap.put(sub,MySubCircuitMap.get(sub) + 1);
        }
 else {
          MySubCircuitMap.put(sub,1);
          sub.addCircuitListener(this);
        }
      }
    break;
case CircuitEvent.ACTION_REMOVE:
  DRCStatus=DRC_REQUIRED;
if (inst.getFactory() instanceof SubcircuitFactory) {
  SubcircuitFactory fac=(SubcircuitFactory)inst.getFactory();
  Circuit sub=fac.getSubcircuit();
  if (MySubCircuitMap.containsKey(sub)) {
    if (MySubCircuitMap.get(sub) == 1) {
      MySubCircuitMap.remove(sub);
      sub.removeCircuitListener(this);
    }
 else {
      MySubCircuitMap.put(sub,MySubCircuitMap.get(sub) - 1);
    }
  }
}
break;
case CircuitEvent.ACTION_CHANGE:
case CircuitEvent.ACTION_CLEAR:
case CircuitEvent.ACTION_INVALIDATE:
DRCStatus=DRC_REQUIRED;
break;
}
}
 else {
if (inst.getFactory() instanceof Pin) {
DRCStatus=DRC_REQUIRED;
}
}
}
}
Program: 31111
Project: 31111
Buggy source:
/** 
 * * 
 */
private ArrayList<BoardRectangle> RemoveUsedItems(ArrayList<BoardRectangle> List,int pinNeeded){
  Iterator<BoardRectangle> ListIterator=List.iterator();
  while (ListIterator.hasNext()) {
    BoardRectangle current=ListIterator.next();
    if (mappedList.containsValue(current)) {
      ListIterator.remove();
    }
  }
  if (List.size() < pinNeeded) {
    List.clear();
  }
  return List;
}

Fixed version (ground truth):
/** 
 * * 
 */
private ArrayList<BoardRectangle> RemoveUsedItems(ArrayList<BoardRectangle> List,int pinNeeded){
  int used=pinNeeded;
  Iterator<BoardRectangle> ListIterator=List.iterator();
  while (ListIterator.hasNext()) {
    BoardRectangle current=ListIterator.next();
    if (mappedList.containsValue(current)) {
      ListIterator.remove();
      used--;
    }
  }
  if (List.size() < used) {
    List.clear();
  }
  return List;
}
Program: 31112
Project: 31112
Buggy source:
private static boolean IsExistingLabel(String Name,AttributeSet me,Set<Component> comps,Boolean ShowDialog){
  if (Name.isEmpty())   return false;
  for (  Component comp : comps) {
    if (!comp.getAttributeSet().equals(me)) {
      String Label=(comp.getAttributeSet().containsAttribute(StdAttr.LABEL)) ? comp.getAttributeSet().getValue(StdAttr.LABEL) : "String_Node_Str";
      if (Label.toUpperCase().equals(Name.toUpperCase())) {
        if (ShowDialog)         JOptionPane.showMessageDialog(null,"String_Node_Str" + Name + "String_Node_Str"+ Strings.get("String_Node_Str"));
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean IsExistingLabel(String Name,AttributeSet me,Set<Component> comps,Boolean ShowDialog){
  if (Name.isEmpty())   return false;
  for (  Component comp : comps) {
    if (!comp.getAttributeSet().equals(me) && !(comp.getFactory() instanceof Tunnel)) {
      String Label=(comp.getAttributeSet().containsAttribute(StdAttr.LABEL)) ? comp.getAttributeSet().getValue(StdAttr.LABEL) : "String_Node_Str";
      if (Label.toUpperCase().equals(Name.toUpperCase())) {
        if (ShowDialog)         JOptionPane.showMessageDialog(null,"String_Node_Str" + Name + "String_Node_Str"+ Strings.get("String_Node_Str"));
        return true;
      }
    }
  }
  return false;
}
Program: 31113
Project: 31113
Buggy source:
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),true))   attre.getSource().setValue(lattr,oldLabel);
}

Fixed version (ground truth):
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),e.getSource().getFactory(),true))   attre.getSource().setValue(lattr,oldLabel);
}
Program: 31114
Project: 31114
Buggy source:
public static boolean IsCorrectLabel(String Name,Set<Component> components,AttributeSet me,Boolean ShowDialog){
  return !(IsExistingLabel(Name,me,components,ShowDialog) || IsComponentName(Name,components,ShowDialog));
}

Fixed version (ground truth):
public static boolean IsCorrectLabel(String Name,Set<Component> components,AttributeSet me,ComponentFactory myFactory,Boolean ShowDialog){
  if (myFactory instanceof Tunnel)   return true;
  return !(IsExistingLabel(Name,me,components,ShowDialog) || IsComponentName(Name,components,ShowDialog));
}
Program: 31119
Project: 31119
Buggy source:
@Override public void keyPressed(Canvas canvas,KeyEvent e){
  if (state == MOVING && e.getKeyCode() == KeyEvent.VK_SHIFT) {
    handleMoveDrag(canvas,curDx,curDy,e.getModifiersEx());
  }
 else {
    SortedSet<Component> comps=AutoLabel.Sort(canvas.getProject().getSelection().getComponents());
    int KeybEvent=e.getKeyCode();
    boolean KeyTaken=false;
    for (    Component comp : comps) {
      SetAttributeAction act=new SetAttributeAction(canvas.getCircuit(),Strings.getter("String_Node_Str"));
      KeyTaken|=GateKeyboardModifier.TookKeyboardStrokes(KeybEvent,comp,comp.getAttributeSet(),canvas,act,true);
      if (!act.isEmpty())       canvas.getProject().doAction(act);
    }
    if (!KeyTaken) {
      for (      Component comp : comps) {
        SetAttributeAction act=new SetAttributeAction(canvas.getCircuit(),Strings.getter("String_Node_Str"));
        KeyTaken|=AutoLabler.LabelKeyboardHandler(KeybEvent,comp.getAttributeSet(),comp.getFactory().getDisplayName(),comp,canvas.getCircuit(),act,true);
        if (!act.isEmpty())         canvas.getProject().doAction(act);
      }
    }
    if (!KeyTaken) switch (KeybEvent) {
case KeyEvent.VK_BACK_SPACE:
case KeyEvent.VK_DELETE:
      if (!canvas.getSelection().isEmpty()) {
        Action act=SelectionActions.clear(canvas.getSelection());
        canvas.getProject().doAction(act);
        e.consume();
      }
    break;
default :
  processKeyEvent(canvas,e,KeyConfigurationEvent.KEY_PRESSED);
}
}
}

Fixed version (ground truth):
@Override public void keyPressed(Canvas canvas,KeyEvent e){
  if (state == MOVING && e.getKeyCode() == KeyEvent.VK_SHIFT) {
    handleMoveDrag(canvas,curDx,curDy,e.getModifiersEx());
  }
 else {
    SortedSet<Component> comps=AutoLabel.Sort(canvas.getProject().getSelection().getComponents());
    int KeybEvent=e.getKeyCode();
    boolean KeyTaken=false;
    for (    Component comp : comps) {
      SetAttributeAction act=new SetAttributeAction(canvas.getCircuit(),Strings.getter("String_Node_Str"));
      KeyTaken|=GateKeyboardModifier.TookKeyboardStrokes(KeybEvent,comp,comp.getAttributeSet(),canvas,act,true);
      if (!act.isEmpty())       canvas.getProject().doAction(act);
    }
    if (!KeyTaken) {
      for (      Component comp : comps) {
        SetAttributeAction act=new SetAttributeAction(canvas.getCircuit(),Strings.getter("String_Node_Str"));
        KeyTaken|=AutoLabler.LabelKeyboardHandler(KeybEvent,comp.getAttributeSet(),comp.getFactory().getDisplayName(),comp,comp.getFactory(),canvas.getCircuit(),act,true);
        if (!act.isEmpty())         canvas.getProject().doAction(act);
      }
    }
    if (!KeyTaken) switch (KeybEvent) {
case KeyEvent.VK_BACK_SPACE:
case KeyEvent.VK_DELETE:
      if (!canvas.getSelection().isEmpty()) {
        Action act=SelectionActions.clear(canvas.getSelection());
        canvas.getProject().doAction(act);
        e.consume();
      }
    break;
default :
  processKeyEvent(canvas,e,KeyConfigurationEvent.KEY_PRESSED);
}
}
}
Program: 31120
Project: 31120
Buggy source:
public void Stop(Circuit circ){
  if (circ == null)   return;
  SetLabel("String_Node_Str",circ);
  active.put(circ,false);
}

Fixed version (ground truth):
public void Stop(Circuit circ){
  if (circ == null)   return;
  SetLabel("String_Node_Str",circ,null);
  active.put(circ,false);
}
Program: 31121
Project: 31121
Buggy source:
public AutoLabel(String Label,Circuit circ,boolean UseFirstLabel){
  update(circ,Label,UseFirstLabel);
  Activate(circ);
}

Fixed version (ground truth):
public AutoLabel(String Label,Circuit circ,boolean UseFirstLabel){
  update(circ,Label,UseFirstLabel,null);
  Activate(circ);
}