nus-yam/ex-repair huggingface dataset:
Program: 17771
Project: 17771
Buggy source:
public void actionPerformed(final ActionEvent e){
  if (e.getSource() == this.calculateButton) {
    try {
      setDirty(true);
      final BasicNeuralData input=new BasicNeuralData(this.inputCount);
      for (int i=0; i < this.inputCount; i++) {
        double value=0;
        final String str=(String)this.inputTable.getValueAt(i,1);
        try {
          value=Double.parseDouble(str);
        }
 catch (        final NumberFormatException e2) {
          EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
        }
        input.setData(i,value);
      }
      final NeuralData output=getData().compute(input);
      for (int i=0; i < this.outputCount; i++) {
        this.outputTable.setValueAt(output.getData(i),i,1);
      }
    }
 catch (    EncogError ex) {
      EncogWorkBench.displayError("String_Node_Str",ex.getMessage());
    }
catch (    Throwable t) {
      ErrorDialog.handleError(t,(MLMethod)this.getEncogObject(),null);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(final ActionEvent e){
  if (e.getSource() == this.calculateButton) {
    try {
      setDirty(true);
      final BasicNeuralData input=new BasicNeuralData(this.inputCount);
      for (int i=0; i < this.inputCount; i++) {
        double value=0;
        final String str=(String)this.inputTable.getValueAt(i,1);
        try {
          value=Double.parseDouble(str);
        }
 catch (        final NumberFormatException e2) {
          EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
        }
        input.setData(i,value);
      }
      final NeuralData output=getData().compute(input);
      for (int i=0; i < this.outputCount; i++) {
        this.outputTable.setValueAt(output.getData(i),i,1);
      }
    }
 catch (    EncogError ex) {
      EncogWorkBench.displayError("String_Node_Str",ex.getMessage());
    }
catch (    Throwable t) {
      ErrorDialog.handleError(t,this.getEncogObject(),null);
    }
  }
}
Program: 17772
Project: 17772
Buggy source:
public void performQuery(){
  try {
    int outputCount=((MLOutput)method).getOutputCount();
    boolean[] grid=this.panel.getGrid();
    NeuralData input=new BasicNeuralData(grid.length);
    for (int i=0; i < grid.length; i++) {
      input.setData(i,grid[i] ? 1 : -1);
    }
    if (classification) {
      int output=((MLClassification)this.method).classify(input);
      this.outputTable.setValueAt(output,0,1);
    }
 else {
      NeuralData output=((MLRegression)this.method).compute(input);
      for (int i=0; i < outputCount; i++) {
        this.outputTable.setValueAt(output.getData(i),i,1);
      }
    }
  }
 catch (  EncogError ex) {
    EncogWorkBench.displayError("String_Node_Str",ex.getMessage());
  }
catch (  Throwable t) {
    ErrorDialog.handleError(t,method,null);
  }
}

Fixed version (ground truth):
public void performQuery(){
  try {
    int outputCount=((MLOutput)method).getOutputCount();
    boolean[] grid=this.panel.getGrid();
    NeuralData input=new BasicNeuralData(grid.length);
    for (int i=0; i < grid.length; i++) {
      input.setData(i,grid[i] ? 1 : -1);
    }
    if (classification) {
      int output=((MLClassification)this.method).classify(input);
      this.outputTable.setValueAt(output,0,1);
    }
 else {
      NeuralData output=((MLRegression)this.method).compute(input);
      for (int i=0; i < outputCount; i++) {
        this.outputTable.setValueAt(output.getData(i),i,1);
      }
    }
  }
 catch (  EncogError ex) {
    EncogWorkBench.displayError("String_Node_Str",ex.getMessage());
  }
catch (  Throwable t) {
    ErrorDialog.handleError(t,this.getEncogObject(),null);
  }
}
Program: 17773
Project: 17773
Buggy source:
private void performClose(){
  if (EncogWorkBench.askQuestion("String_Node_Str","String_Node_Str")) {
    if (this.getEncogObject() != null) {
      this.getEncogObject().save();
      if (this.getParentTab() != null) {
        this.getParentTab().setEncogObject(this.getEncogObject());
      }
    }
    if (this.train instanceof ResilientPropagation) {
      ResilientPropagation rprop=(ResilientPropagation)this.train;
      TrainingContinuation cont=rprop.pause();
      EncogWorkBench.getInstance().getMainWindow().redraw();
    }
    EncogWorkBench.getInstance().refresh();
  }
 else {
    if (this.getEncogObject() != null) {
      ((ProjectEGFile)this.getEncogObject()).revert();
    }
  }
}

Fixed version (ground truth):
private void performClose(){
  if (error)   return;
  if (EncogWorkBench.askQuestion("String_Node_Str","String_Node_Str")) {
    if (this.getEncogObject() != null) {
      this.getEncogObject().save();
      if (this.getParentTab() != null) {
        this.getParentTab().setEncogObject(this.getEncogObject());
      }
    }
    if (this.train instanceof ResilientPropagation) {
      ResilientPropagation rprop=(ResilientPropagation)this.train;
      TrainingContinuation cont=rprop.pause();
      EncogWorkBench.getInstance().getMainWindow().redraw();
    }
    EncogWorkBench.getInstance().refresh();
  }
 else {
    if (this.getEncogObject() != null) {
      ((ProjectEGFile)this.getEncogObject()).revert();
    }
  }
}
Program: 17775
Project: 17775
Buggy source:
public void valueChanged(ListSelectionEvent e){
switch (list.getSelectedIndex()) {
case 0:
    this.text.setText("String_Node_Str");
  break;
case 1:
this.text.setText("String_Node_Str");
break;
case 2:
this.text.setText("String_Node_Str");
break;
case 3:
this.text.setText("String_Node_Str");
break;
case 4:
this.text.setText("String_Node_Str");
break;
case 5:
this.text.setText("String_Node_Str");
break;
case 6:
this.text.setText("String_Node_Str");
break;
case 7:
this.text.setText("String_Node_Str");
break;
case 8:
this.text.setText("String_Node_Str");
break;
case 9:
this.text.setText("String_Node_Str");
break;
case 10:
this.text.setText("String_Node_Str");
break;
case 11:
this.text.setText("String_Node_Str");
break;
case 12:
this.text.setText("String_Node_Str");
break;
case 13:
this.text.setText("String_Node_Str");
break;
case 14:
this.text.setText("String_Node_Str");
break;
case 15:
this.text.setText("String_Node_Str");
}
this.text.setSelectionStart(0);
this.text.setSelectionEnd(0);
}

Fixed version (ground truth):
public void valueChanged(ListSelectionEvent e){
switch (list.getSelectedIndex()) {
case 0:
    this.text.setText("String_Node_Str");
  break;
case 1:
this.text.setText("String_Node_Str");
break;
case 2:
this.text.setText("String_Node_Str");
break;
case 3:
this.text.setText("String_Node_Str");
break;
case 4:
this.text.setText("String_Node_Str");
break;
case 5:
this.text.setText("String_Node_Str");
break;
case 6:
this.text.setText("String_Node_Str");
break;
case 7:
this.text.setText("String_Node_Str");
break;
case 8:
this.text.setText("String_Node_Str");
break;
case 9:
this.text.setText("String_Node_Str");
break;
case 10:
this.text.setText("String_Node_Str");
break;
case 11:
this.text.setText("String_Node_Str");
break;
case 12:
this.text.setText("String_Node_Str");
break;
case 13:
this.text.setText("String_Node_Str");
}
this.text.setSelectionStart(0);
this.text.setSelectionEnd(0);
}
Program: 17776
Project: 17776
Buggy source:
@Override public void collectFields() throws ValidationException {
switch (list.getSelectedIndex()) {
case 0:
    this.type=NeuralNetworkType.Empty;
  break;
case 1:
this.type=NeuralNetworkType.Automatic;
break;
case 2:
this.type=NeuralNetworkType.ADALINE;
break;
case 3:
this.type=NeuralNetworkType.ART1;
break;
case 4:
this.type=NeuralNetworkType.BAM;
break;
case 5:
this.type=NeuralNetworkType.Boltzmann;
break;
case 6:
this.type=NeuralNetworkType.CPN;
break;
case 7:
this.type=NeuralNetworkType.Feedforward;
break;
case 8:
this.type=NeuralNetworkType.RBF;
break;
case 9:
this.type=NeuralNetworkType.SOM;
break;
case 10:
this.type=NeuralNetworkType.Hopfield;
break;
case 11:
this.type=NeuralNetworkType.Elman;
break;
case 12:
this.type=NeuralNetworkType.Jordan;
break;
case 13:
this.type=NeuralNetworkType.RSOM;
break;
case 14:
this.type=NeuralNetworkType.NEAT;
break;
case 15:
this.type=NeuralNetworkType.SVM;
break;
}
}

Fixed version (ground truth):
@Override public void collectFields() throws ValidationException {
switch (list.getSelectedIndex()) {
case 0:
    this.type=NeuralNetworkType.Automatic;
  break;
case 1:
this.type=NeuralNetworkType.ADALINE;
break;
case 2:
this.type=NeuralNetworkType.ART1;
break;
case 3:
this.type=NeuralNetworkType.BAM;
break;
case 4:
this.type=NeuralNetworkType.Boltzmann;
break;
case 5:
this.type=NeuralNetworkType.CPN;
break;
case 6:
this.type=NeuralNetworkType.Feedforward;
break;
case 7:
this.type=NeuralNetworkType.RBF;
break;
case 8:
this.type=NeuralNetworkType.SOM;
break;
case 9:
this.type=NeuralNetworkType.Hopfield;
break;
case 10:
this.type=NeuralNetworkType.Elman;
break;
case 11:
this.type=NeuralNetworkType.Jordan;
break;
case 12:
this.type=NeuralNetworkType.NEAT;
break;
case 13:
this.type=NeuralNetworkType.SVM;
break;
}
}
Program: 17777
Project: 17777
Buggy source:
public CreateNeuralNetworkDialog(Frame owner){
  super(owner);
  setTitle("String_Node_Str");
  this.setSize(500,250);
  this.setLocation(50,100);
  final Container content=getBodyPanel();
  content.setLayout(new GridLayout(1,2));
  content.add(this.scroll1);
  content.add(this.scroll2);
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.list.addListSelectionListener(this);
  this.text.setLineWrap(true);
  this.text.setWrapStyleWord(true);
  this.text.setEditable(false);
  scroll2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}

Fixed version (ground truth):
public CreateNeuralNetworkDialog(Frame owner){
  super(owner);
  setTitle("String_Node_Str");
  this.setSize(500,250);
  this.setLocation(50,100);
  final Container content=getBodyPanel();
  content.setLayout(new GridLayout(1,2));
  content.add(this.scroll1);
  content.add(this.scroll2);
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.model.addElement("String_Node_Str");
  this.list.addListSelectionListener(this);
  this.text.setLineWrap(true);
  this.text.setWrapStyleWord(true);
  this.text.setEditable(false);
  scroll2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
Program: 17778
Project: 17778
Buggy source:
@Override public void setFields(){
switch (type) {
case Empty:
    this.list.setSelectedIndex(0);
  break;
case Automatic:
this.list.setSelectedIndex(1);
break;
case ADALINE:
this.list.setSelectedIndex(2);
break;
case ART1:
this.list.setSelectedIndex(3);
break;
case BAM:
this.list.setSelectedIndex(4);
break;
case Boltzmann:
this.list.setSelectedIndex(5);
break;
case CPN:
this.list.setSelectedIndex(6);
break;
case Feedforward:
this.list.setSelectedIndex(7);
break;
case RBF:
this.list.setSelectedIndex(8);
break;
case SOM:
this.list.setSelectedIndex(9);
break;
case Hopfield:
this.list.setSelectedIndex(10);
break;
case Elman:
this.list.setSelectedIndex(11);
break;
case Jordan:
this.list.setSelectedIndex(12);
break;
case RSOM:
this.list.setSelectedIndex(13);
break;
case NEAT:
this.list.setSelectedIndex(14);
break;
case SVM:
this.list.setSelectedIndex(15);
break;
}
}

Fixed version (ground truth):
@Override public void setFields(){
switch (type) {
case Automatic:
    this.list.setSelectedIndex(1);
  break;
case ADALINE:
this.list.setSelectedIndex(2);
break;
case ART1:
this.list.setSelectedIndex(3);
break;
case BAM:
this.list.setSelectedIndex(4);
break;
case Boltzmann:
this.list.setSelectedIndex(5);
break;
case CPN:
this.list.setSelectedIndex(6);
break;
case Feedforward:
this.list.setSelectedIndex(7);
break;
case RBF:
this.list.setSelectedIndex(8);
break;
case SOM:
this.list.setSelectedIndex(9);
break;
case Hopfield:
this.list.setSelectedIndex(10);
break;
case Elman:
this.list.setSelectedIndex(11);
break;
case Jordan:
this.list.setSelectedIndex(12);
break;
case NEAT:
this.list.setSelectedIndex(14);
break;
case SVM:
this.list.setSelectedIndex(15);
break;
}
}
Program: 17779
Project: 17779
Buggy source:
private static BasicNetwork createAutomatic(String name){
  CreateAutomatic dialog=new CreateAutomatic(EncogWorkBench.getInstance().getMainWindow());
  dialog.setActivationFunction(new ActivationTANH());
  dialog.getWeightTries().setValue(5);
  dialog.getIterations().setValue(25);
  dialog.getWindowSize().setValue(10);
  if (dialog.process()) {
    NeuralDataSet training=dialog.getTraining();
    if (training == null) {
      return null;
    }
    FeedForwardPattern pattern=new FeedForwardPattern();
    pattern.setInputNeurons(training.getInputSize());
    pattern.setOutputNeurons(training.getIdealSize());
    pattern.setActivationFunction(dialog.getActivationFunction());
    IncrementalPruneTab tab=new IncrementalPruneTab(dialog.getIterations().getValue(),dialog.getWeightTries().getValue(),dialog.getWindowSize().getValue(),training,pattern,name);
    for (int i=0; i < dialog.getHidden().getModel().size(); i++) {
      String str=(String)dialog.getHidden().getModel().getElementAt(i);
      String lowStr=BotUtil.extract(str,"String_Node_Str","String_Node_Str",0);
      String highStr=BotUtil.extract(str,"String_Node_Str","String_Node_Str",0);
      int low=Integer.parseInt(lowStr);
      int high=Integer.parseInt(highStr);
      tab.addHiddenRange(low,high);
    }
    EncogWorkBench.getInstance().getMainWindow().openModalTab(tab,"String_Node_Str");
    return null;
  }
  return null;
}

Fixed version (ground truth):
private static BasicNetwork createAutomatic(EncogMemoryCollection collection,String name){
  CreateAutomatic dialog=new CreateAutomatic(EncogWorkBench.getInstance().getMainWindow());
  dialog.setActivationFunction(new ActivationTANH());
  dialog.getWeightTries().setValue(5);
  dialog.getIterations().setValue(25);
  dialog.getWindowSize().setValue(10);
  if (dialog.process()) {
    NeuralDataSet training=dialog.getTraining();
    if (training == null) {
      return null;
    }
    FeedForwardPattern pattern=new FeedForwardPattern();
    pattern.setInputNeurons(training.getInputSize());
    pattern.setOutputNeurons(training.getIdealSize());
    pattern.setActivationFunction(dialog.getActivationFunction());
    IncrementalPruneTab tab=new IncrementalPruneTab(dialog.getIterations().getValue(),dialog.getWeightTries().getValue(),dialog.getWindowSize().getValue(),training,pattern,name,collection);
    for (int i=0; i < dialog.getHidden().getModel().size(); i++) {
      String str=(String)dialog.getHidden().getModel().getElementAt(i);
      String lowStr=BotUtil.extract(str,"String_Node_Str","String_Node_Str",0);
      String highStr=BotUtil.extract(str,"String_Node_Str","String_Node_Str",0);
      int low=Integer.parseInt(lowStr);
      int high=Integer.parseInt(highStr);
      tab.addHiddenRange(low,high);
    }
    EncogWorkBench.getInstance().getMainWindow().openModalTab(tab,"String_Node_Str");
    return null;
  }
  return null;
}
Program: 17780
Project: 17780
Buggy source:
public static void process(String name,ProjectEGFile pef){
  EncogPersistedObject network=null;
  CreateNeuralNetworkDialog dialog=new CreateNeuralNetworkDialog(EncogWorkBench.getInstance().getMainWindow());
  dialog.setType(NeuralNetworkType.Empty);
  if (dialog.process()) {
switch (dialog.getType()) {
case Empty:
      network=createEmpty(name);
    break;
case Automatic:
  network=createAutomatic(name);
break;
case Feedforward:
network=createFeedForward(name);
break;
case SOM:
network=createSOM(name);
break;
case Hopfield:
network=createHopfield(name);
break;
case Elman:
network=createElman(name);
break;
case Jordan:
network=createJordan(name);
break;
case RBF:
network=createRBF(name);
break;
case BAM:
network=createBAM(name);
break;
case CPN:
network=createCPN(name);
break;
case Boltzmann:
network=createBoltzmann(name);
break;
case ADALINE:
network=createADALINE(name);
break;
case ART1:
network=createART1(name);
break;
case NEAT:
network=createNEAT(name);
break;
case SVM:
network=createSVM(name);
break;
default :
network=createEmpty(name);
break;
}
if (network != null) {
EncogMemoryCollection encog=pef.getCollection();
encog.add(name,network);
encog.save(pef.getFile().toString());
pef.generateChildrenList();
EncogWorkBench.getInstance().getMainWindow().redraw();
}
}
}

Fixed version (ground truth):
public static void process(String name,ProjectEGFile pef){
  EncogPersistedObject network=null;
  CreateNeuralNetworkDialog dialog=new CreateNeuralNetworkDialog(EncogWorkBench.getInstance().getMainWindow());
  dialog.setType(NeuralNetworkType.Feedforward);
  if (dialog.process()) {
switch (dialog.getType()) {
case Automatic:
      EncogMemoryCollection encog=pef.getCollection();
    createAutomatic(encog,name);
  network=null;
break;
case Feedforward:
network=createFeedForward(name);
break;
case SOM:
network=createSOM(name);
break;
case Hopfield:
network=createHopfield(name);
break;
case Elman:
network=createElman(name);
break;
case Jordan:
network=createJordan(name);
break;
case RBF:
network=createRBF(name);
break;
case BAM:
network=createBAM(name);
break;
case CPN:
network=createCPN(name);
break;
case Boltzmann:
network=createBoltzmann(name);
break;
case ADALINE:
network=createADALINE(name);
break;
case ART1:
network=createART1(name);
break;
case NEAT:
network=createNEAT(name);
break;
case SVM:
network=createSVM(name);
break;
default :
network=createEmpty(name);
break;
}
if (network != null) {
EncogMemoryCollection encog=pef.getCollection();
encog.add(name,network);
encog.save(pef.getFile().toString());
pef.generateChildrenList();
EncogWorkBench.getInstance().getMainWindow().redraw();
}
}
}
Program: 17781
Project: 17781
Buggy source:
public void performClose(){
  if (this.prune != null) {
    BasicNetwork network=this.prune.getBestNetwork();
    if (network != null) {
      if (EncogWorkBench.askQuestion("String_Node_Str","String_Node_Str")) {
        if (network != null) {
          EncogWorkBench.getInstance().getMainWindow().redraw();
        }
      }
    }
  }
}

Fixed version (ground truth):
public void performClose(){
  if (this.prune != null) {
    BasicNetwork network=this.prune.getBestNetwork();
    if (network != null) {
      if (EncogWorkBench.askQuestion("String_Node_Str","String_Node_Str")) {
        if (network != null) {
          collection.add(name,network);
          collection.save();
          EncogWorkBench.getInstance().refresh();
        }
      }
    }
  }
}
Program: 17782
Project: 17782
Buggy source:
public IncrementalPruneTab(int iterations,int weightTries,int windowSize,NeuralDataSet training,FeedForwardPattern pattern,String name){
  super(null);
  this.weightTries=weightTries;
  this.iterations=iterations;
  this.training=training;
  this.pattern=pattern;
  this.name=name;
  this.windowSize=windowSize;
  this.prune=new PruneIncremental(this.training,this.pattern,this.iterations,this.weightTries,this.windowSize,this);
  this.prune.init();
  this.buttonStart=new JButton("String_Node_Str");
  this.buttonStop=new JButton("String_Node_Str");
  this.buttonClose=new JButton("String_Node_Str");
  this.buttonStart.addActionListener(this);
  this.buttonStop.addActionListener(this);
  this.buttonClose.addActionListener(this);
  setLayout(new BorderLayout());
  this.panelBody=new JPanel();
  this.panelButtons=new JPanel();
  this.panelButtons.add(this.buttonStart);
  this.panelButtons.add(this.buttonStop);
  this.panelButtons.add(this.buttonClose);
  add(this.panelBody,BorderLayout.CENTER);
  add(this.panelButtons,BorderLayout.SOUTH);
  this.panelBody.setLayout(new BorderLayout());
  this.panelBody.add(this.statusPanel=new IncrementalPruneStatusPanel(this),BorderLayout.NORTH);
  this.panelBody.add(this.chartPanel=new IncrementalPruneChart(this),BorderLayout.CENTER);
  this.buttonStop.setEnabled(false);
  this.shouldExit=false;
  this.bodyFont=EncogFonts.getInstance().getBodyFont();
  this.headFont=EncogFonts.getInstance().getHeadFont();
  this.status="String_Node_Str";
}

Fixed version (ground truth):
public IncrementalPruneTab(int iterations,int weightTries,int windowSize,NeuralDataSet training,FeedForwardPattern pattern,String name,EncogMemoryCollection collection){
  super(null);
  this.weightTries=weightTries;
  this.iterations=iterations;
  this.training=training;
  this.pattern=pattern;
  this.name=name;
  this.windowSize=windowSize;
  this.collection=collection;
  this.prune=new PruneIncremental(this.training,this.pattern,this.iterations,this.weightTries,this.windowSize,this);
  this.prune.init();
  this.buttonStart=new JButton("String_Node_Str");
  this.buttonStop=new JButton("String_Node_Str");
  this.buttonClose=new JButton("String_Node_Str");
  this.buttonStart.addActionListener(this);
  this.buttonStop.addActionListener(this);
  this.buttonClose.addActionListener(this);
  setLayout(new BorderLayout());
  this.panelBody=new JPanel();
  this.panelButtons=new JPanel();
  this.panelButtons.add(this.buttonStart);
  this.panelButtons.add(this.buttonStop);
  this.panelButtons.add(this.buttonClose);
  add(this.panelBody,BorderLayout.CENTER);
  add(this.panelButtons,BorderLayout.SOUTH);
  this.panelBody.setLayout(new BorderLayout());
  this.panelBody.add(this.statusPanel=new IncrementalPruneStatusPanel(this),BorderLayout.NORTH);
  this.panelBody.add(this.chartPanel=new IncrementalPruneChart(this),BorderLayout.CENTER);
  this.buttonStop.setEnabled(false);
  this.shouldExit=false;
  this.bodyFont=EncogFonts.getInstance().getBodyFont();
  this.headFont=EncogFonts.getInstance().getHeadFont();
  this.status="String_Node_Str";
}
Program: 17785
Project: 17785
Buggy source:
public static void loadConfig(){
  String home=System.getProperty("String_Node_Str");
  File file=new File(home,CONFIG_FILENAME);
  try {
    InputStream is=new FileInputStream(file);
    ReadXML readXML=new ReadXML(is);
    readXML.readToTag();
    XML2Object conv=new XML2Object();
    conv.load(readXML,EncogWorkBench.getInstance().getConfig());
    is.close();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public static void loadConfig(){
  String home=System.getProperty("String_Node_Str");
  File file=new File(home,CONFIG_FILENAME);
  try {
  }
 catch (  Exception e) {
  }
}
Program: 17786
Project: 17786
Buggy source:
public static void saveConfig(){
  try {
    String home=System.getProperty("String_Node_Str");
    File file=new File(home,CONFIG_FILENAME);
    FileOutputStream fos=new FileOutputStream(file);
    WriteXML out=new WriteXML(fos);
    out.beginDocument();
    Object2XML xml=new Object2XML();
    xml.save(EncogWorkBench.getInstance().getConfig(),out);
    out.endDocument();
    fos.close();
  }
 catch (  IOException e) {
    throw new WorkBenchError(e);
  }
}

Fixed version (ground truth):
public static void saveConfig(){
}
Program: 17787
Project: 17787
Buggy source:
public void openTab(EncogCommonTab tab,String title){
  int i=this.documentTabs.getTabCount();
  this.documentTabs.add(title,tab);
  documentTabs.setTabComponentAt(i,new ButtonTabComponent(this,tab));
  this.tabManager.add(tab);
  this.documentTabs.setSelectedComponent(tab);
  this.menus.updateMenus();
}

Fixed version (ground truth):
public void openTab(EncogCommonTab tab,String title){
  String titleToUse;
  int i=this.documentTabs.getTabCount();
  if (title == null && tab.getEncogObject() != null)   titleToUse=tab.getEncogObject().getName();
 else   titleToUse=title;
  this.documentTabs.add(titleToUse,tab);
  if (!this.tabManager.contains(tab)) {
    if (i < this.documentTabs.getTabCount())     documentTabs.setTabComponentAt(i,new ButtonTabComponent(this,tab));
    this.tabManager.add(tab);
  }
  this.documentTabs.setSelectedComponent(tab);
  this.menus.updateMenus();
}
Program: 17788
Project: 17788
Buggy source:
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=new OpenCLTrainingProfile(this.getDevice());
  final Backpropagation train=new Backpropagation(getNetwork(),getTrainingData(),profile,this.learningRate,this.momentum);
  train.setNumThreads(EncogWorkBench.getInstance().getConfig().getThreadCount());
  setTrain(train);
}

Fixed version (ground truth):
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=null;
  if (this.getDevice() != null)   profile=new OpenCLTrainingProfile(this.getDevice());
  final Backpropagation train=new Backpropagation(getNetwork(),getTrainingData(),profile,this.learningRate,this.momentum);
  train.setNumThreads(EncogWorkBench.getInstance().getConfig().getThreadCount());
  setTrain(train);
}
Program: 17789
Project: 17789
Buggy source:
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=new OpenCLTrainingProfile(this.getDevice());
  final Train train=new ManhattanPropagation(getNetwork(),getTrainingData(),profile,this.fixedDelta);
  setTrain(train);
}

Fixed version (ground truth):
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=null;
  if (this.getDevice() != null)   profile=new OpenCLTrainingProfile(this.getDevice());
  final Train train=new ManhattanPropagation(getNetwork(),getTrainingData(),profile,this.fixedDelta);
  setTrain(train);
}
Program: 17790
Project: 17790
Buggy source:
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=new OpenCLTrainingProfile(this.getDevice());
  final ResilientPropagation train=new ResilientPropagation(getNetwork(),getTrainingData(),profile,this.initialUpdate,this.maxStep);
  train.setNumThreads(EncogWorkBench.getInstance().getConfig().getThreadCount());
  setTrain(train);
}

Fixed version (ground truth):
/** 
 * Construct the training objects.
 */
@Override public void startup(){
  OpenCLTrainingProfile profile=null;
  if (this.getDevice() != null)   profile=new OpenCLTrainingProfile(this.getDevice());
  final ResilientPropagation train=new ResilientPropagation(getNetwork(),getTrainingData(),profile,this.initialUpdate,this.maxStep);
  train.setNumThreads(EncogWorkBench.getInstance().getConfig().getThreadCount());
  setTrain(train);
}
Program: 17791
Project: 17791
Buggy source:
public boolean validateIsUnsupervised(){
  if (!this.training.isSupervised()) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean validateIsUnsupervised(){
  if (this.training.isSupervised()) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
    return false;
  }
  return true;
}
Program: 17792
Project: 17792
Buggy source:
public boolean validateOutputSize(){
  final int outputNeurons=this.network.getOutputCount();
  final int trainingOutputs=this.training.getIdealSize();
  if (outputNeurons != trainingOutputs) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str" + outputNeurons + "String_Node_Str"+ trainingOutputs);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean validateOutputSize(){
  int outputNeurons=0;
  Layer layer=this.network.getLayer(BasicNetwork.TAG_OUTPUT);
  if (layer != null)   outputNeurons=layer.getNeuronCount();
  final int trainingOutputs=this.training.getIdealSize();
  if (outputNeurons != trainingOutputs) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str" + outputNeurons + "String_Node_Str"+ trainingOutputs);
    return false;
  }
  return true;
}
Program: 17793
Project: 17793
Buggy source:
public boolean validateInputSize(){
  final int inputNeurons=this.network.getInputCount();
  final int trainingInputs=this.training.getInputSize();
  if (inputNeurons != trainingInputs) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str" + inputNeurons + "String_Node_Str"+ trainingInputs);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean validateInputSize(){
  int inputNeurons=0;
  Layer layer=this.network.getLayer(BasicNetwork.TAG_INPUT);
  if (layer != null)   inputNeurons=layer.getNeuronCount();
  final int trainingInputs=this.training.getInputSize();
  if (inputNeurons != trainingInputs) {
    EncogWorkBench.displayError("String_Node_Str","String_Node_Str" + inputNeurons + "String_Node_Str"+ trainingInputs);
    return false;
  }
  return true;
}
Program: 17794
Project: 17794
Buggy source:
/** 
 * Close the current file.
 */
public void close(){
  this.currentFile.getContents().clear();
  this.currentFileName=null;
  this.mainWindow.redraw();
}

Fixed version (ground truth):
/** 
 * Close the current file.
 */
public void close(){
  this.currentFile.clear();
  this.currentFileName=null;
  this.mainWindow.redraw();
}
Program: 17795
Project: 17795
Buggy source:
public MatrixTableField(String name,String label,Synapse synapse){
  super(name,label,true);
  this.synapse=synapse;
  this.tempMatrix=synapse.getMatrix().clone();
  this.model=new MatrixTableModel(tempMatrix);
  this.height=300;
}

Fixed version (ground truth):
public MatrixTableField(String name,String label,Synapse synapse){
  super(name,label,true);
  this.synapse=synapse;
  this.matrix=synapse.getMatrix().clone();
  this.model=new MatrixTableModel(matrix);
  this.height=300;
}
Program: 17796
Project: 17796
Buggy source:
public int createField(JPanel panel,int x,int y,int width){
  this.table=new JTable(this.model);
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  this.setField(new JScrollPane(this.table));
  this.getField().setLocation(x,y);
  this.getField().setSize(width,this.height);
  JLabel label=createLabel();
  label.setLocation(label.getX(),y);
  panel.add(label);
  panel.add(this.getField());
  return y + this.getField().getHeight();
}

Fixed version (ground truth):
public int createField(JPanel panel,int x,int y,int width){
  this.table=new JTable(this.model);
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  for (int i=0; i < this.model.getColumnCount(); i++) {
    TableColumn col=table.getColumnModel().getColumn(i);
    col.setPreferredWidth(125);
  }
  this.setField(new JScrollPane(this.table));
  this.getField().setLocation(x,y);
  this.getField().setSize(width,this.height);
  JLabel label=createLabel();
  label.setLocation(label.getX(),y);
  panel.add(label);
  panel.add(this.getField());
  return y + this.getField().getHeight();
}
Program: 17797
Project: 17797
Buggy source:
public void actionPerformed(final ActionEvent action){
  if (action.getSource() == this.popupNetworkLayerEdit) {
    if (this.selected instanceof ContextLayer)     performContextLayerEdit();
 else     if (this.selected instanceof RadialBasisFunctionLayer)     performRadialLayerEdit();
 else     if (this.selected instanceof BasicLayer)     performBasicLayerEdit();
  }
 else   if (action.getSource() == this.popupNetworkLayerDelete) {
    performLayerDelete();
  }
 else   if (action.getSource() == this.popupNetworkSynapseDelete) {
    performSynapseDelete();
  }
 else   if (action.getSource() == this.popupNetworkSynapseMatrix) {
    performSynapseMatrix();
  }
 else   if (action.getSource() == this.popupNetworkSynapseNEAT) {
    performSynapseNEAT();
  }
}

Fixed version (ground truth):
public void actionPerformed(final ActionEvent action){
  if (action.getSource() == this.popupNetworkLayerEdit) {
    if (this.selected instanceof ContextLayer)     performContextLayerEdit();
 else     if (this.selected instanceof RadialBasisFunctionLayer)     performRadialLayerEdit();
 else     if (this.selected instanceof BasicLayer)     performBasicLayerEdit();
  }
 else   if (action.getSource() == this.popupNetworkLayerDelete) {
    performLayerDelete();
  }
 else   if (action.getSource() == this.popupNetworkSynapseDelete) {
    performSynapseDelete();
  }
 else   if (action.getSource() == this.popupNetworkSynapseEdit) {
    performEditSynapse();
  }
}
Program: 17798
Project: 17798
Buggy source:
private void rightClick(MouseEvent e){
  int x=e.getX();
  int y=e.getY();
  Layer clickedLayer=this.findLayer(e);
  if (clickedLayer != null) {
    this.popupNetworkLayer.show(e.getComponent(),x,y);
  }
 else {
    Synapse synapse=this.findSynapse(e);
    if (synapse != null) {
      this.popupNetworkSynapseNEAT.setEnabled(synapse instanceof NEATSynapse);
      this.popupNetworkSynapseMatrix.setEnabled(!(synapse instanceof NEATSynapse));
      this.popupNetworkSynapse.show(e.getComponent(),x,y);
    }
  }
}

Fixed version (ground truth):
private void rightClick(MouseEvent e){
  int x=e.getX();
  int y=e.getY();
  Layer clickedLayer=this.findLayer(e);
  if (clickedLayer != null) {
    this.popupNetworkLayer.show(e.getComponent(),x,y);
  }
 else {
    Synapse synapse=this.findSynapse(e);
    if (synapse != null) {
      this.popupNetworkSynapse.show(e.getComponent(),x,y);
    }
  }
}
Program: 17799
Project: 17799
Buggy source:
public NetworkDiagram(NetworkTab parent){
  this.parent=parent;
  this.addMouseListener(this);
  this.addMouseMotionListener(this);
  this.setPreferredSize(new Dimension(VIRTUAL_HEIGHT,VIRTUAL_WIDTH));
  getLayers();
  this.popupNetworkLayer=new JPopupMenu();
  this.popupNetworkLayerEdit=addItem(this.popupNetworkLayer,"String_Node_Str",'e');
  this.popupNetworkLayerDelete=addItem(this.popupNetworkLayer,"String_Node_Str",'d');
  this.popupNetworkSynapse=new JPopupMenu();
  this.popupNetworkSynapseDelete=addItem(this.popupNetworkSynapse,"String_Node_Str",'d');
  this.popupNetworkSynapseMatrix=addItem(this.popupNetworkSynapse,"String_Node_Str",'m');
  this.popupNetworkSynapseNEAT=addItem(this.popupNetworkSynapse,"String_Node_Str",'n');
}

Fixed version (ground truth):
public NetworkDiagram(NetworkTab parent){
  this.parent=parent;
  this.addMouseListener(this);
  this.addMouseMotionListener(this);
  this.setPreferredSize(new Dimension(VIRTUAL_HEIGHT,VIRTUAL_WIDTH));
  getLayers();
  this.popupNetworkLayer=new JPopupMenu();
  this.popupNetworkLayerEdit=addItem(this.popupNetworkLayer,"String_Node_Str",'e');
  this.popupNetworkLayerDelete=addItem(this.popupNetworkLayer,"String_Node_Str",'d');
  this.popupNetworkSynapse=new JPopupMenu();
  this.popupNetworkSynapseDelete=addItem(this.popupNetworkSynapse,"String_Node_Str",'d');
  this.popupNetworkSynapseEdit=addItem(this.popupNetworkSynapse,"String_Node_Str",'m');
}
Program: 17801
Project: 17801
Buggy source:
private static String adjustDirSymbol(String str,char replace){
  StringBuilder result=new StringBuilder();
  for (int i=0; i < str.length(); i++) {
    char ch=str.charAt(i);
    if (ch == File.pathSeparatorChar)     ch=replace;
    result.append(replace);
  }
  return result.toString();
}

Fixed version (ground truth):
private static String adjustDirSymbol(String str,char replace){
  StringBuilder result=new StringBuilder();
  for (int i=0; i < str.length(); i++) {
    char ch=str.charAt(i);
    if (ch == File.pathSeparatorChar)     ch=replace;
    result.append(ch);
  }
  return result.toString();
}
Program: 17802
Project: 17802
Buggy source:
public void generateMain(){
  this.addLine("String_Node_Str");
  this.addLine("String_Node_Str");
  this.addNewLine();
  this.forwardIndent();
  this.addLine("String_Node_Str");
  for (  Layer layer : this.getNetwork().getLayerTags().values()) {
    if (!this.knownLayer(layer)) {
      generateLayer(layer,layer,null);
    }
  }
  generateTags();
  this.addLine("String_Node_Str");
  this.addLine("String_Node_Str");
  this.backwardIndent();
  this.addLine("String_Node_Str");
}

Fixed version (ground truth):
public void generateMain(){
  this.addLine("String_Node_Str");
  this.addLine("String_Node_Str");
  this.addNewLine();
  this.forwardIndent();
  this.addLine("String_Node_Str");
  this.addNewLine();
  for (  Layer layer : this.getNetwork().getStructure().getLayers()) {
    generateLayer(layer);
  }
  this.addNewLine();
  for (  Synapse synapse : this.getNetwork().getStructure().getSynapses()) {
    generateSynapse(synapse);
  }
  this.addNewLine();
  for (  Layer layer : this.getNetwork().getStructure().getLayers()) {
    addSynapsesToLayer(layer);
  }
  this.addNewLine();
  generateTags();
  this.addNewLine();
  this.addLine("String_Node_Str");
  this.addLine("String_Node_Str");
  this.backwardIndent();
  this.addLine("String_Node_Str");
}
Program: 17804
Project: 17804
Buggy source:
public void setValueAt(final Object value,final int rowIndex,final int columnIndex){
}

Fixed version (ground truth):
public void setValueAt(final Object value,final int rowIndex,final int columnIndex){
  double v=0;
  try {
    v=Double.parseDouble(value.toString());
  }
 catch (  NumberFormatException e) {
  }
  this.synapse.getMatrix().set(rowIndex,columnIndex - 1,v);
}
Program: 17805
Project: 17805
Buggy source:
public void changeEquation(){
  boolean der=this.derivative.isSelected();
  ActivationFunction newActivation=null;
switch (this.select.getSelectedIndex()) {
case 0:
    newActivation=new ActivationBiPolar();
  break;
case 1:
newActivation=new ActivationCompetitive();
break;
case 2:
newActivation=new ActivationGaussian(0,1,1);
break;
case 3:
newActivation=new ActivationLinear();
break;
case 4:
newActivation=new ActivationLOG();
break;
case 5:
newActivation=new ActivationSigmoid();
break;
case 6:
newActivation=new ActivationSIN();
break;
case 7:
newActivation=new ActivationSoftMax();
break;
case 8:
newActivation=new ActivationTANH();
break;
}
if (this.activation.getClass() != newActivation.getClass()) {
this.equation.setupEquation(newActivation,!der);
this.activation=newActivation;
}
if (this.activation instanceof ActivationGaussian) {
this.gaussian.setEnabled(true);
}
 else {
this.gaussian.setEnabled(false);
}
}

Fixed version (ground truth):
public void changeEquation(){
  boolean der=this.derivative.isSelected();
  ActivationFunction newActivation=null;
switch (this.select.getSelectedIndex()) {
case 0:
    newActivation=new ActivationBiPolar();
  break;
case 1:
newActivation=new ActivationCompetitive();
break;
case 2:
newActivation=new ActivationGaussian(0,1,1);
break;
case 3:
newActivation=new ActivationLinear();
break;
case 4:
newActivation=new ActivationLOG();
break;
case 5:
newActivation=new ActivationSigmoid();
break;
case 6:
newActivation=new ActivationSIN();
break;
case 7:
newActivation=new ActivationSoftMax();
break;
case 8:
newActivation=new ActivationTANH();
break;
}
if (this.activation.getClass() != newActivation.getClass()) {
this.activation=newActivation;
}
this.equation.setupEquation(newActivation,!der);
if (this.activation instanceof ActivationGaussian) {
this.gaussian.setEnabled(true);
}
 else {
this.gaussian.setEnabled(false);
}
}
Program: 17806
Project: 17806
Buggy source:
public void windowClosing(final WindowEvent e){
  super.windowClosing(e);
  EncogWorkBench.saveConfig();
}

Fixed version (ground truth):
public void windowClosing(final WindowEvent e){
  if (!this.closed) {
    if (EncogWorkBench.displayQuery("String_Node_Str","String_Node_Str")) {
      this.operations.performFileSave();
    }
    this.closed=true;
  }
  super.windowClosing(e);
  EncogWorkBench.saveConfig();
}
Program: 17807
Project: 17807
Buggy source:
public static void drawLayer(NetworkDiagram diagram,Graphics g,Layer layer){
  NetworkTool tool=diagram.getNetworkFrame().findTool(layer);
  g.setColor(Color.WHITE);
  g.fillRect(layer.getX(),layer.getY(),LAYER_WIDTH,LAYER_HEIGHT);
  g.setColor(Color.BLACK);
  tool.getIcon().paintIcon(diagram,g,layer.getX(),layer.getY());
  g.drawRect(layer.getX(),layer.getY(),NetworkTool.WIDTH,NetworkTool.HEIGHT);
  g.drawRect(layer.getX(),layer.getY(),LAYER_WIDTH,LAYER_HEIGHT);
  g.drawRect(layer.getX() - 1,layer.getY() - 1,LAYER_WIDTH,LAYER_HEIGHT);
  g.setFont(WorkbenchFonts.getTitle2Font());
  FontMetrics fm=g.getFontMetrics();
  int y=layer.getY() + fm.getHeight() + NetworkTool.HEIGHT;
  g.drawString(tool.getName() + "String_Node_Str",layer.getX() + 2,y);
  y+=fm.getHeight();
  g.setFont(WorkbenchFonts.getTextFont());
  String act="String_Node_Str";
  if (!(layer instanceof RadialBasisFunctionLayer)) {
    final String a="String_Node_Str";
    act=layer.getActivationFunction().getClass().getSimpleName();
    if (act.startsWith(a)) {
      act=act.substring(a.length());
    }
  }
  g.drawString(act,layer.getX() + 2,y);
  drawNeuronCount(g,layer);
}

Fixed version (ground truth):
public static void drawLayer(NetworkDiagram diagram,Graphics g,Layer layer){
  NetworkTool tool=diagram.getNetworkFrame().findTool(layer);
  g.setColor(Color.WHITE);
  g.fillRect(layer.getX(),layer.getY(),LAYER_WIDTH,LAYER_HEIGHT);
  g.setColor(Color.BLACK);
  tool.getIcon().paintIcon(diagram,g,layer.getX(),layer.getY());
  g.drawRect(layer.getX(),layer.getY(),NetworkTool.WIDTH,NetworkTool.HEIGHT);
  g.drawRect(layer.getX(),layer.getY(),LAYER_WIDTH,LAYER_HEIGHT);
  g.drawRect(layer.getX() - 1,layer.getY() - 1,LAYER_WIDTH,LAYER_HEIGHT);
  g.setFont(WorkbenchFonts.getTitle2Font());
  FontMetrics fm=g.getFontMetrics();
  int y=layer.getY() + NetworkTool.HEIGHT + fm.getAscent();
  g.drawString(tool.getName() + "String_Node_Str",layer.getX() + 2,y);
  y+=fm.getAscent();
  g.setFont(WorkbenchFonts.getTextFont());
  String act="String_Node_Str";
  if (!(layer instanceof RadialBasisFunctionLayer)) {
    final String a="String_Node_Str";
    act=layer.getActivationFunction().getClass().getSimpleName();
    if (act.startsWith(a)) {
      act=act.substring(a.length());
    }
  }
  g.drawString(act,layer.getX() + 2,y);
  drawNeuronCount(g,layer);
}
Program: 17808
Project: 17808
Buggy source:
public Polygon obtainPologygon(){
  Polygon result=new Polygon();
  if (this.fromSide == Side.Left || this.fromSide == Side.Right) {
    result.addPoint((int)this.from.getX(),(int)from.getY() - 10);
    result.addPoint((int)this.from.getX(),(int)from.getY() + 10);
    result.addPoint((int)this.to.getX(),(int)to.getY() + 10);
    result.addPoint((int)this.to.getX(),(int)to.getY() - 10);
  }
 else {
    result.addPoint((int)this.from.getX() - 10,(int)from.getY());
    result.addPoint((int)this.from.getX() + 10,(int)from.getY());
    result.addPoint((int)this.to.getX() + 10,(int)to.getY());
    result.addPoint((int)this.to.getX() - 10,(int)to.getY());
  }
  return result;
}

Fixed version (ground truth):
public Polygon obtainPologygon(){
  Polygon result=new Polygon();
  if (this.synapse.isSelfConnected()) {
    int x=(int)this.synapse.getFromLayer().getX() + DrawLayer.LAYER_WIDTH;
    int y=(int)this.synapse.getFromLayer().getY();
    result.addPoint(x - 10,y - 10);
    result.addPoint(x + 10,y - 10);
    result.addPoint(x + 10,y + 10);
    result.addPoint(x - 10,y + 10);
  }
 else   if (this.fromSide == Side.Left || this.fromSide == Side.Right) {
    result.addPoint((int)this.from.getX(),(int)from.getY() - 10);
    result.addPoint((int)this.from.getX(),(int)from.getY() + 10);
    result.addPoint((int)this.to.getX(),(int)to.getY() + 10);
    result.addPoint((int)this.to.getX(),(int)to.getY() - 10);
  }
 else {
    result.addPoint((int)this.from.getX() - 10,(int)from.getY());
    result.addPoint((int)this.from.getX() + 10,(int)from.getY());
    result.addPoint((int)this.to.getX() + 10,(int)to.getY());
    result.addPoint((int)this.to.getX() - 10,(int)to.getY());
  }
  return result;
}
Program: 17809
Project: 17809
Buggy source:
public CalculateArrow(Synapse synapse,boolean moveBack){
  int xOffset=0;
  int yOffset=0;
  if ((synapse.getToLayer().getX() >= synapse.getFromLayer().getX()) && (synapse.getToLayer().getX() <= (synapse.getFromLayer().getX() + DrawLayer.LAYER_WIDTH * 1.5)) || (synapse.getFromLayer().getX() >= synapse.getToLayer().getX()) && (synapse.getFromLayer().getX() <= (synapse.getToLayer().getX() + DrawLayer.LAYER_WIDTH * 1.5))) {
    if (synapse.getToLayer().getY() > synapse.getFromLayer().getY()) {
      fromSide=Side.Bottom;
      toSide=Side.Top;
    }
 else {
      fromSide=Side.Top;
      toSide=Side.Bottom;
    }
  }
 else {
    if (synapse.getToLayer().getX() > synapse.getFromLayer().getX()) {
      fromSide=Side.Right;
      toSide=Side.Left;
      if (isBackConnected(synapse))       yOffset=(DrawLayer.LAYER_HEIGHT / 4);
    }
 else {
      fromSide=Side.Left;
      toSide=Side.Right;
      yOffset=-(DrawLayer.LAYER_HEIGHT / 4);
    }
  }
  from=findSide(fromSide,synapse.getFromLayer());
  to=findSide(toSide,synapse.getToLayer());
  from.setLocation(from.getX() + xOffset,from.getY() + yOffset);
  to.setLocation(to.getX() + xOffset,to.getY() + yOffset);
  if (moveBack)   to=moveArrowBack(toSide,to);
}

Fixed version (ground truth):
public CalculateArrow(Synapse synapse,boolean moveBack){
  int xOffset=0;
  int yOffset=0;
  this.synapse=synapse;
  if ((synapse.getToLayer().getX() >= synapse.getFromLayer().getX()) && (synapse.getToLayer().getX() <= (synapse.getFromLayer().getX() + DrawLayer.LAYER_WIDTH * 1.5)) || (synapse.getFromLayer().getX() >= synapse.getToLayer().getX()) && (synapse.getFromLayer().getX() <= (synapse.getToLayer().getX() + DrawLayer.LAYER_WIDTH * 1.5))) {
    if (synapse.getToLayer().getY() > synapse.getFromLayer().getY()) {
      fromSide=Side.Bottom;
      toSide=Side.Top;
    }
 else {
      fromSide=Side.Top;
      toSide=Side.Bottom;
    }
  }
 else {
    if (synapse.getToLayer().getX() > synapse.getFromLayer().getX()) {
      fromSide=Side.Right;
      toSide=Side.Left;
      if (isBackConnected(synapse))       yOffset=(DrawLayer.LAYER_HEIGHT / 4);
    }
 else {
      fromSide=Side.Left;
      toSide=Side.Right;
      yOffset=-(DrawLayer.LAYER_HEIGHT / 4);
    }
  }
  from=findSide(fromSide,synapse.getFromLayer());
  to=findSide(toSide,synapse.getToLayer());
  from.setLocation(from.getX() + xOffset,from.getY() + yOffset);
  to.setLocation(to.getX() + xOffset,to.getY() + yOffset);
  if (moveBack)   to=moveArrowBack(toSide,to);
}
Program: 17810
Project: 17810
Buggy source:
private void fixOrphans(){
  BasicNetwork network=(BasicNetwork)this.parent.getEncogObject();
  for (  Layer layer : network.getStructure().getLayers()) {
    this.orphanLayers.remove(layer);
  }
}

Fixed version (ground truth):
public void fixOrphans(){
  BasicNetwork network=(BasicNetwork)this.parent.getEncogObject();
  for (  Layer layer : network.getStructure().getLayers()) {
    this.orphanLayers.remove(layer);
  }
}