nus-yam/ex-repair huggingface dataset:
Program: 75910
Project: 75910
Buggy source:
/** 
 * Create a ModelPane to control execution of the model and display its results.  Derived classes may override this to do something different.
 */
protected void _createView(){
  String orientationSpec=getParameter("String_Node_Str");
  int orientation=ModelPane.VERTICAL;
  if (orientationSpec != null) {
    if (orientationSpec.trim().toLowerCase().equals("String_Node_Str")) {
      orientation=ModelPane.HORIZONTAL;
    }
 else     if (orientationSpec.trim().toLowerCase().equals("String_Node_Str")) {
      orientation=ModelPane.CONTROLS_ONLY;
    }
  }
  String controlsSpec=getParameter("String_Node_Str");
  int controls=ModelPane.BUTTONS;
  if (controlsSpec != null) {
    controls=0;
    StringTokenizer tokenizer=new StringTokenizer(controlsSpec,"String_Node_Str");
    while (tokenizer.hasMoreTokens()) {
      String controlSpec=tokenizer.nextToken().trim().toLowerCase();
      if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.BUTTONS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.TOP_PARAMETERS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.DIRECTOR_PARAMETERS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=0;
      }
 else {
        report("String_Node_Str" + controlSpec);
      }
    }
  }
  ModelPane pane=new ModelPane(_toplevel,orientation,controls);
  pane.setBackground(null);
  getContentPane().add(pane);
}

Fixed version (ground truth):
/** 
 * Create a ModelPane to control execution of the model and display its results.  Derived classes may override this to do something different.
 */
protected void _createView(){
  if (!(_toplevel instanceof CompositeActor))   return;
  String orientationSpec=getParameter("String_Node_Str");
  int orientation=ModelPane.VERTICAL;
  if (orientationSpec != null) {
    if (orientationSpec.trim().toLowerCase().equals("String_Node_Str")) {
      orientation=ModelPane.HORIZONTAL;
    }
 else     if (orientationSpec.trim().toLowerCase().equals("String_Node_Str")) {
      orientation=ModelPane.CONTROLS_ONLY;
    }
  }
  String controlsSpec=getParameter("String_Node_Str");
  int controls=ModelPane.BUTTONS;
  if (controlsSpec != null) {
    controls=0;
    StringTokenizer tokenizer=new StringTokenizer(controlsSpec,"String_Node_Str");
    while (tokenizer.hasMoreTokens()) {
      String controlSpec=tokenizer.nextToken().trim().toLowerCase();
      if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.BUTTONS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.TOP_PARAMETERS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=controls | ModelPane.DIRECTOR_PARAMETERS;
      }
 else       if (controlSpec.equals("String_Node_Str")) {
        controls=0;
      }
 else {
        report("String_Node_Str" + controlSpec);
      }
    }
  }
  ModelPane pane=new ModelPane(((CompositeActor)_toplevel),orientation,controls);
  pane.setBackground(null);
  getContentPane().add(pane);
}
Program: 75911
Project: 75911
Buggy source:
/** 
 * Consume the inputs and produce the outputs of the FIR filter.
 * @exception IllegalActionException If parameter values are invalid,or if there is no director, or if runtime type conflicts occur.
 */
public void fire() throws IllegalActionException {
  if (_reinitializeNeeded)   _reinitialize();
  int phase=_dec - _decPhase - 1;
  if (--_mostRecent < 0)   _mostRecent=_data.length - 1;
  _data[_mostRecent]=input.get(0);
  for (int inC=1; inC <= _dec; inC++) {
    while (phase < _interp) {
      _outToken=_zero;
      for (int i=0; i < _phaseLength; i++) {
        int tapsIndex=i * _interp + phase;
        int dataIndex=(_mostRecent + _dec - inC + i) % (_data.length);
        if (tapsIndex < _taps.length) {
          _tapItem=_taps[tapsIndex];
          _dataItem=_data[dataIndex];
          _dataItem=_tapItem.multiply(_dataItem);
          _outToken=_outToken.add(_dataItem);
        }
 else {
          _dataItem=_data[dataIndex];
          _outToken=_outToken.add(_dataItem);
        }
      }
      output.send(0,_outToken);
      phase+=_dec;
    }
    phase-=_interp;
  }
}

Fixed version (ground truth):
/** 
 * Consume the inputs and produce the outputs of the FIR filter.
 * @exception IllegalActionException If parameter values are invalid,or if there is no director, or if runtime type conflicts occur.
 */
public void fire() throws IllegalActionException {
  if (_reinitializeNeeded)   _reinitialize();
  int phase=_dec - _decPhase - 1;
  if (--_mostRecent < 0)   _mostRecent=_data.length - 1;
  _data[_mostRecent]=input.get(0);
  for (int inC=1; inC <= _dec; inC++) {
    while (phase < _interp) {
      _outToken=_zero;
      for (int i=0; i < _phaseLength; i++) {
        int tapsIndex=i * _interp + phase;
        int dataIndex=(_mostRecent + _dec - inC + i) % (_data.length);
        if (tapsIndex < _taps.length) {
          _tapItem=_taps[tapsIndex];
          _dataItem=_data[dataIndex];
          _dataItem=_tapItem.multiply(_dataItem);
          _outToken=_outToken.add(_dataItem);
        }
      }
      output.send(0,_outToken);
      phase+=_dec;
    }
    phase-=_interp;
  }
}
Program: 75912
Project: 75912
Buggy source:
private void _reinitialize() throws IllegalActionException {
  if (_decPhase >= _dec) {
    throw new IllegalActionException(this,"String_Node_Str" + _decPhase + "String_Node_Str"+ _dec+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interp);
  if ((_taps.length % _interp) != 0)   _phaseLength++;
  int datalength=_taps.length / _interp;
  if (_taps.length % _interp != 0)   datalength++;
  if (_data == null || _data.length != datalength) {
    _data=new Token[datalength];
    for (int i=0; i < datalength; i++) {
      _data[i]=_zero;
    }
    _mostRecent=datalength;
  }
}

Fixed version (ground truth):
private void _reinitialize() throws IllegalActionException {
  if (_decPhase >= _dec) {
    throw new IllegalActionException(this,"String_Node_Str" + _decPhase + "String_Node_Str"+ _dec+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interp);
  if ((_taps.length % _interp) != 0)   _phaseLength++;
  if (_data == null || _data.length != _phaseLength) {
    _data=new Token[_phaseLength];
    for (int i=0; i < _phaseLength; i++) {
      _data[i]=_zero;
    }
    _mostRecent=_phaseLength;
  }
  _reinitializeNeeded=false;
}
Program: 75913
Project: 75913
Buggy source:
public void setFont(Font font){
  int size=font.getSize();
  boolean bold=font.isBold();
  if (bold) {
    _buffer.append("String_Node_Str");
  }
 else {
    _buffer.append("String_Node_Str");
  }
  _buffer.append("String_Node_Str" + size + "String_Node_Str");
  _currentFont=font;
}

Fixed version (ground truth):
public void setFont(Font font){
  if (font == null)   return;
  int size=font.getSize();
  boolean bold=font.isBold();
  if (bold) {
    _buffer.append("String_Node_Str");
  }
 else {
    _buffer.append("String_Node_Str");
  }
  _buffer.append("String_Node_Str" + size + "String_Node_Str");
  _currentFont=font;
}
Program: 75914
Project: 75914
Buggy source:
/** 
 * Construct a plot box with a default configuration. 
 */
public PlotBox(){
  setOpaque(true);
  setLayout(new FlowLayout(FlowLayout.RIGHT,2,2));
  addMouseListener(new ZoomListener());
  addKeyListener(new CommandListener());
  addMouseMotionListener(new DragListener());
  _measureFonts();
  requestFocus();
}

Fixed version (ground truth):
/** 
 * Construct a plot box with a default configuration. 
 */
public PlotBox(){
  setOpaque(true);
  setLayout(new FlowLayout(FlowLayout.RIGHT,2,2));
  addMouseListener(new ZoomListener());
  addKeyListener(new CommandListener());
  addMouseMotionListener(new DragListener());
  _measureFonts();
}
Program: 75915
Project: 75915
Buggy source:
/** 
 * Rescale so that the data that is currently plotted just fits. This is done based on the protected variables _xBottom, _xTop, _yBottom, and _yTop.  It is up to derived classes to ensure that variables are valid. This method calls repaint(), which eventually causes the display to be updated.
 */
public synchronized void fillPlot(){
  setXRange(_xBottom,_xTop);
  setYRange(_yBottom,_yTop);
  repaint();
  requestFocus();
}

Fixed version (ground truth):
/** 
 * Rescale so that the data that is currently plotted just fits. This is done based on the protected variables _xBottom, _xTop, _yBottom, and _yTop.  It is up to derived classes to ensure that variables are valid. This method calls repaint(), which eventually causes the display to be updated.
 */
public synchronized void fillPlot(){
  setXRange(_xBottom,_xTop);
  setYRange(_yBottom,_yTop);
  repaint();
}
Program: 75916
Project: 75916
Buggy source:
/** 
 * Export a description of the plot. Currently, only EPS is supported.  But in the future, this may cause a dialog box to open to allow the user to select a format.  If the argument is null, then the description goes to the clipboard.  Otherwise, it goes to the specified file. To send it to standard output, use <code>System.out</code> as an argument.
 * @param file A file writer to which to send the description.
 */
public synchronized void export(OutputStream out){
  EPSGraphics g=new EPSGraphics(out,_width,_height);
  _drawPlot(g,false);
  g.showpage();
}

Fixed version (ground truth):
/** 
 * Export a description of the plot. Currently, only EPS is supported.  But in the future, this may cause a dialog box to open to allow the user to select a format.  If the argument is null, then the description goes to the clipboard.  Otherwise, it goes to the specified file. To send it to standard output, use <code>System.out</code> as an argument.
 * @param file A file writer to which to send the description.
 */
public synchronized void export(OutputStream out){
  try {
    EPSGraphics g=new EPSGraphics(out,_width,_height);
    _drawPlot(g,false);
    g.showpage();
  }
 catch (  RuntimeException ex) {
    String message="String_Node_Str" + ex.getMessage();
    JOptionPane.showMessageDialog(this,message,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    throw (RuntimeException)ex.fillInStackTrace();
  }
}
Program: 75918
Project: 75918
Buggy source:
/** 
 * Paint the component contents, which in this base class is only the axes.
 * @param graphics The graphics context.
 */
public void paintComponent(Graphics graphics){
  super.paintComponent(graphics);
  _drawPlot(graphics,true);
  requestFocus();
}

Fixed version (ground truth):
/** 
 * Paint the component contents, which in this base class is only the axes.
 * @param graphics The graphics context.
 */
public void paintComponent(Graphics graphics){
  super.paintComponent(graphics);
  _drawPlot(graphics,true);
}
Program: 75919
Project: 75919
Buggy source:
public void mouseClicked(MouseEvent event){
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent event){
  requestFocus();
}
Program: 75920
Project: 75920
Buggy source:
/** 
 * Create a background figure based on this icon.  The background figure will be painted with each graphic element that this icon contains.
 * @return A figure for this icon.
 */
public Figure createBackgroundFigure(){
  NamedObj container=(NamedObj)getContainer();
  SingletonConfigurableAttribute description=(SingletonConfigurableAttribute)container.getAttribute("String_Node_Str");
  if (_description != description) {
    if (_description != null) {
      _description.removeValueListener(this);
    }
    _description=description;
    if (_description != null) {
      _description.addValueListener(this);
    }
    _updatePaintedList();
  }
  if (_paintedList == null) {
    return _createDefaultBackgroundFigure();
  }
 else {
    return new PaintedFigure(_paintedList);
  }
}

Fixed version (ground truth):
/** 
 * Create a background figure based on this icon.  The background figure will be painted with each graphic element that this icon contains.
 * @return A figure for this icon.
 */
public Figure createBackgroundFigure(){
  NamedObj container=(NamedObj)getContainer();
  SingletonConfigurableAttribute description=(SingletonConfigurableAttribute)container.getAttribute("String_Node_Str");
  if (_description != description) {
    if (_description != null) {
      _description.removeValueListener(this);
    }
    _description=description;
    if (_description != null) {
      _description.addValueListener(this);
    }
    _recreateFigure();
  }
  paintedList();
  if (_paintedList == null) {
    return _createDefaultBackgroundFigure();
  }
 else {
    return new PaintedFigure(_paintedList);
  }
}
Program: 75921
Project: 75921
Buggy source:
/** 
 * React to the fact that the value of an attribute named "_iconDescription" contained by the same container has changed value by redrawing the figure.
 * @param settable The object that has changed value.
 */
public void valueChanged(Settable settable){
  if (((Nameable)settable).getName().equals("String_Node_Str")) {
    _recreateFigure();
    _paintedList=null;
  }
}

Fixed version (ground truth):
/** 
 * React to the fact that the value of an attribute named "_iconDescription" contained by the same container has changed value by redrawing the figure.
 * @param settable The object that has changed value.
 */
public void valueChanged(Settable settable){
  if (((Nameable)settable).getName().equals("String_Node_Str")) {
    _recreateFigure();
  }
}
Program: 75922
Project: 75922
Buggy source:
/** 
 * If the argument is the <i>identifier</i> parameter, then set the title of all contained Tableaux to the value of the parameter; if the argument is the <i>url</i> parameter, then check to see whether it is writable, and call setModifiable() appropriately.
 * @exception IllegalActionException If the base class throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == identifier) {
    Iterator tableaux=entityList(Tableau.class).iterator();
    while (tableaux.hasNext()) {
      Tableau tableau=(Tableau)tableaux.next();
      tableau.setTitle(identifier.getExpression());
    }
  }
 else   if (attribute == url) {
    URL u=url.getURL();
    if (u == null) {
      _modifiableURL=false;
    }
 else {
      String protocol=u.getProtocol();
      if (!(protocol.equals("String_Node_Str"))) {
        _modifiableURL=false;
      }
 else {
        String filename=u.getFile();
        File file=new File(filename);
        _modifiableURL=file.canWrite();
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the argument is the <i>identifier</i> parameter, then set the title of all contained Tableaux to the value of the parameter; if the argument is the <i>url</i> parameter, then check to see whether it is writable, and call setModifiable() appropriately.
 * @exception IllegalActionException If the base class throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == identifier) {
    Iterator tableaux=entityList(Tableau.class).iterator();
    while (tableaux.hasNext()) {
      Tableau tableau=(Tableau)tableaux.next();
      tableau.setTitle(identifier.getExpression());
    }
  }
 else   if (attribute == url) {
    URL u=url.getURL();
    if (u == null) {
      _modifiableURL=true;
    }
 else {
      String protocol=u.getProtocol();
      if (!(protocol.equals("String_Node_Str"))) {
        _modifiableURL=false;
      }
 else {
        String filename=u.getFile();
        File file=new File(filename);
        _modifiableURL=file.canWrite();
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75925
Project: 75925
Buggy source:
/** 
 * Create a new effigy in the given container by reading the specified URL. If the specified URL is null, then create a blank effigy. The extension of the URL is not checked, so this will open any file. The new effigy will have a new instance of DefaultStyledDocument associated with it.
 * @param container The container for the effigy.
 * @param base The base for relative file references, or null ifthere are no relative file references.  This is ignored in this class.
 * @param in The input URL.
 * @return A new instance of TextEffigy.
 * @exception Exception If the URL cannot be read, or if the datais malformed in some way.
 */
public static TextEffigy newTextEffigy(CompositeEntity container,URL base,URL in) throws Exception {
  TextEffigy effigy=new TextEffigy(container,container.uniqueName("String_Node_Str"));
  Document doc=new DefaultStyledDocument();
  effigy.setDocument(doc);
  if (in != null) {
    BufferedReader reader=new BufferedReader(new InputStreamReader(in.openStream()));
    String line=reader.readLine();
    while (line != null) {
      doc.insertString(doc.getLength(),line + "String_Node_Str",null);
      line=reader.readLine();
    }
    reader.close();
    if (in.getProtocol().equals("String_Node_Str")) {
      String filename=in.getFile();
      File file=new File(filename);
      if (!file.canWrite()) {
        effigy.setModifiable(false);
      }
    }
 else {
      effigy.setModifiable(false);
    }
  }
  effigy.url.setURL(in);
  return effigy;
}

Fixed version (ground truth):
/** 
 * Create a new effigy in the given container by reading the specified URL. If the specified URL is null, then create a blank effigy. The extension of the URL is not checked, so this will open any file. The new effigy will have a new instance of DefaultStyledDocument associated with it.
 * @param container The container for the effigy.
 * @param base The base for relative file references, or null ifthere are no relative file references.  This is ignored in this class.
 * @param in The input URL.
 * @return A new instance of TextEffigy.
 * @exception Exception If the URL cannot be read, or if the datais malformed in some way.
 */
public static TextEffigy newTextEffigy(CompositeEntity container,URL base,URL in) throws Exception {
  TextEffigy effigy=new TextEffigy(container,container.uniqueName("String_Node_Str"));
  Document doc=new DefaultStyledDocument();
  effigy.setDocument(doc);
  if (in != null) {
    BufferedReader reader=new BufferedReader(new InputStreamReader(in.openStream()));
    String line=reader.readLine();
    while (line != null) {
      doc.insertString(doc.getLength(),line + "String_Node_Str",null);
      line=reader.readLine();
    }
    reader.close();
    if (in.getProtocol().equals("String_Node_Str")) {
      String filename=in.getFile();
      File file=new File(filename);
      if (!file.canWrite()) {
        effigy.setModifiable(false);
      }
    }
 else {
      effigy.setModifiable(false);
    }
  }
 else {
    effigy.setModifiable(true);
  }
  effigy.url.setURL(in);
  return effigy;
}
Program: 75926
Project: 75926
Buggy source:
/** 
 * Print out the current state.
 */
public String toString(){
  return new String("String_Node_Str" + getManager() + "String_Node_Str"+ getDescription());
}

Fixed version (ground truth):
/** 
 * Print out the current state.
 */
public String toString(){
  return "String_Node_Str" + getDescription();
}
Program: 75927
Project: 75927
Buggy source:
/** 
 * Construct a configurer for the specified object.
 * @param object The object to configure.
 */
public Configurer(final NamedObj object){
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  _object=object;
  Iterator params=object.attributeList(Settable.class).iterator();
  while (params.hasNext()) {
    Settable param=(Settable)params.next();
    if (param.getVisibility() == Settable.FULL) {
      _originalValues.put(param.getName(),param.getExpression());
    }
  }
  boolean foundOne=false;
  Iterator editors=object.attributeList(EditorPaneFactory.class).iterator();
  while (editors.hasNext()) {
    foundOne=true;
    EditorPaneFactory editor=(EditorPaneFactory)editors.next();
    Component pane=editor.createEditorPane();
    add(pane);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
  if (!foundOne) {
    Component pane=EditorPaneFactory.createEditorPane(object);
    add(pane);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
}

Fixed version (ground truth):
/** 
 * Construct a configurer for the specified object.
 * @param object The object to configure.
 */
public Configurer(final NamedObj object){
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  _object=object;
  Iterator params=object.attributeList(Settable.class).iterator();
  while (params.hasNext()) {
    Settable param=(Settable)params.next();
    if (param.getVisibility() == Settable.FULL) {
      _originalValues.put(param.getName(),param.getExpression());
    }
  }
  boolean foundOne=false;
  Iterator editors=object.attributeList(EditorPaneFactory.class).iterator();
  while (editors.hasNext()) {
    foundOne=true;
    EditorPaneFactory editor=(EditorPaneFactory)editors.next();
    Component pane=editor.createEditorPane();
    add(pane);
    pane.setBackground(null);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
  if (!foundOne) {
    Component pane=EditorPaneFactory.createEditorPane(object);
    add(pane);
    pane.setBackground(null);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
}
Program: 75928
Project: 75928
Buggy source:
/** 
 * Read the model from the <i>model</i> applet parameter.
 * @return A model.
 * @throws Exception If something goes wrong.
 */
protected CompositeActor _createModel() throws Exception {
  String modelURL=getParameter("String_Node_Str");
  if (modelURL == null) {
    throw new Exception("String_Node_Str");
  }
  MoMLParser parser=new MoMLParser();
  URL docBase=getDocumentBase();
  URL xmlFile=new URL(docBase,modelURL);
  _manager=null;
  CompositeActor result=null;
  NamedObj toplevel=parser.parse(docBase,xmlFile);
  _workspace=toplevel.workspace();
  if (toplevel instanceof CompositeActor) {
    result=(CompositeActor)toplevel;
    _manager=result.getManager();
    if (_manager == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      result.setManager(_manager);
    }
    _manager.addExecutionListener(this);
  }
 else {
    throw new Exception("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Read the model from the <i>model</i> applet parameter.
 * @param workspace The workspace in which to create the model.
 * @return A model.
 * @throws Exception If something goes wrong.
 */
protected CompositeActor _createModel(Workspace workspace) throws Exception {
  String modelURL=getParameter("String_Node_Str");
  if (modelURL == null) {
    modelURL=getParameter("String_Node_Str");
    if (modelURL == null) {
      throw new Exception("String_Node_Str");
    }
  }
  MoMLParser parser=new MoMLParser();
  URL docBase=getDocumentBase();
  URL xmlFile=new URL(docBase,modelURL);
  _manager=null;
  CompositeActor result=null;
  NamedObj toplevel=parser.parse(docBase,xmlFile);
  _workspace=toplevel.workspace();
  if (toplevel instanceof CompositeActor) {
    result=(CompositeActor)toplevel;
    _manager=result.getManager();
    if (_manager == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      result.setManager(_manager);
    }
    _manager.addExecutionListener(this);
  }
 else {
    throw new Exception("String_Node_Str");
  }
  return result;
}
Program: 75929
Project: 75929
Buggy source:
/** 
 * Initialize the applet. This method is called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start() method is called. In this base class, this method creates a new workspace, and instantiates in it the model whose class name is given by the <i>modelClass</i> applet parameter.  If that model does not contain a manager, then this method creates one for it.
 */
public void init(){
  super.init();
  _setupOK=true;
  _workspace=new Workspace(getClass().getName());
  try {
    _toplevel=_createModel();
  }
 catch (  Exception ex) {
    _setupOK=false;
    report("String_Node_Str",ex);
  }
  _createView();
}

Fixed version (ground truth):
/** 
 * Initialize the applet. This method is called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start() method is called. In this base class, this method creates a new workspace, and instantiates in it the model whose class name is given by the <i>modelClass</i> applet parameter.  If that model does not contain a manager, then this method creates one for it.
 */
public void init(){
  super.init();
  _setupOK=true;
  _workspace=new Workspace(getClass().getName());
  try {
    _toplevel=_createModel(_workspace);
    if (_toplevel.getManager() == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      _manager.addExecutionListener(this);
      _toplevel.setManager(_manager);
    }
 else {
      _manager=_toplevel.getManager();
    }
  }
 catch (  Exception ex) {
    _setupOK=false;
    report("String_Node_Str",ex);
  }
  _createView();
}
Program: 75930
Project: 75930
Buggy source:
/** 
 * Execute the model, if the manager is not currently executing.
 * @exception IllegalActionException Not thrown in this base class.
 */
protected void _go() throws IllegalActionException {
  if (!_setupOK)   return;
  if (_manager.getState() == _manager.IDLE)   _manager.startRun();
}

Fixed version (ground truth):
/** 
 * Execute the model, if the manager is not currently executing. Note that this method is not called if there are button controls on the screen and the user pushes the "Go" button.
 * @exception IllegalActionException Not thrown in this base class.
 */
protected void _go() throws IllegalActionException {
  if (!_setupOK)   return;
  if (_manager.getState() == _manager.IDLE)   _manager.startRun();
}
Program: 75935
Project: 75935
Buggy source:
/** 
 * Read at most one token from each input channel and display its string value on the screen.  Each value is terminated with a newline character.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      Token token=input.get(i);
      String value=token.toString();
      if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str")) {
        value=value.substring(1,value.length() - 2);
      }
      textArea.append(value);
      if (width > i + 1)       textArea.append("String_Node_Str");
      try {
        int lineOffset=textArea.getLineStartOffset(textArea.getLineCount() - 1);
        textArea.setCaretPosition(lineOffset);
      }
 catch (      BadLocationException ex) {
      }
    }
  }
  textArea.append("String_Node_Str");
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Read at most one token from each input channel and display its string value on the screen.  Each value is terminated with a newline character.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      Token token=input.get(i);
      String value=token.toString();
      if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str")) {
        value=value.substring(1,value.length() - 1);
      }
      textArea.append(value);
      if (width > i + 1)       textArea.append("String_Node_Str");
      try {
        int lineOffset=textArea.getLineStartOffset(textArea.getLineCount() - 1);
        textArea.setCaretPosition(lineOffset);
      }
 catch (      BadLocationException ex) {
      }
    }
  }
  textArea.append("String_Node_Str");
  return super.postfire();
}
Program: 75936
Project: 75936
Buggy source:
/** 
 * Notify the listener that the change has failed with the specified exception.
 * @param change The change that has failed.
 * @param exception The exception that was thrown.
 */
public void changeFailed(ChangeRequest change,Exception exception){
  if (!change.isErrorReported()) {
    change.setErrorReported(true);
    MessageHandler.error("String_Node_Str",exception);
  }
  dispatchGraphEvent(new GraphEvent(AbstractPtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
}

Fixed version (ground truth):
/** 
 * Notify the listener that the change has failed with the specified exception.
 * @param change The change that has failed.
 * @param exception The exception that was thrown.
 */
public void changeFailed(ChangeRequest change,Exception exception){
  _update();
  if (!change.isErrorReported()) {
    change.setErrorReported(true);
    MessageHandler.error("String_Node_Str",exception);
  }
  dispatchGraphEvent(new GraphEvent(AbstractPtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
}
Program: 75937
Project: 75937
Buggy source:
/** 
 * Notify the listener that a change has been successfully executed. If the originator of this change is not this graph model, then issue a graph event to indicate that the structure of the graph has changed.
 * @param change The change that has been executed.
 */
public void changeExecuted(ChangeRequest change){
  if (change.getSource() == AbstractPtolemyGraphModel.this) {
    return;
  }
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      dispatchGraphEvent(new GraphEvent(AbstractPtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Notify the listener that a change has been successfully executed. If the originator of this change is not this graph model, then issue a graph event to indicate that the structure of the graph has changed.
 * @param change The change that has been executed.
 */
public void changeExecuted(ChangeRequest change){
  _update();
  if (change.getSource() == AbstractPtolemyGraphModel.this) {
    return;
  }
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      dispatchGraphEvent(new GraphEvent(AbstractPtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
    }
  }
);
}
Program: 75939
Project: 75939
Buggy source:
/** 
 * Read at most one token from each input channel and display its string value on the screen.  Each value is terminated with a newline character.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      Token token=input.get(i);
      String value=token.toString();
      if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str"))       ;
{
        value=value.substring(1,value.length() - 2);
      }
      textArea.append(value);
      if (width > i + 1)       textArea.append("String_Node_Str");
      try {
        int lineOffset=textArea.getLineStartOffset(textArea.getLineCount() - 1);
        textArea.setCaretPosition(lineOffset);
      }
 catch (      BadLocationException ex) {
      }
    }
  }
  textArea.append("String_Node_Str");
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Read at most one token from each input channel and display its string value on the screen.  Each value is terminated with a newline character.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      Token token=input.get(i);
      String value=token.toString();
      if (value.startsWith("String_Node_Str") && value.endsWith("String_Node_Str")) {
        value=value.substring(1,value.length() - 2);
      }
      textArea.append(value);
      if (width > i + 1)       textArea.append("String_Node_Str");
      try {
        int lineOffset=textArea.getLineStartOffset(textArea.getLineCount() - 1);
        textArea.setCaretPosition(lineOffset);
      }
 catch (      BadLocationException ex) {
      }
    }
  }
  textArea.append("String_Node_Str");
  return super.postfire();
}
Program: 75940
Project: 75940
Buggy source:
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  if (histogram != null) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
    PrintWriter print=new PrintWriter(output);
    histogram.writeFormat(print);
    output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  if (histogram != null) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
    PrintWriter print=new PrintWriter(output);
    histogram.writeFormat(print);
    output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
  }
 else   if (_configureSources != null) {
    Iterator sources=_configureSources.iterator();
    Iterator texts=_configureTexts.iterator();
    while (sources.hasNext()) {
      String source=(String)sources.next();
      String text=(String)texts.next();
      if (source != null && !source.trim().equals("String_Node_Str")) {
        output.write(_getIndentPrefix(depth) + "String_Node_Str" + source+ "String_Node_Str");
      }
 else {
        output.write(_getIndentPrefix(depth) + "String_Node_Str");
      }
      if (text != null)       output.write(text);
      output.write(_getIndentPrefix(depth) + "String_Node_Str");
    }
  }
}
Program: 75941
Project: 75941
Buggy source:
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  if (plot != null) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
    PrintWriter print=new PrintWriter(output);
    plot.writeFormat(print);
    output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  if (plot != null) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
    PrintWriter print=new PrintWriter(output);
    plot.writeFormat(print);
    output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
  }
 else   if (_configureSources != null) {
    Iterator sources=_configureSources.iterator();
    Iterator texts=_configureTexts.iterator();
    while (sources.hasNext()) {
      String source=(String)sources.next();
      String text=(String)texts.next();
      if (source != null && !source.trim().equals("String_Node_Str")) {
        output.write(_getIndentPrefix(depth) + "String_Node_Str" + source+ "String_Node_Str");
      }
 else {
        output.write(_getIndentPrefix(depth) + "String_Node_Str");
      }
      if (text != null)       output.write(text);
      output.write(_getIndentPrefix(depth) + "String_Node_Str");
    }
  }
}
Program: 75942
Project: 75942
Buggy source:
/** 
 * Start at the specified node in the shedule tree and move up the tree (towards the root node) until we find a node the has children we have not iterated through yet or children that we have not iterated through enough times (not reached the maximum iteration count).
 * @param firingNode The starting node to backtrack from.
 */
private Schedule _backTrack(ScheduleElement firingNode){
  _currentDepth--;
  Schedule node=(Schedule)firingNode._parent;
  if (node == null) {
    return null;
  }
 else   if (node.size() > (++_horizontalNodePosition[_currentDepth + 1])) {
    return node;
  }
 else   if ((++_iterationCounts[_currentDepth]) < node.getIterationCount()) {
    _horizontalNodePosition[_currentDepth + 1]=0;
    return node;
  }
  _horizontalNodePosition[_currentDepth + 1]=0;
  _iterationCounts[_currentDepth]=0;
  return (_backTrack(node));
}

Fixed version (ground truth):
/** 
 * Start at the specified node in the shedule tree and move up the tree (towards the root node) until we find a node the has children we have not iterated through yet or children that we have not iterated through enough times (not reached the maximum iteration count).
 * @param firingNode The starting node to backtrack from.
 */
private Schedule _backTrack(ScheduleElement firingNode){
  if (_currentDepth == 0) {
    return null;
  }
  _currentDepth--;
  Schedule node=(Schedule)firingNode._parent;
  if (node == null) {
    return null;
  }
 else   if (node.size() > (++_horizontalNodePosition[_currentDepth + 1])) {
    return node;
  }
 else   if ((++_iterationCounts[_currentDepth]) < node.getIterationCount()) {
    _horizontalNodePosition[_currentDepth + 1]=0;
    return node;
  }
  _horizontalNodePosition[_currentDepth + 1]=0;
  _iterationCounts[_currentDepth]=0;
  return (_backTrack(node));
}
Program: 75943
Project: 75943
Buggy source:
/** 
 * Remove the first token (the oldest one) from the receiver and return it. If there is no token in the receiver, throw an exception.  Increment the local time by deltaT.
 * @return The oldest token in the receiver.
 */
public Token get(){
  Actor actor=(Actor)super.getContainer().getContainer();
  IOPort currentPort=(IOPort)super.getContainer();
  DTDirector director=(DTDirector)((Actor)actor).getDirector();
  try {
    director.setActorLocalTime(_localTime,actor);
  }
 catch (  Exception e) {
  }
  String sourceName=((Nameable)_to).getName();
  String destinationName=((Nameable)_from).getName();
  _localTime=_localTime + _deltaT;
  return super.get();
}

Fixed version (ground truth):
/** 
 * Remove the first token (the oldest one) from the receiver and return it. If there is no token in the receiver, throw an exception.  Increment the local time by deltaT.
 * @return The oldest token in the receiver.
 */
public Token get(){
  Actor actor=(Actor)super.getContainer().getContainer();
  IOPort currentPort=(IOPort)super.getContainer();
  Director director=((Actor)actor).getDirector();
  if (director instanceof DTDirector) {
    DTDirector dtDirector=(DTDirector)director;
    dtDirector.setActorLocalTime(_localTime,actor);
  }
  String sourceName=((Nameable)_to).getName();
  String destinationName=((Nameable)_from).getName();
  _localTime=_localTime + _deltaT;
  return super.get();
}
Program: 75945
Project: 75945
Buggy source:
/** 
 * Notify the listener that a change has been successfully executed.
 * @param change The change that has been executed.
 */
public void changeExecuted(ChangeRequest change){
  if (change.getSource() != this)   return;
  EditParametersDialog dialog=new EditParametersDialog(_owner,_target);
  _target.removeChangeListener(this);
}

Fixed version (ground truth):
/** 
 * Notify the listener that a change has been successfully executed.
 * @param change The change that has been executed.
 */
public void changeExecuted(ChangeRequest change){
  if (change.getSource() != this)   return;
  new EditParametersDialog(_owner,_target);
  _target.removeChangeListener(this);
}
Program: 75946
Project: 75946
Buggy source:
/** 
 * If the contents of this dialog implements the CloseListener interface, then notify it that the window has closed.
 */
protected void _handleClosing(){
  super._handleClosing();
  if (!buttonPressed().equals("String_Node_Str") && !buttonPressed().equals("String_Node_Str") && !buttonPressed().equals("String_Node_Str")) {
    ((Configurer)contents).restore();
  }
}

Fixed version (ground truth):
/** 
 * If the contents of this dialog implements the CloseListener interface, then notify it that the window has closed.
 */
protected void _handleClosing(){
  super._handleClosing();
  if (!buttonPressed().equals("String_Node_Str") && !buttonPressed().equals("String_Node_Str") && !buttonPressed().equals("String_Node_Str")&& !buttonPressed().equals("String_Node_Str")) {
    ((Configurer)contents).restore();
  }
}
Program: 75947
Project: 75947
Buggy source:
/** 
 * If the window is closed with an OK, then apply the changes.
 */
protected void _handleClosing(){
  super._handleClosing();
  if (buttonPressed().equals("String_Node_Str")) {
    ((PortConfigurer)contents).apply();
  }
}

Fixed version (ground truth):
/** 
 * If the window is closed with anything but Cancel, apply the changes.
 */
protected void _handleClosing(){
  super._handleClosing();
  if (!buttonPressed().equals("String_Node_Str")) {
    ((PortConfigurer)contents).apply();
  }
}
Program: 75949
Project: 75949
Buggy source:
/** 
 * Consume an input token and compute a single output token.
 * @exception IllegalActionException Not thrown in this base class
 */
public void fire() throws IllegalActionException {
  iterate(1);
}

Fixed version (ground truth):
/** 
 * If at least one input token is available, consume a single input token, apply the filter to that input token, and compute a single output token. If this method is invoked multiple times in one iteration, then only the input read on the last invocation in the iteration will affect the filter state.
 * @exception IllegalActionException Not thrown here.
 */
public void fire() throws IllegalActionException {
  double xCurrent;
  double yCurrent;
  double window;
  if (input.hasToken(0)) {
    DoubleToken in=(DoubleToken)input.get(0);
    xCurrent=(in).doubleValue();
    window=xCurrent;
    for (int j=1; j < _denominator.length; j++) {
      window+=_denominator[j] * _stateVector[(_currentTap + j) % _stateVector.length];
    }
    _latestWindow=window;
    double savedState=_stateVector[_currentTap];
    _stateVector[_currentTap]=window;
    yCurrent=0;
    for (int k=0; k < _numerator.length; k++) {
      yCurrent+=_numerator[k] * _stateVector[(_currentTap + k) % _stateVector.length];
    }
    _stateVector[_currentTap]=savedState;
    DoubleToken out=new DoubleToken(yCurrent);
    output.send(0,out);
  }
}
Program: 75950
Project: 75950
Buggy source:
/** 
 * Check whether the current element type is acceptable. The element type is acceptable if it represents an instantiable object.
 * @return True if the element type is acceptable.
 */
public boolean isValueAcceptable(){
  return isInstantiable();
}

Fixed version (ground truth):
/** 
 * Check whether the current element type is acceptable. The element type is acceptable if it represents an instantiable object.
 * @return True if the element type is acceptable.
 */
public boolean isValueAcceptable(){
  return _resolvedType.isInstantiable();
}
Program: 75951
Project: 75951
Buggy source:
/** 
 * Return the actor invocation sequence of the schedule in the form of a sequence of actors. For a valid schedule, all of the lowest-level nodes should be an instance of Firing. If the schedule is not valid, then the returned iterator will contain null elements. <p> Note that the behavior of an iterator is unspecified if the underlying schedule structure is modified while the iterator is active.
 * @return An iterator over a sequence of actors.
 */
public Iterator actorIterator(){
  _updateActorInvocations();
  return _actorInvocations.iterator();
}

Fixed version (ground truth):
/** 
 * Return the actor invocation sequence of the schedule in the form of a sequence of actors. For a valid schedule, all of the lowest-level nodes should be an instance of Firing. If the schedule is not valid, then the returned iterator will contain null elements. <p> A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.
 * @return An iterator over a sequence of actors.
 * @exception ConcurrentModificationException If theunderlying schedule structure is modified while the iterator is active.
 */
public Iterator actorIterator(){
  return new ActorIterator();
}
Program: 75952
Project: 75952
Buggy source:
/** 
 * Set the actor associated with this firing. This actor will then be returned when the getActor() method is invoked. If this firing already contains a reference to an actor, then the reference will overwritten.
 * @param actor The actor to associate with this firing.
 */
public void setActor(Executable actor){
  _actor=actor;
  _actorInvocationsValid=false;
}

Fixed version (ground truth):
/** 
 * Set the actor associated with this firing. This actor will then be returned when the getActor() method is invoked. If this firing already contains a reference to an actor, then the reference will overwritten.
 * @param actor The actor to associate with this firing.
 */
public void setActor(Actor actor){
  _incrementVersion();
  _actor=actor;
  _actorInvocationsValid=false;
}
Program: 75953
Project: 75953
Buggy source:
/** 
 * Construct a firing with a default iteration count equal to one.
 */
public Firing(){
  super();
  _firing=new LinkedList();
  _firing.add(this);
  _actorInvocations=new LinkedList();
}

Fixed version (ground truth):
/** 
 * Construct a firing with a default iteration count equal to one and with no parent schedule.
 */
public Firing(){
  super();
  _firing=new LinkedList();
  _firing.add(this);
  _actorInvocations=new LinkedList();
}
Program: 75954
Project: 75954
Buggy source:
/** 
 * Return the actor invocation sequence in the form of a sequence of firings. Since this ScheduleElement is a Firing, the iterator returned will contain exactly one Firing (this Firing). <p> Note that the behavior of an iterator is unspecified if the underlying schedule structure is modified while the iterator is active.
 * @return An iterator over a sequence of firings.
 */
public Iterator firingIterator(){
  return _firing.iterator();
}

Fixed version (ground truth):
/** 
 * Return the actor invocation sequence in the form of a sequence of firings. Since this ScheduleElement is a Firing, the iterator returned will contain exactly one Firing (this Firing). <p> A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.
 * @return An iterator over a sequence of firings.
 * @exception ConcurrentModificationException If theunderlying schedule structure is modified while the iterator is active.
 */
public Iterator firingIterator(){
  return _firing.iterator();
}