nus-yam/ex-repair huggingface dataset:
Program: 75611
Project: 75611
Buggy source:
/** 
 * Remove an edge from this graph if it exists in the graph. The edge may be hidden. An edge that is removed from a graph can be re-inserted into the graph at a later time (using   {@link #addEdge(Edge)}), provided that the incident nodes are still in the graph. <p>This is an <em>O(e)</em> operation. A similar operation can be performed in <em>O(1)</em> time using   {@link #hideEdge(Edge)}.
 * @param edge The edge to be removed.
 * @return True if the edge was removed.
 * @see #hideEdge(Edge)
 */
public boolean removeEdge(Edge edge){
  if (!_edges.contains(edge)) {
    return false;
  }
  _edges.remove(edge);
  if (hidden(edge)) {
    _hiddenEdgeSet.remove(edge);
  }
 else {
    _disconnectEdge(edge);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Remove an edge from this graph if it exists in the graph. The edge may be hidden. An edge that is removed from a graph can be re-inserted into the graph at a later time (using   {@link #addEdge(Edge)}), provided that the incident nodes are still in the graph. <p>This is an <em>O(e)</em> operation. A similar operation can be performed in <em>O(1)</em> time using   {@link #hideEdge(Edge)}.
 * @param edge The edge to be removed.
 * @return True if the edge was removed.
 * @see #hideEdge(Edge)
 */
public boolean removeEdge(Edge edge){
  if (!_edges.contains(edge)) {
    return false;
  }
  _edges.remove(edge);
  if (hidden(edge)) {
    _hiddenEdgeSet.remove(edge);
    return false;
  }
 else {
    _disconnectEdge(edge);
    return true;
  }
}
Program: 75614
Project: 75614
Buggy source:
public void visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node) throws IllegalActionException {
  ParseTreeFreeVariableCollector collector=new ParseTreeFreeVariableCollector();
  Set freeVariableNames=collector.collectFreeVariables(node);
  Map map=new HashMap();
  Iterator variableNameIterator=freeVariableNames.iterator();
  while (variableNameIterator.hasNext()) {
    String name=(String)variableNameIterator.next();
    if (_scope != null) {
      ptolemy.data.Token value=_scope.get(name);
      if (value != null) {
        map.put(name,value);
        continue;
      }
    }
    throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
  }
  NamedConstantsScope constantsScope=new NamedConstantsScope(map);
  ExpressionFunction definedFunction=new ExpressionFunction(node.getArgumentNameList(),(ASTPtRootNode)node.jjtGetChild(0),constantsScope);
  FunctionToken result=new FunctionToken(definedFunction);
  node.setToken(result);
  return;
}

Fixed version (ground truth):
public void visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node) throws IllegalActionException {
  ParseTreeFreeVariableCollector collector=new ParseTreeFreeVariableCollector();
  Set freeVariableNames=collector.collectFreeVariables(node,_scope);
  Map map=new HashMap();
  Iterator variableNameIterator=freeVariableNames.iterator();
  while (variableNameIterator.hasNext()) {
    String name=(String)variableNameIterator.next();
    if (_scope != null) {
      ptolemy.data.Token value=_scope.get(name);
      if (value != null) {
        map.put(name,value);
        continue;
      }
    }
    throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
  }
  NamedConstantsScope constantsScope=new NamedConstantsScope(map);
  ExpressionFunction definedFunction=new ExpressionFunction(node.getArgumentNameList(),(ASTPtRootNode)node.jjtGetChild(0),constantsScope);
  FunctionToken result=new FunctionToken(definedFunction);
  node.setToken(result);
  return;
}
Program: 75615
Project: 75615
Buggy source:
/** 
 * Return the total number of edges in this graph.  Multiple connections between two nodes are counted multiple times.
 * @return The total number of edges in this graph.
 */
public int edgeCount(){
  return _edges.size();
}

Fixed version (ground truth):
/** 
 * Return the total number of edges in this graph.  Multiple connections between two nodes are counted multiple times. Hidden edges are not included in this count.
 * @return The total number of edges in this graph.
 */
public int edgeCount(){
  return _edges.size() - _hiddenEdgeSet.size();
}
Program: 75616
Project: 75616
Buggy source:
/** 
 * Called by _processInstanceFieldRef and _addLeftValue
 */
protected Node _createInstanceFieldRef(InstanceFieldRef ifr) throws JHDLUnsupportedException {
  InstanceFieldRef new_ifr=_getMatchingInstanceFieldRef(ifr);
  if (new_ifr == null)   new_ifr=ifr;
  if (DEBUG)   System.out.println("String_Node_Str" + System.identityHashCode(new_ifr));
  Node base=_processValue(new_ifr.getBase());
  Node n=addNodeWeight(new_ifr);
  _instanceFieldRefs.add(new_ifr,n);
  addBaseEdge(base,n);
  return n;
}

Fixed version (ground truth):
/** 
 * Called by _processInstanceFieldRef and _addLeftValue
 */
protected Node _createInstanceFieldRef(InstanceFieldRef ifr) throws JHDLUnsupportedException {
  InstanceFieldRef new_ifr=_getMatchingInstanceFieldRef(ifr);
  if (new_ifr == null)   new_ifr=ifr;
  if (DEBUG)   System.out.println("String_Node_Str" + System.identityHashCode(new_ifr));
  Node base=_processValue(new_ifr.getBase());
  Node n=addNodeWeight(new_ifr);
  _instanceFieldRefs.add(new_ifr,n);
  return n;
}
Program: 75617
Project: 75617
Buggy source:
protected DirectedGraph _extractDataFlow(DirectedGraph graph){
  Map requiredNodeMap=new HashMap();
  for (Iterator i=graph.nodes().iterator(); i.hasNext(); ) {
    GraphNode gn=(GraphNode)((Node)i.next()).getWeight();
    if (gn instanceof SuperBlock) {
      SuperBlock sb=(SuperBlock)gn;
      BlockDataFlowGraph bdfg=(BlockDataFlowGraph)sb.getGraph();
    }
  }
  DirectedGraph dg=new DirectedGraph();
  Set keys=requiredNodeMap.keySet();
  for (Iterator i=keys.iterator(); i.hasNext(); ) {
    Object requiredValue=i.next();
    GraphNode gn=(GraphNode)requiredNodeMap.get(requiredValue);
    System.out.println("String_Node_Str" + requiredValue + "String_Node_Str"+ gn);
    gn.createDataFlow(dg,requiredValue);
  }
  return dg;
}

Fixed version (ground truth):
protected DirectedGraph _extractDataFlow(DirectedGraph graph){
  Map requiredNodeMap=new HashMap();
  for (Iterator i=graph.nodes().iterator(); i.hasNext(); ) {
    GraphNode gn=(GraphNode)((Node)i.next()).getWeight();
    if (gn instanceof SuperBlock) {
      SuperBlock sb=(SuperBlock)gn;
      RequiredBlockDataFlowGraph bdfg=(RequiredBlockDataFlowGraph)sb.getGraph();
      for (Iterator j=bdfg.getRequiredNodeSet().iterator(); j.hasNext(); ) {
        requiredNodeMap.put(j.next(),sb);
      }
    }
  }
  DirectedGraph dg=new DirectedGraph();
  Set keys=requiredNodeMap.keySet();
  for (Iterator i=keys.iterator(); i.hasNext(); ) {
    Object requiredValue=i.next();
    GraphNode gn=(GraphNode)requiredNodeMap.get(requiredValue);
    System.out.println("String_Node_Str" + requiredValue + "String_Node_Str"+ gn);
    gn.createDataFlow(dg,requiredValue);
  }
  return dg;
}
Program: 75618
Project: 75618
Buggy source:
/** 
 * Restore an edge if the edge exists in the graph and is presently hidden. This is an <em>O(1)</em> operation.
 * @param edge The edge to restore.
 * @return true If the edge is in the graph and was hidden.
 * @exception IllegalArgumentException If the source node and sink nodeof the given edge are not both in the graph.
 * @see #hideEdge(Edge).
 */
public boolean restoreEdge(Edge edge){
  if (!containsEdge(edge)) {
    return false;
  }
  if (_hiddenEdgeSet.remove(edge)) {
    if (!containsNode(edge.source())) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + _edgeDump(edge));
    }
    if (!containsNode(edge.sink())) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + _edgeDump(edge));
    }
    _connectEdge(edge);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Restore an edge if the edge exists in the graph and is presently hidden. This is an <em>O(1)</em> operation.
 * @param edge The edge to restore.
 * @return true If the edge is in the graph and was hidden.
 * @exception IllegalArgumentException If the source node and sink nodeof the given edge are not both in the graph.
 * @see #hideEdge(Edge).
 */
public boolean restoreEdge(Edge edge){
  if (_hiddenEdgeSet.remove(edge)) {
    if (!containsNode(edge.source())) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + _edgeDump(edge));
    }
    if (!containsNode(edge.sink())) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + _edgeDump(edge));
    }
    _connectEdge(edge);
    return true;
  }
 else {
    return false;
  }
}
Program: 75619
Project: 75619
Buggy source:
/** 
 * Return true if the given object is a valid node weight for this graph. An object is a valid node weight if it is meaningful to assign it as a node weight in this type of graph. If the given object is null this method returns true if it is valid to have an unweighted node in this type of graph. This base class method returns true unconditionally, even if the given object is null. In derived classes, the method should be  overridden to take into account any restrictions on node weights.
 * @param object The given object.
 * @return True if if the given object is a valid node weight for this graph.
 */
boolean validNodeWeight(Object object){
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if the given object is a valid node weight for this graph. An object is a valid node weight if it is meaningful to assign it as a node weight in this type of graph. If the given object is null this method returns true if it is valid to have an unweighted node in this type of graph. This base class method returns true unconditionally, even if the given object is null. In derived classes, the method should be  overridden to take into account any restrictions on node weights.
 * @param object The given object.
 * @return True if if the given object is a valid node weight for this graph.
 */
public boolean validNodeWeight(Object object){
  return true;
}
Program: 75620
Project: 75620
Buggy source:
/** 
 * Return true if the given object is a valid edge weight for this graph. An object is a valid edge weight if it is meaningful to assign it as an edge weight in this type of graph. If the given object is null this method returns true if it is valid to have an unweighted edge in this type of graph. This base class method returns true unconditionally, even if the given object is null. In derived classes, the method should be  overridden to take into account any restrictions on edge weights.
 * @param object The given object.
 * @return True if if the given object is a valid edge weight for this graph.
 */
boolean validEdgeWeight(Object object){
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if the given object is a valid edge weight for this graph. An object is a valid edge weight if it is meaningful to assign it as an edge weight in this type of graph. If the given object is null this method returns true if it is valid to have an unweighted edge in this type of graph. This base class method returns true unconditionally, even if the given object is null. In derived classes, the method should be  overridden to take into account any restrictions on edge weights.
 * @param object The given object.
 * @return True if if the given object is a valid edge weight for this graph.
 */
public boolean validEdgeWeight(Object object){
  return true;
}
Program: 75621
Project: 75621
Buggy source:
/** 
 * Register a new node in the graph. The node is assumed to be non-null and unique. This method performs updates of internal data structures that are required for every node that is added to the graph. Derived classes can override this method to perform additional updates of internal data structures. 
 * @param node The new node.
 * @exception RuntimeException if the weight of the given node isnot valid, as determined by  {@link #validNodeWeight(Object)}.
 * @see #_registerEdge(Node).
 */
protected void _registerNode(Node node){
  Object weight=node.hasWeight() ? node.weight() : null;
  if (!validNodeWeight(weight)) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + ((weight == null) ? "String_Node_Str" : ("String_Node_Str" + weight.toString() + "String_Node_Str")));
  }
  _nodes.add(node);
  _incidentEdgeMap.put(node,new ArrayList());
  if (node.hasWeight()) {
    ArrayList sameWeightList;
    try {
      sameWeightList=_sameWeightNodes(weight);
    }
 catch (    Exception exception) {
      sameWeightList=new ArrayList();
      _nodeWeightMap.put(weight,sameWeightList);
    }
    sameWeightList.add(node);
  }
  _registerChange();
}

Fixed version (ground truth):
/** 
 * Register a new node in the graph. The node is assumed to be non-null and unique. This method performs updates of internal data structures that are required for every node that is added to the graph. Derived classes can override this method to perform additional updates of internal data structures. 
 * @param node The new node.
 * @exception RuntimeException if the weight of the given node isnot valid, as determined by  {@link #validNodeWeight(Object)}.
 * @see #_registerEdge(Edge).
 */
protected void _registerNode(Node node){
  Object weight=node.hasWeight() ? node.weight() : null;
  if (!validNodeWeight(weight)) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + ((weight == null) ? "String_Node_Str" : ("String_Node_Str" + weight.toString() + "String_Node_Str")));
  }
  _nodes.add(node);
  _incidentEdgeMap.put(node,new ArrayList());
  if (node.hasWeight()) {
    ArrayList sameWeightList;
    try {
      sameWeightList=_sameWeightNodes(weight);
    }
 catch (    Exception exception) {
      sameWeightList=new ArrayList();
      _nodeWeightMap.put(weight,sameWeightList);
    }
    sameWeightList.add(node);
  }
  _registerChange();
}
Program: 75622
Project: 75622
Buggy source:
/** 
 * If the histogram has not already been created, create it using place(). If configurations specified by a call to configure() have not yet been processed, process them.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (plot == null) {
    plot=_newPlot();
    plot.setTitle(getName());
    plot.setButtons(true);
  }
  if (_frame == null && _container == null) {
    Effigy containerEffigy=Configuration.findEffigy(toplevel());
    if (containerEffigy == null) {
      throw new IllegalActionException(this,"String_Node_Str" + toplevel().getFullName());
    }
    try {
      PlotEffigy plotEffigy=new PlotEffigy(containerEffigy,containerEffigy.uniqueName("String_Node_Str"));
      plotEffigy.identifier.setExpression(getFullName());
      PlotWindowTableau tableau=new PlotWindowTableau(plotEffigy,"String_Node_Str");
      _frame=tableau.frame;
    }
 catch (    Exception ex) {
      throw new IllegalActionException(this,null,ex,"String_Node_Str");
    }
    _windowProperties.setProperties(_frame);
    _implementDeferredConfigurations();
    if (_plotSize != null) {
      _plotSize.setSize(plot);
    }
  }
 else {
    plot.clear(false);
    plot.repaint();
  }
  if (_frame != null) {
    _frame.show();
  }
}

Fixed version (ground truth):
/** 
 * If the histogram has not already been created, create it using place(). If configurations specified by a call to configure() have not yet been processed, process them.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (plot == null) {
    plot=_newPlot();
    plot.setTitle(getName());
    plot.setButtons(true);
  }
  if (_frame == null && _container == null) {
    Effigy containerEffigy=Configuration.findEffigy(toplevel());
    if (containerEffigy == null) {
      throw new IllegalActionException(this,"String_Node_Str" + toplevel().getFullName());
    }
    try {
      PlotEffigy plotEffigy=new PlotEffigy(containerEffigy,containerEffigy.uniqueName("String_Node_Str"));
      plotEffigy.identifier.setExpression(getFullName());
      PlotWindowTableau tableau=new PlotWindowTableau(plotEffigy,"String_Node_Str");
      _frame=tableau.frame;
    }
 catch (    Exception ex) {
      throw new IllegalActionException(this,null,ex,"String_Node_Str");
    }
    _windowProperties.setProperties(_frame);
    _implementDeferredConfigurations();
    if (_plotSize != null) {
      _plotSize.setSize(plot);
    }
    _frame.show();
  }
 else {
    plot.clear(false);
    plot.repaint();
  }
}
Program: 75624
Project: 75624
Buggy source:
/** 
 */
protected DirectedGraph _analyzeMethod(SootMethod method) throws IllegalActionException {
  Body body=method.retrieveActiveBody();
  MergedControlFlowGraph mcfg=new MergedControlFlowGraph(body);
  return mcfg;
}

Fixed version (ground truth):
/** 
 */
protected DirectedGraph _analyzeMethod(SootMethod method) throws IllegalActionException {
  Body body=method.retrieveActiveBody();
  DirectedGraph mcfg=new MergedControlFlowGraph(body);
  mcfg=_extractDataFlow(mcfg);
  return mcfg;
}
Program: 75625
Project: 75625
Buggy source:
/** 
 */
Object createDataFlow(DirectedGraph graph,Object value);

Fixed version (ground truth):
/** 
 */
Node createDataFlow(DirectedGraph graph,Object value);
Program: 75626
Project: 75626
Buggy source:
public MergedControlFlowGraph(Body body) throws IllegalActionException {
  super();
  _bbgraph=new BriefBlockGraph(body);
  _createGraph();
  _controlFlowAnalysis();
  _extractDataFlow(this);
}

Fixed version (ground truth):
public MergedControlFlowGraph(Body body) throws IllegalActionException {
  super();
  _bbgraph=new BriefBlockGraph(body);
  _createGraph();
  _controlFlowAnalysis();
}
Program: 75627
Project: 75627
Buggy source:
public Object createDataFlow(DirectedGraph graph,Object value){
  Object trueResult=_trueInput.createDataFlow(graph,value);
  Object falseResult=_falseInput.createDataFlow(graph,value);
  ConditionExpr cond=(ConditionExpr)_conditionBlock.getBlock().getTail();
  Object condResult=_conditionBlock.createDataFlow(graph,cond);
  MuxNode newMux=new MuxNode(trueResult,falseResult,condResult,1);
  graph.addNodeWeight(newMux);
  graph.addEdge(trueResult,newMux);
  graph.addEdge(falseResult,newMux);
  graph.addEdge(condResult,newMux);
  return newMux;
}

Fixed version (ground truth):
public Node createDataFlow(DirectedGraph graph,Object value){
  System.out.println("String_Node_Str");
  Node trueResult=_trueInput.createDataFlow(graph,value);
  System.out.println("String_Node_Str");
  Node falseResult=_falseInput.createDataFlow(graph,value);
  Object cond=((IfStmt)_conditionBlock.getBlock().getTail()).getCondition();
  System.out.println("String_Node_Str");
  Node condResult=_conditionBlock.createDataFlow(graph,cond);
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + trueResult);
  System.out.println("String_Node_Str" + falseResult);
  System.out.println("String_Node_Str" + condResult);
  if (trueResult == null && falseResult == null)   return null;
  if (trueResult == null)   return falseResult;
  if (falseResult == null)   return trueResult;
  MuxNode newMux=new MuxNode(trueResult,falseResult,condResult,1);
  Node newMuxNode=graph.addNodeWeight(newMux);
  SynthesisToDotty.writeDotFile("String_Node_Str",graph);
  graph.addEdge(trueResult,newMuxNode);
  graph.addEdge(falseResult,newMuxNode);
  graph.addEdge(condResult,newMuxNode);
  return newMuxNode;
}
Program: 75628
Project: 75628
Buggy source:
public String toString(){
  return _block.toString();
}

Fixed version (ground truth):
public String toString(){
  return _block.toShortString();
}
Program: 75630
Project: 75630
Buggy source:
/** 
 * If the <i>stopTime</i> parameter is changed and the model is executing, then if the new value is greater than zero and greater than the current time, then ask the director to fire this actor at that time.  If the new value is less than the current time, then request refiring at the current time.
 * @exception IllegalActionException If the superclass throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == stopTime) {
    double time=((DoubleToken)stopTime.getToken()).doubleValue();
    Manager manager=getManager();
    if (time > 0.0 && manager != null && manager.getState() != Manager.IDLE) {
      Director director=getDirector();
      if (director != null) {
        double currentTime=director.getCurrentTime();
        if (time > currentTime) {
          director.fireAt(this,time);
        }
 else {
          director.fireAt(this,currentTime);
        }
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the <i>stopTime</i> parameter is changed and the model is executing, then if the new value is greater than zero and greater than the current time, then ask the director to fire this actor at that time.  If the new value is less than the current time, then request refiring at the current time.
 * @exception IllegalActionException If the superclass throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == stopTime && _executing) {
    double time=((DoubleToken)stopTime.getToken()).doubleValue();
    if (time > 0.0) {
      Director director=getDirector();
      if (director != null) {
        double currentTime=director.getCurrentTime();
        if (time > currentTime) {
          director.fireAt(this,time);
        }
 else {
          director.fireAt(this,currentTime);
        }
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75631
Project: 75631
Buggy source:
/** 
 * Initialize the actor. Schedule a refiring of this actor at the stop time given by the <i>stopTime</i> parameter.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  double time=((DoubleToken)stopTime.getToken()).doubleValue();
  if (time > 0.0) {
    Director director=getDirector();
    if (director == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    double currentTime=director.getCurrentTime();
    director.fireAt(this,time);
  }
}

Fixed version (ground truth):
/** 
 * Initialize the actor. Schedule a refiring of this actor at the stop time given by the <i>stopTime</i> parameter.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  double time=((DoubleToken)stopTime.getToken()).doubleValue();
  if (time > 0.0) {
    Director director=getDirector();
    if (director == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    double currentTime=director.getCurrentTime();
    director.fireAt(this,time);
    _executing=true;
  }
}
Program: 75633
Project: 75633
Buggy source:
/** 
 * Open a file dialog to identify a file to be opened, and then call _read() to open the file.
 */
protected void _open(){
  JFileChooser fileDialog=new JFileChooser();
  if (_fileFilter != null) {
    fileDialog.addChoosableFileFilter(_fileFilter);
  }
  fileDialog.setDialogTitle("String_Node_Str");
  if (_directory != null) {
    fileDialog.setCurrentDirectory(_directory);
  }
 else {
    String cwd=System.getProperty("String_Node_Str");
    if (cwd != null) {
      fileDialog.setCurrentDirectory(new File(cwd));
    }
  }
  if (fileDialog.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
    _directory=fileDialog.getCurrentDirectory();
    try {
      File file=fileDialog.getSelectedFile().getCanonicalFile();
      _read(file.toURL());
    }
 catch (    Exception ex) {
      if (!ex.getMessage().startsWith("String_Node_Str")) {
        report("String_Node_Str",ex);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Open a file dialog to identify a file to be opened, and then call _read() to open the file.
 */
protected void _open(){
  JFileChooser fileDialog=new JFileChooser();
  if (_fileFilter != null) {
    fileDialog.addChoosableFileFilter(_fileFilter);
  }
  fileDialog.setDialogTitle("String_Node_Str");
  if (_directory != null) {
    fileDialog.setCurrentDirectory(_directory);
  }
 else {
    String cwd=System.getProperty("String_Node_Str");
    if (cwd != null) {
      fileDialog.setCurrentDirectory(new File(cwd));
    }
  }
  if (fileDialog.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
    _directory=fileDialog.getCurrentDirectory();
    try {
      File file=fileDialog.getSelectedFile().getCanonicalFile();
      _read(file.toURL());
    }
 catch (    Exception ex) {
      if (ex.getMessage() != null && !ex.getMessage().startsWith("String_Node_Str")) {
        report("String_Node_Str",ex);
      }
    }
  }
}
Program: 75634
Project: 75634
Buggy source:
/** 
 * Construct a UnsignedByteToken from the specified string.  The string is parsed by the parseByte() method of the Java Byte object.
 * @exception IllegalActionException If the token could notbe created from the given string.
 */
public UnsignedByteToken(String init) throws IllegalActionException {
  try {
    _value=Byte.parseByte(init);
  }
 catch (  NumberFormatException e) {
    throw new IllegalActionException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Construct a UnsignedByteToken from the specified string.  The string is parsed by the parseByte() method of the Java Byte object.
 * @exception IllegalActionException If the token could notbe created from the given string.
 */
public UnsignedByteToken(String init) throws IllegalActionException {
  try {
    int value=Integer.parseInt(init);
    if (value > 255 || value < 0) {
      throw new IllegalActionException("String_Node_Str" + init + "String_Node_Str");
    }
    _value=(byte)value;
  }
 catch (  NumberFormatException e) {
    throw new IllegalActionException(e.getMessage());
  }
}
Program: 75635
Project: 75635
Buggy source:
/** 
 * Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. If this token has a unit, the return string also includes a unit string produced by the unitsString() method in the super class.
 * @return A String representing the byte value and the units (ifany) of this token.
 * @see ptolemy.data.ScalarToken#unitsString
 */
public String toString(){
  String unitString="String_Node_Str";
  if (!_isUnitless()) {
    unitString="String_Node_Str" + unitsString();
  }
  return Byte.toString(_value) + unitString;
}

Fixed version (ground truth):
/** 
 * Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. If this token has a unit, the return string also includes a unit string produced by the unitsString() method in the super class.
 * @return A String representing the byte value and the units (ifany) of this token.
 * @see ptolemy.data.ScalarToken#unitsString
 */
public String toString(){
  String unitString="String_Node_Str";
  if (!_isUnitless()) {
    unitString="String_Node_Str" + unitsString();
  }
  return Integer.toString(unsignedConvert(_value)) + unitString;
}
Program: 75638
Project: 75638
Buggy source:
/** 
 * Return the epsilon-closure of the specified state. Epsilon-closure is defined in Definition 11 of the interface automaton paper. It is the set of states that can be reached from the specified state by taking only internal transitions.
 * @param state The state from which the espilon-closure is computed.
 * @return A set of instances of State.
 */
public Set epsilonClosure(State state){
  Set closure=new HashSet();
  Set frontier=new HashSet();
  closure.add(state);
  frontier.add(state);
  while (!frontier.isEmpty()) {
    Iterator iterator=frontier.iterator();
    State current=(State)iterator.next();
    frontier.remove(current);
    ComponentPort outPort=current.outgoingPort;
    Iterator transitions=outPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      InterfaceAutomatonTransition transition=(InterfaceAutomatonTransition)transitions.next();
      int transitionType=transition.getType();
      if (transitionType == InterfaceAutomatonTransition._INTERNAL_TRANSITION) {
        State destinationState=transition.destinationState();
        if (!closure.contains(destinationState)) {
          closure.add(destinationState);
          closure.add(destinationState);
        }
      }
    }
  }
  return closure;
}

Fixed version (ground truth):
/** 
 * Return the epsilon-closure of the specified state. Epsilon-closure is defined in Definition 11 of the interface automaton paper. It is the set of states that can be reached from the specified state by taking only internal transitions.
 * @param state The state from which the espilon-closure is computed.
 * @return A set of instances of State.
 */
public Set epsilonClosure(State state){
  Set closure=new HashSet();
  Set frontier=new HashSet();
  closure.add(state);
  frontier.add(state);
  while (!frontier.isEmpty()) {
    Iterator iterator=frontier.iterator();
    State current=(State)iterator.next();
    frontier.remove(current);
    ComponentPort outPort=current.outgoingPort;
    Iterator transitions=outPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      InterfaceAutomatonTransition transition=(InterfaceAutomatonTransition)transitions.next();
      int transitionType=transition.getType();
      if (transitionType == InterfaceAutomatonTransition._INTERNAL_TRANSITION) {
        State destinationState=transition.destinationState();
        if (!closure.contains(destinationState)) {
          closure.add(destinationState);
          frontier.add(destinationState);
        }
      }
    }
  }
  return closure;
}
Program: 75639
Project: 75639
Buggy source:
/** 
 * Transfer data from this port to the ports it is connected to on the outside. This port must be an opaque output port.  If any channel of this port has no data, then that channel is ignored. This method will transfer exactly one token on each output channel that has at least one token available.
 * @exception IllegalActionException If the port is not an opaqueoutput port.
 * @return True if at least one data token is transferred.
 * @deprecated domains should use getInside directly to implement theirtransferOutputs method.
 */
public boolean transferOutputs() throws IllegalActionException {
  if (!this.isOutput() || !this.isOpaque()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  boolean wasTransferred=false;
  for (int i=0; i < getWidthInside(); i++) {
    try {
      if (isKnown(i)) {
        if (hasTokenInside(i)) {
          Token t=getInside(i);
          send(i,t);
          wasTransferred=true;
        }
 else {
          sendAbsent(i);
        }
      }
    }
 catch (    NoTokenException ex) {
      throw new InternalErrorException(this,ex,null);
    }
  }
  return wasTransferred;
}

Fixed version (ground truth):
/** 
 * Transfer data from this port to the ports it is connected to on the outside. This port must be an opaque output port.  If any channel of this port has no data, then that channel is ignored. This method will transfer exactly one token on each output channel that has at least one token available.
 * @exception IllegalActionException If the port is not an opaqueoutput port.
 * @return True if at least one data token is transferred.
 * @deprecated domains should use getInside directly to implement theirtransferOutputs method.
 */
public boolean transferOutputs() throws IllegalActionException {
  if (!this.isOutput() || !this.isOpaque()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  boolean wasTransferred=false;
  for (int i=0; i < getWidthInside(); i++) {
    try {
      if (isKnownInside(i)) {
        if (hasTokenInside(i)) {
          Token t=getInside(i);
          send(i,t);
          wasTransferred=true;
        }
 else {
          sendAbsent(i);
        }
      }
    }
 catch (    NoTokenException ex) {
      throw new InternalErrorException(this,ex,null);
    }
  }
  return wasTransferred;
}
Program: 75640
Project: 75640
Buggy source:
protected void _reinitialize() throws IllegalActionException {
  if (_decimationPhaseValue >= _decimationValue) {
    throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str"+ _decimationValue+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interpolationValue);
  if ((_taps.length % _interpolationValue) != 0)   _phaseLength++;
  int length=(int)Math.max(_phaseLength,_decimationValue);
  if (_data == null) {
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      _data[i]=_zero;
    }
    _mostRecent=_phaseLength;
  }
 else   if (_data.length != length) {
    Token[] _oldData=_data;
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      if (i < _oldData.length) {
        _data[i]=_oldData[i];
      }
 else {
        _data[i]=_zero;
      }
    }
    _mostRecent=_phaseLength;
  }
  _reinitializeNeeded=false;
}

Fixed version (ground truth):
protected void _reinitialize() throws IllegalActionException {
  if (_decimationPhaseValue >= _decimationValue) {
    throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str"+ _decimationValue+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interpolationValue);
  if ((_taps.length % _interpolationValue) != 0)   _phaseLength++;
  int length=_phaseLength + _decimationValue;
  if (_data == null) {
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      _data[i]=_zero;
    }
    _mostRecent=_phaseLength;
  }
 else   if (_data.length != length) {
    Token[] _oldData=_data;
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      if (i < _oldData.length) {
        _data[i]=_oldData[i];
      }
 else {
        _data[i]=_zero;
      }
    }
    _mostRecent=_phaseLength;
  }
  _reinitializeNeeded=false;
}
Program: 75641
Project: 75641
Buggy source:
protected void _reinitialize() throws IllegalActionException {
  if (_decimationPhaseValue >= _decimationValue) {
    throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str"+ _decimationValue+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interpolationValue);
  if ((_taps.length % _interpolationValue) != 0)   _phaseLength++;
  int length=(int)Math.max(_phaseLength,_decimationValue);
  if (_data == null || _data.length != length) {
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      _data[i]=_zero;
    }
    _mostRecent=_phaseLength;
  }
  _reinitializeNeeded=false;
}

Fixed version (ground truth):
protected void _reinitialize() throws IllegalActionException {
  if (_decimationPhaseValue >= _decimationValue) {
    throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str"+ _decimationValue+ "String_Node_Str");
  }
  _phaseLength=(int)(_taps.length / _interpolationValue);
  if ((_taps.length % _interpolationValue) != 0)   _phaseLength++;
  int length=(int)Math.max(_phaseLength,_decimationValue);
  if (_data == null) {
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      _data[i]=_zero;
    }
    _mostRecent=_phaseLength;
  }
 else   if (_data.length != length) {
    Token[] _oldData=_data;
    _data=new Token[length];
    for (int i=0; i < length; i++) {
      if (i < _oldData.length) {
        _data[i]=_oldData[i];
      }
 else {
        _data[i]=_zero;
      }
    }
    _mostRecent=_phaseLength;
  }
  _reinitializeNeeded=false;
}
Program: 75642
Project: 75642
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 (newTaps.hasToken(0)) {
    ArrayToken tapsToken=(ArrayToken)(newTaps.get(0));
    _taps=tapsToken.arrayValue();
    _zero=_taps[0].zero();
    _reinitializeNeeded=true;
  }
  for (int i=0; i < _blockSizeValue; i++) {
    super.fire();
  }
}

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 (newTaps.hasToken(0)) {
    ArrayToken tapsToken=(ArrayToken)(newTaps.get(0));
    _taps=tapsToken.arrayValue();
    _zero=_taps[0].zero();
    _reinitialize();
  }
  for (int i=0; i < _blockSizeValue; i++) {
    super.fire();
  }
}
Program: 75643
Project: 75643
Buggy source:
/** 
 * If the model is paused, resume execution.  This method must be called from a different thread than that controlling the execution, since the thread controlling the execution is suspended.
 */
public void resume(){
synchronized (_resumeNotify) {
    if (_resumeNotifyWaiting) {
      _resumeNotify.notifyAll();
      _resumeNotifyWaiting=false;
    }
  }
  if (_state == PAUSED) {
synchronized (this) {
      if (_state == PAUSED) {
        _pauseRequested=false;
        notifyAll();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * If the model is paused, resume execution.  This method must be called from a different thread than that controlling the execution, since the thread controlling the execution is suspended.
 */
public void resume(){
  if (_state == PAUSED) {
synchronized (this) {
      if (_state == PAUSED) {
        _pauseRequested=false;
        notifyAll();
      }
 else {
        throw new InternalErrorException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else   if (_state == PAUSED_ON_BREAKPOINT) {
synchronized (this) {
      if (_state == PAUSED_ON_BREAKPOINT) {
        if (_resumeNotifyWaiting) {
          _resumeNotifyWaiting=false;
          notifyAll();
        }
      }
    }
  }
}
Program: 75644
Project: 75644
Buggy source:
/** 
 * Construct a breakpoint configurer for the specified entity.
 * @param object The entity to configure.
 * @param graphController The associated graph controller for the object.
 */
public BreakpointConfigurer(Entity object,BasicGraphController graphController){
  super();
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  setTextWidth(15);
  if (object instanceof Actor) {
    _actor=(Actor)object;
  }
 else {
    throw new InternalErrorException("String_Node_Str");
  }
  _graphController=graphController;
  Director director=((Actor)_actor).getExecutiveDirector();
  if (director == null) {
    throw new InternalErrorException("String_Node_Str");
  }
 else {
    DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
    _actorProfile=null;
    if (debugController != null) {
      _actorProfile=debugController.getDebug(_actor);
    }
    if (_actorProfile == null) {
      _actorProfile=new DebugProfile(_graphController);
    }
    for (int i=0; i < _firingEventTypes.length; i++) {
      if (_actorProfile.isListening(_firingEventTypes[i])) {
        addCheckBox(_firingEventTypeLabels[i],_firingEventTypeLabels[i],true);
      }
 else {
        addCheckBox(_firingEventTypeLabels[i],_firingEventTypeLabels[i],false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Construct a breakpoint configurer for the specified entity.
 * @param object The entity to configure.
 * @param graphController The associated graph controller for the object.
 */
public BreakpointConfigurer(Entity object,BasicGraphController graphController){
  super();
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  setTextWidth(15);
  if (object instanceof Actor) {
    _actor=(Actor)object;
  }
 else {
    throw new InternalErrorException("String_Node_Str");
  }
  _graphController=graphController;
  Director director=((Actor)_actor).getExecutiveDirector();
  if (director == null) {
    throw new InternalErrorException("String_Node_Str");
  }
 else {
    DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
    _actorProfile=null;
    if (debugController != null) {
      _actorProfile=debugController.getDebugProfile(_actor);
    }
    if (_actorProfile == null) {
      _actorProfile=new DebugProfile(_graphController);
    }
    for (int i=0; i < _firingEventTypes.length; i++) {
      if (_actorProfile.isListening(_firingEventTypes[i])) {
        addCheckBox(_firingEventTypeLabels[i],_firingEventTypeLabels[i],true);
      }
 else {
        addCheckBox(_firingEventTypeLabels[i],_firingEventTypeLabels[i],false);
      }
    }
  }
}
Program: 75645
Project: 75645
Buggy source:
/** 
 * Set up and save the new breakpoint configuration for this actor.
 */
public void apply(){
  boolean breakpointsSelected=false;
  DebugProfile profile=new DebugProfile(_graphController);
  for (int i=0; i < _firingEventTypes.length; i++) {
    if (getBooleanValue(_firingEventTypeLabels[i])) {
      profile.listenForEvent(_firingEventTypes[i]);
      breakpointsSelected=true;
    }
 else {
      profile.unlistenForEvent(_firingEventTypes[i]);
    }
  }
  Director director=((Actor)_actor).getExecutiveDirector();
  DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
  if (breakpointsSelected) {
    if (debugController == null) {
      try {
        debugController=new DebugController(director,_DEBUGCONTROLLER);
      }
 catch (      NameDuplicationException exception) {
        throw new RuntimeException("String_Node_Str");
      }
catch (      IllegalActionException exception) {
        throw new RuntimeException("String_Node_Str");
      }
      director.addDebugListener(debugController);
    }
    debugController.setDebug(_actor,profile);
  }
 else {
    debugController.unsetDebug(_actor);
  }
}

Fixed version (ground truth):
/** 
 * Set up and save the new breakpoint configuration for this actor.
 */
public void apply(){
  boolean breakpointsSelected=false;
  _actorProfile=new DebugProfile(_graphController);
  for (int i=0; i < _firingEventTypes.length; i++) {
    if (getBooleanValue(_firingEventTypeLabels[i])) {
      _actorProfile.listenForEvent(_firingEventTypes[i]);
      breakpointsSelected=true;
    }
 else {
      _actorProfile.unlistenForEvent(_firingEventTypes[i]);
    }
  }
  Director director=((Actor)_actor).getExecutiveDirector();
  DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
  if (breakpointsSelected) {
    if (debugController != null) {
      debugController.putDebugProfile(_actor,_actorProfile);
    }
 else {
      String moml="String_Node_Str" + _DEBUGCONTROLLER + "String_Node_Str";
      ChangeRequest request=new MoMLChangeRequest(this,director,moml.toString());
      director.addChangeListener(this);
      director.requestChange(request);
    }
  }
 else {
    debugController.removeDebugProfile(_actor);
  }
}
Program: 75646
Project: 75646
Buggy source:
/** 
 * The thread that calls this method will wait until resume() has been called. Note: This method will block.  Should only be called from the executing thread (the thread that is executing the model).  Do not call this method from the same thread that will call resume(). FIXME: Added by celaine.  Review this.  Works with DebugController to resume execution after a breakpoint. FIXME: in PN this could be called multiple times.  make sure this still works with multiple threads.
 */
public void pauseOnBreakpoint(String breakpointMessage){
  try {
    if (_state == ITERATING) {
synchronized (this) {
        if (_state == ITERATING) {
          _setState(PAUSED_ON_BREAKPOINT);
          _resumeNotifyWaiting=true;
          while (_resumeNotifyWaiting) {
            wait();
          }
          _setState(ITERATING);
        }
 else {
          throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
        }
      }
    }
 else {
      throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  InterruptedException error) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * The thread that calls this method will wait until resume() has been called. Note: This method will block.  Should only be called from the executing thread (the thread that is executing the model).  Do not call this method from the same thread that will call resume(). FIXME: Added by celaine.  Review this.  Works with DebugController to resume execution after a breakpoint. FIXME: in PN this could be called multiple times.  make sure this still works with multiple threads.
 */
public void pauseOnBreakpoint(String breakpointMessage){
  try {
    if (_state == ITERATING) {
synchronized (this) {
        if (_state == ITERATING) {
          PAUSED_ON_BREAKPOINT.setDescription("String_Node_Str" + breakpointMessage + "String_Node_Str");
          _setState(PAUSED_ON_BREAKPOINT);
          _resumeNotifyWaiting=true;
          while (_resumeNotifyWaiting) {
            wait();
          }
          _setState(ITERATING);
        }
 else {
          throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
        }
      }
    }
 else {
      throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  InterruptedException error) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}
Program: 75647
Project: 75647
Buggy source:
/** 
 * Set up and save the new breakpoint configuration for this actor.
 */
public void apply(){
  boolean breakpointsSelected=false;
  _actorProfile=new DebugProfile(_graphController);
  for (int i=0; i < _firingEventTypes.length; i++) {
    if (getBooleanValue(_firingEventTypeLabels[i])) {
      _actorProfile.listenForEvent(_firingEventTypes[i]);
      breakpointsSelected=true;
    }
 else {
      _actorProfile.unlistenForEvent(_firingEventTypes[i]);
    }
  }
  Director director=((Actor)_actor).getExecutiveDirector();
  DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
  if (breakpointsSelected) {
    if (debugController != null) {
      debugController.putDebugProfile(_actor,_actorProfile);
    }
 else {
      String moml="String_Node_Str" + _DEBUGCONTROLLER + "String_Node_Str";
      ChangeRequest request=new MoMLChangeRequest(this,director,moml.toString());
      director.addChangeListener(this);
      director.requestChange(request);
    }
  }
 else {
    debugController.removeDebugProfile(_actor);
  }
}

Fixed version (ground truth):
/** 
 * Set up and save the new breakpoint configuration for this actor.
 */
public void apply(){
  boolean breakpointsSelected=false;
  _actorProfile=new DebugProfile(_graphController);
  for (int i=0; i < _firingEventTypes.length; i++) {
    if (getBooleanValue(_firingEventTypeLabels[i])) {
      _actorProfile.listenForEvent(_firingEventTypes[i]);
      breakpointsSelected=true;
    }
 else {
      _actorProfile.unlistenForEvent(_firingEventTypes[i]);
    }
  }
  Director director=((Actor)_actor).getExecutiveDirector();
  DebugController debugController=(DebugController)director.getAttribute(_DEBUGCONTROLLER);
  if (breakpointsSelected) {
    if (debugController != null) {
      debugController.putDebugProfile(_actor,_actorProfile);
    }
 else {
      String moml="String_Node_Str" + _DEBUGCONTROLLER + "String_Node_Str";
      ChangeRequest request=new MoMLChangeRequest(this,director,moml.toString());
      request.addChangeListener(this);
      director.requestChange(request);
    }
  }
 else {
    debugController.removeDebugProfile(_actor);
  }
}