nus-yam/ex-repair huggingface dataset:
Program: 74405
Project: 74405
Buggy source:
/** 
 * Set the type of the given node to be the type of constant the variable refers to, if the node represents a constant, or the type of the identifier the node refers to in the current scope.
 * @param node The specified node.
 * @exception IllegalActionException If an inference erroroccurs, or an identifier is not bound in the current scope.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _setType(node,node.getToken().getType());
    return;
  }
  String name=node.getName();
  Type type=null;
  if (_scope != null) {
    type=_scope.getType(name);
    if (type != null && !(type instanceof ObjectType)) {
      _setType(node,type);
      return;
    }
  }
  if (Constants.get(name) != null) {
    _setType(node,Constants.get(name).getType());
    return;
  }
  if (type != null) {
    _setType(node,type);
  }
  throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Set the type of the given node to be the type of constant the variable refers to, if the node represents a constant, or the type of the identifier the node refers to in the current scope.
 * @param node The specified node.
 * @exception IllegalActionException If an inference erroroccurs, or an identifier is not bound in the current scope.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _setType(node,node.getToken().getType());
    return;
  }
  String name=node.getName();
  Type type=null;
  if (_scope != null) {
    type=_scope.getType(name);
    if (type != null && !(type instanceof ObjectType)) {
      _setType(node,type);
      return;
    }
  }
  if (Constants.get(name) != null) {
    _setType(node,Constants.get(name).getType());
    return;
  }
  if (type != null) {
    _setType(node,type);
    return;
  }
  throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
}
Program: 74406
Project: 74406
Buggy source:
/** 
 * @param container
 * @param name
 * @throws NameDuplicationException
 * @throws IllegalActionException
 */
public ModelExecutor(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  actorInput=new TypedIOPort(this,"String_Node_Str",true,false);
  actorInput.setTypeEquals(ActorToken.TYPE);
  asynchronous=new Parameter(this,"String_Node_Str");
  asynchronous.setTypeEquals(BaseType.BOOLEAN);
  asynchronous.setToken(BooleanToken.FALSE);
}

Fixed version (ground truth):
/** 
 * @param container
 * @param name
 * @throws NameDuplicationException
 * @throws IllegalActionException
 */
public ModelExecutor(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  actorInput=new TypedIOPort(this,"String_Node_Str",true,false);
  actorInput.setTypeEquals(ActorToken.TYPE);
}
Program: 74407
Project: 74407
Buggy source:
public boolean postfire() throws IllegalActionException {
  return super.postfire() && (_hasToken() || !_eventQueue.isEmpty());
}

Fixed version (ground truth):
public boolean postfire() throws IllegalActionException {
  boolean result=super.postfire();
  if (result && ModelExecutor.this._stopRequested) {
    result=false;
  }
  if (result && !_hasToken() && _eventQueue.isEmpty()) {
    result=false;
  }
  return result;
}
Program: 74408
Project: 74408
Buggy source:
/** 
 * Further process the XML element when it is closed with an end tag. If the element corresponds to a Ptolemy actor that has been changed to its backtracking version, the MoML description of the original actor's icon is copied to the new model, because the backtracking version does not have an icon associated with it.
 * @param container The container of the element.
 * @param elementName The XML element to be closed.
 * @exception IllegalActionException If the MoML of the originalactor's icon cannot be read and inserted into the new model.
 */
public void filterEndElement(NamedObj container,String elementName) throws IllegalActionException {
  if ((elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) && container != null && container.getClassName() != null) {
    if (_classStack.peek() != null && container.getClassName().equals(_newClassName((String)_classStack.peek()))) {
      _copyIcon(container);
      _entitiesChanged.add(container);
    }
    _classStack.pop();
  }
}

Fixed version (ground truth):
/** 
 * Further process the XML element when it is closed with an end tag. If the element corresponds to a Ptolemy actor that has been changed to its backtracking version, the MoML description of the original actor's icon is copied to the new model, because the backtracking version does not have an icon associated with it.
 * @param container The container of the element.
 * @param elementName The XML element to be closed.
 * @param currentCharData The character data, which appearsonly in the doc and configure elements
 * @exception IllegalActionException If the MoML of the originalactor's icon cannot be read and inserted into the new model.
 */
public void filterEndElement(NamedObj container,String elementName,StringBuffer currentCharData) throws IllegalActionException {
  if ((elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) && container != null && container.getClassName() != null) {
    if (_classStack.peek() != null && container.getClassName().equals(_newClassName((String)_classStack.peek()))) {
      _copyIcon(container);
      _entitiesChanged.add(container);
    }
    _classStack.pop();
  }
}
Program: 74409
Project: 74409
Buggy source:
public void setMatchResult(TransformationRule rule,String sourceFileName,List<MatchResult> results){
  _rule=rule;
  _sourceFileName=sourceFileName;
  _results=results;
  _currentPosition=0;
  _enableOrDisableActions();
  _rerender();
  _refreshStatusBars();
}

Fixed version (ground truth):
public void setMatchResult(TransformationRule rule,String sourceFileName,List<MatchResult> results,int position){
  _rule=rule;
  _sourceFileName=sourceFileName;
  _results=results;
  int size=results.size();
  if (position < size) {
    _currentPosition=position;
  }
 else   if (size > 0) {
    _currentPosition=size - 1;
  }
 else {
    _currentPosition=0;
  }
  _enableOrDisableActions();
  _rerender();
  _refreshStatusBars();
}
Program: 74410
Project: 74410
Buggy source:
private void _transformAll(){
  _beginTransform();
  CompositeEntity oldModel;
  try {
    oldModel=(CompositeEntity)getModel().clone();
    oldModel.setDeferringChangeRequests(false);
    _setTransformed(oldModel);
    GraphTransformer.transform(_rule,_results);
  }
 catch (  CloneNotSupportedException e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
catch (  KernelException e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}

Fixed version (ground truth):
private void _transformAll(){
  _beginTransform();
  CompositeEntity oldModel;
  try {
    Workspace workspace=getModel().workspace();
    oldModel=(CompositeEntity)new MoMLParser(workspace).parse(getModel().exportMoML());
    UndoStackAttribute prevStack=UndoStackAttribute.getUndoInfo(getModel());
    UndoStackAttribute stack=(UndoStackAttribute)prevStack.clone(workspace);
    stack.setContainer(oldModel);
    GraphTransformer.transform(_rule,_results);
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}
Program: 74411
Project: 74411
Buggy source:
UndoChangeModelAction(CompositeEntity model){
  _model=model;
}

Fixed version (ground truth):
UndoChangeModelAction(CompositeEntity model,int position){
  _model=model;
  _position=position;
}
Program: 74412
Project: 74412
Buggy source:
private void _transform(){
  _beginTransform();
  CompositeEntity oldModel;
  try {
    Workspace workspace=getModel().workspace();
    oldModel=(CompositeEntity)new MoMLParser(workspace).parse(getModel().exportMoML());
    UndoStackAttribute prevStack=UndoStackAttribute.getUndoInfo(getModel());
    UndoStackAttribute stack=(UndoStackAttribute)prevStack.clone(workspace);
    stack.setContainer(oldModel);
    _setTransformed(oldModel);
    GraphTransformer.transform(_rule,_results.get(_currentPosition));
  }
 catch (  CloneNotSupportedException e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}

Fixed version (ground truth):
private void _transform(){
  _beginTransform();
  CompositeEntity oldModel;
  try {
    Workspace workspace=getModel().workspace();
    oldModel=(CompositeEntity)new MoMLParser(workspace).parse(getModel().exportMoML());
    UndoStackAttribute prevStack=UndoStackAttribute.getUndoInfo(getModel());
    UndoStackAttribute stack=(UndoStackAttribute)prevStack.clone(workspace);
    stack.setContainer(oldModel);
    GraphTransformer.transform(_rule,_results.get(_currentPosition));
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}
Program: 74414
Project: 74414
Buggy source:
private void _finishTransform(CompositeEntity oldModel){
  CompositeEntity model=(CompositeEntity)getModel();
  if (_topFrame == null) {
    GTFrameTools.changeModel(this,model,true,new UndoChangeModelAction(oldModel));
  }
  _setTableauFactory(this,model);
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results);
  if (_topFrame == null) {
    for (    MatchResultViewer viewer : _subviewers) {
      viewer._finishTransform(oldModel);
    }
  }
  _enableOrDisableActions();
  model.requestChange(new ChangeRequest(this,"String_Node_Str"){
    protected void _execute() throws Exception {
      ((UpdateController)_getGraphModel()).startUpdate();
    }
  }
);
}

Fixed version (ground truth):
private void _finishTransform(CompositeEntity oldModel){
  CompositeEntity model=(CompositeEntity)getModel();
  if (_topFrame == null) {
    GTFrameTools.changeModel(this,model,true,new UndoChangeModelAction(oldModel,_currentPosition));
  }
  _setTableauFactory(this,model);
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results);
  _closeSubviewers();
  _enableOrDisableActions();
  ((UpdateController)_getGraphModel()).startUpdate();
}
Program: 74415
Project: 74415
Buggy source:
public void execute() throws Exception {
  MatchResultViewer viewer=MatchResultViewer.this;
  ModelChangeRequest request=new ModelChangeRequest(viewer,viewer,_model,new UndoChangeModelAction((CompositeEntity)getModel()));
  request.setUndoable(true);
  request.execute();
  _enableOrDisableActions(_isTransformed(_model));
}

Fixed version (ground truth):
public void execute() throws Exception {
  MatchResultViewer viewer=MatchResultViewer.this;
  ModelChangeRequest request=new ModelChangeRequest(viewer,viewer,_model,new UndoChangeModelAction((CompositeEntity)getModel(),_currentPosition));
  request.setUndoable(true);
  request.execute();
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,_model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results,_position);
  _closeSubviewers();
  _enableOrDisableActions();
}
Program: 74416
Project: 74416
Buggy source:
private void _refreshStatusBars(){
  if (_topFrame != null) {
    _topFrame._refreshStatusBars();
  }
 else {
    StringBuffer text=new StringBuffer();
    if (_sourceFileName != null) {
      text.append("String_Node_Str");
      text.append(_sourceFileName);
      text.append("String_Node_Str");
    }
    if (_results != null) {
      text.append('(');
      text.append(_currentPosition + 1);
      text.append('/');
      text.append(_results.size());
      text.append(')');
    }
    _statusBar.setMessage(text.toString());
    int max=0;
    if (_results != null) {
      max=_results.size();
      _statusBar.progressBar().setValue(_currentPosition + 1);
      _statusBar.progressBar().setMaximum(max);
    }
    for (    MatchResultViewer subviewer : _subviewers) {
      subviewer._statusBar.setMessage(text.toString());
      if (_results != null) {
        subviewer._statusBar.progressBar().setValue(_currentPosition + 1);
        subviewer._statusBar.progressBar().setMaximum(max);
      }
    }
  }
}

Fixed version (ground truth):
private void _refreshStatusBars(){
  if (_topFrame != null) {
    _topFrame._refreshStatusBars();
  }
 else {
    StringBuffer text=new StringBuffer();
    if (_sourceFileName != null) {
      text.append("String_Node_Str");
      text.append(_sourceFileName);
      text.append("String_Node_Str");
    }
    if (_results != null) {
      text.append('(');
      text.append(_currentPosition + 1);
      text.append('/');
      text.append(_results.size());
      text.append(')');
    }
    _statusBar.setMessage(text.toString());
    int max=0;
    if (_results != null) {
      max=_results.size();
      _statusBar.progressBar().setMaximum(max);
      _statusBar.progressBar().setValue(_currentPosition + 1);
    }
    for (    MatchResultViewer subviewer : _subviewers) {
      subviewer._statusBar.setMessage(text.toString());
      if (_results != null) {
        subviewer._statusBar.progressBar().setValue(_currentPosition + 1);
        subviewer._statusBar.progressBar().setMaximum(max);
      }
    }
  }
}
Program: 74417
Project: 74417
Buggy source:
protected void _updateParserScope(ParserScope superscope,List<?> names,Type[] types){
  if (types != null && types.length > 0) {
    Iterator<?> namesIter=names.iterator();
    Map<String,Type> paramMap=new HashMap<String,Type>();
    for (int i=0; namesIter.hasNext(); i++) {
      String name=(String)namesIter.next();
      paramMap.put(name,types[i]);
    }
    _scope=new ParametersParserScope(paramMap,superscope);
  }
 else {
    _scope=superscope;
  }
}

Fixed version (ground truth):
protected void _updateParserScope() throws IllegalActionException {
  Event event=(Event)getContainer();
  NamedObj eventContainer=event.getContainer();
  if (eventContainer instanceof ERGController) {
    ERGController controller=(ERGController)event.getContainer();
    ParserScope superscope=controller.getPortScope();
    List<?> names=event.parameters.getArgumentNameList();
    Type[] types=event.parameters.getArgumentTypes();
    if (types != null && types.length > 0) {
      Iterator<?> namesIter=names.iterator();
      Map<String,Type> paramMap=new HashMap<String,Type>();
      for (int i=0; namesIter.hasNext(); i++) {
        String name=(String)namesIter.next();
        paramMap.put(name,types[i]);
      }
      _scope=new ParametersParserScope(paramMap,superscope);
    }
 else {
      _scope=superscope;
    }
  }
  _scopeVersion=_workspace.getVersion();
}
Program: 74418
Project: 74418
Buggy source:
protected ParserScope _getParserScope(){
  return _scope;
}

Fixed version (ground truth):
protected ParserScope _getParserScope(){
  if (_scopeVersion != _workspace.getVersion()) {
    try {
      _updateParserScope();
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException(e);
    }
  }
  return _scope;
}
Program: 74419
Project: 74419
Buggy source:
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._controllerVersion=-1;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._eventQueue=new PriorityQueue<TimedEvent>(10,_EVENT_COMPARATOR);
  newObject._inputQueue=new PriorityQueue<TimedEvent>(5,_EVENT_COMPARATOR);
  newObject._controllerVersion=-1;
  return newObject;
}
Program: 74421
Project: 74421
Buggy source:
private void _fire(TimedEvent timedEvent) throws IllegalActionException {
  ERGController controller=getController();
  Object contents=timedEvent.contents;
  if (contents instanceof Actor) {
    Actor actor=(Actor)contents;
    boolean prefire=actor.prefire();
    if (prefire) {
      actor.fire();
      actor.postfire();
    }
  }
 else   if (contents instanceof Event) {
    Event event=(Event)timedEvent.contents;
    controller._setCurrentEvent(event);
    event.fire(timedEvent._arguments);
    Actor[] refinements=event.getRefinement();
    if (refinements != null) {
      for (      Actor refinement : refinements) {
        if (_stopRequested) {
          break;
        }
        if (refinement instanceof ERGController) {
          ((ERGController)refinement).director._initializeSchedule();
          _fireAt(refinement,_currentTime,null);
        }
 else {
          if (refinement.prefire()) {
            refinement.fire();
            refinement.postfire();
          }
        }
      }
    }
    if (((BooleanToken)event.isFinalState.getToken()).booleanValue()) {
      _eventQueue.clear();
    }
  }
 else {
    throw new InternalErrorException(this,null,"String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
private boolean _fire(TimedEvent timedEvent) throws IllegalActionException {
  ERGController controller=getController();
  Object contents=timedEvent.contents;
  if (contents instanceof Actor) {
    Actor actor=(Actor)contents;
    boolean prefire=actor.prefire();
    if (prefire) {
      _eventQueue.remove(timedEvent);
      _inputQueue.remove(timedEvent);
      actor.fire();
      actor.postfire();
      return true;
    }
 else {
      return false;
    }
  }
 else   if (contents instanceof Event) {
    _eventQueue.remove(timedEvent);
    _inputQueue.remove(timedEvent);
    Event event=(Event)timedEvent.contents;
    controller._setCurrentEvent(event);
    event.fire(timedEvent._arguments);
    Actor[] refinements=event.getRefinement();
    if (refinements != null) {
      for (      Actor refinement : refinements) {
        if (_stopRequested) {
          break;
        }
        if (refinement instanceof ERGController) {
          ((ERGController)refinement).director._initializeSchedule();
          _fireAt(refinement,_currentTime,null);
        }
 else {
          if (refinement.prefire()) {
            refinement.fire();
            refinement.postfire();
          }
        }
      }
    }
    if (((BooleanToken)event.isFinalState.getToken()).booleanValue()) {
      _eventQueue.clear();
    }
    return true;
  }
 else {
    throw new InternalErrorException(this,null,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 74422
Project: 74422
Buggy source:
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == parameters) {
    super.attributeChanged(attribute);
    NamedObj container=getContainer();
    if (container instanceof ERGController) {
      ERGController controller=(ERGController)getContainer();
      ParserScope portScope=controller.getPortScope();
      actions._updateParserScope(portScope,parameters.getArgumentNameList(),parameters.getArgumentTypes());
    }
  }
 else   if (attribute != isInitialState) {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == parameters) {
    super.attributeChanged(attribute);
    actions._updateParserScope();
  }
 else   if (attribute != isInitialState) {
    super.attributeChanged(attribute);
  }
}
Program: 74423
Project: 74423
Buggy source:
public Type[] getArgumentTypes(){
  return _argumentTypes;
}

Fixed version (ground truth):
public Type[] getArgumentTypes() throws IllegalActionException {
  if (_parseTreeVersion != _workspace.getVersion()) {
    _parse();
  }
  return _parseTree.getArgumentTypes();
}
Program: 74424
Project: 74424
Buggy source:
public List<?> getArgumentNameList(){
  return _argumentNameList;
}

Fixed version (ground truth):
public List<?> getArgumentNameList() throws IllegalActionException {
  if (_parseTreeVersion != _workspace.getVersion()) {
    _parse();
  }
  return _parseTree.getArgumentNameList();
}
Program: 74425
Project: 74425
Buggy source:
public void setExpression(String expression) throws IllegalActionException {
  String function="String_Node_Str" + expression + "String_Node_Str";
  try {
    ASTPtFunctionDefinitionNode parseTree=(ASTPtFunctionDefinitionNode)_parser.generateParseTree(function);
    _argumentNameList=parseTree.getArgumentNameList();
    _argumentTypes=parseTree.getArgumentTypes();
  }
 catch (  Exception e) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  super.setExpression(expression);
}

Fixed version (ground truth):
public void setExpression(String expression) throws IllegalActionException {
  super.setExpression(expression);
  try {
    _parse();
  }
 catch (  Exception e) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
}
Program: 74428
Project: 74428
Buggy source:
public void visitFunctionApplicationNode(ASTPtFunctionApplicationNode node) throws IllegalActionException {
  ptolemy.data.Token value=null;
  String functionName=node.getFunctionName();
  if ((_scope != null) && (functionName != null)) {
    if (!_excludedNames.contains(functionName)) {
      value=_scope.get(node.getFunctionName());
    }
  }
  if (value == null) {
    int numChildren=node.jjtGetNumChildren();
    for (int i=1; i < numChildren; i++) {
      _visitChild(node,i);
    }
  }
 else {
    _defaultVisit(node);
  }
}

Fixed version (ground truth):
public void visitFunctionApplicationNode(ASTPtFunctionApplicationNode node) throws IllegalActionException {
  ptolemy.data.Token value=null;
  String functionName=node.getFunctionName();
  if ((_scope != null) && (functionName != null)) {
    if (!_excludedNames.contains(functionName)) {
      value=_scope.get(node.getFunctionName());
      if (value instanceof ObjectToken) {
        value=null;
      }
    }
  }
  if (value == null) {
    int numChildren=node.jjtGetNumChildren();
    for (int i=1; i < numChildren; i++) {
      _visitChild(node,i);
    }
  }
 else {
    _defaultVisit(node);
  }
}
Program: 74432
Project: 74432
Buggy source:
public void fire() throws IllegalActionException {
  if (!_hasToken()) {
    TimedEvent timedEvent=_eventQueue.poll();
    setModelTime(timedEvent.timeStamp);
    Actor actor=(Actor)timedEvent.contents;
    if (actor.prefire()) {
      actor.fire();
      actor.postfire();
    }
  }
 else {
    super.fire();
  }
  for (  Object entityObject : entityList()) {
    if (entityObject instanceof CompositeActor) {
      CompositeActor actor=(CompositeActor)entityObject;
      if (actor.isOpaque()) {
        Director director=actor.getDirector();
        for (        Object portObject : actor.outputPortList()) {
          IOPort port=(IOPort)portObject;
          director.transferOutputs(port);
        }
      }
    }
  }
  for (  Object portObject : portList()) {
    IOPort port=(IOPort)portObject;
    if (port.isOutput()) {
      for (int i=0; i < port.getWidthInside(); i++) {
        while (port.hasTokenInside(i)) {
          Token token=port.getInside(i);
          port.send(i,token);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  if (!_hasToken() && !_eventQueue.isEmpty()) {
    TimedEvent timedEvent=_eventQueue.poll();
    setModelTime(timedEvent.timeStamp);
    Actor actor=(Actor)timedEvent.contents;
    if (actor.prefire()) {
      actor.fire();
      actor.postfire();
    }
  }
 else {
    super.fire();
  }
  for (  Object entityObject : entityList()) {
    if (entityObject instanceof CompositeActor) {
      CompositeActor actor=(CompositeActor)entityObject;
      if (actor.isOpaque()) {
        Director director=actor.getDirector();
        for (        Object portObject : actor.outputPortList()) {
          IOPort port=(IOPort)portObject;
          director.transferOutputs(port);
        }
      }
    }
  }
  for (  Object portObject : portList()) {
    IOPort port=(IOPort)portObject;
    if (port.isOutput()) {
      for (int i=0; i < port.getWidthInside(); i++) {
        while (port.hasTokenInside(i)) {
          Token token=port.getInside(i);
          port.send(i,token);
        }
      }
    }
  }
}
Program: 74434
Project: 74434
Buggy source:
protected void _init() throws IllegalActionException, NameDuplicationException {
  setClassName("String_Node_Str");
  new Pattern(this,"String_Node_Str");
  new Replacement(this,"String_Node_Str");
  modelInput=new TypedIOPort(this,"String_Node_Str",true,false);
  modelInput.setTypeEquals(ActorToken.TYPE);
  modelOutput=new TypedIOPort(this,"String_Node_Str",false,true);
  modelOutput.setTypeEquals(ActorToken.TYPE);
  mode=new StringParameter(this,"String_Node_Str");
  for (int i=Mode.values().length - 1; i >= 0; i--) {
    mode.addChoice(Mode.values()[i].toString());
  }
  mode.addValueListener(this);
  mode.setExpression(Mode.REPLACE_FIRST.toString());
  repeatUntilFixpoint=new Parameter(this,"String_Node_Str");
  repeatUntilFixpoint.setTypeEquals(BaseType.BOOLEAN);
  repeatUntilFixpoint.setToken(BooleanToken.FALSE);
  new TransformationDirector(this,"String_Node_Str");
}

Fixed version (ground truth):
protected void _init() throws IllegalActionException, NameDuplicationException {
  setClassName("String_Node_Str");
  new Pattern(this,"String_Node_Str");
  new Replacement(this,"String_Node_Str");
  modelInput=new TypedIOPort(this,"String_Node_Str",true,false);
  modelInput.setTypeEquals(ActorToken.TYPE);
  modelOutput=new TypedIOPort(this,"String_Node_Str",false,true);
  modelOutput.setTypeEquals(ActorToken.TYPE);
  mode=new StringParameter(this,"String_Node_Str");
  for (int i=Mode.values().length - 1; i >= 0; i--) {
    mode.addChoice(Mode.values()[i].toString());
  }
  mode.addValueListener(this);
  mode.setExpression(Mode.REPLACE_FIRST.toString());
  repeatUntilFixpoint=new Parameter(this,"String_Node_Str");
  repeatUntilFixpoint.setTypeEquals(BaseType.BOOLEAN);
  repeatUntilFixpoint.setToken(BooleanToken.FALSE);
  repeatCount=new Parameter(this,"String_Node_Str");
  repeatCount.setTypeAtMost(BaseType.LONG);
  repeatCount.setExpression("String_Node_Str");
  new TransformationDirector(this,"String_Node_Str");
}
Program: 74437
Project: 74437
Buggy source:
public void broadcast(Token[] tokenArray,int vectorLength) throws NoRoomException, IllegalActionException {
  ((TypedIOPort)ModelExecutor.this.getPort(getName())).broadcast(tokenArray,vectorLength);
}

Fixed version (ground truth):
public void broadcast(Token[] tokenArray,int vectorLength) throws NoRoomException, IllegalActionException {
  TypedIOPort executorPort=(TypedIOPort)ModelExecutor.this.getPort(getName());
  executorPort.broadcast(tokenArray,vectorLength);
}
Program: 74438
Project: 74438
Buggy source:
public boolean postfire(){
  return false;
}

Fixed version (ground truth):
public boolean postfire() throws IllegalActionException {
  return super.postfire() && (_hasToken() || !_eventQueue.isEmpty());
}
Program: 74439
Project: 74439
Buggy source:
Wrapper(Workspace workspace) throws IllegalActionException, NameDuplicationException {
  super(workspace);
  new Director(this,"String_Node_Str");
}

Fixed version (ground truth):
Wrapper(Workspace workspace) throws IllegalActionException, NameDuplicationException {
  super(workspace);
  new WrapperDirector(this,"String_Node_Str");
}
Program: 74440
Project: 74440
Buggy source:
public boolean prefire() throws IllegalActionException {
  return super.prefire() && actorInput.hasToken(0);
}

Fixed version (ground truth):
public boolean prefire() throws IllegalActionException {
  return super.prefire() && (_hasToken() || !_eventQueue.isEmpty());
}
Program: 74441
Project: 74441
Buggy source:
public void fire() throws IllegalActionException {
  Entity actor=((ActorToken)actorInput.get(0)).getEntity();
  if (actor instanceof ComponentEntity) {
    ComponentEntity entity=(ComponentEntity)actor;
    Workspace workspace=actor.workspace();
    try {
      Wrapper wrapper=new Wrapper(workspace);
      Effigy parentEffigy=Configuration.findEffigy(toplevel());
      PtolemyEffigy effigy=new PtolemyEffigy(parentEffigy,parentEffigy.uniqueName("String_Node_Str"));
      effigy.setModel(wrapper);
      entity.setContainer(wrapper);
      Manager manager=new Manager(workspace,"String_Node_Str");
      wrapper.setManager(manager);
      manager.execute();
    }
 catch (    KernelException e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  if (!_hasToken()) {
    TimedEvent timedEvent=_eventQueue.poll();
    setModelTime(timedEvent.timeStamp);
    Actor actor=(Actor)timedEvent.contents;
    if (actor.prefire()) {
      actor.fire();
      actor.postfire();
    }
  }
 else {
    super.fire();
  }
  for (  Object entityObject : entityList()) {
    if (entityObject instanceof CompositeActor) {
      CompositeActor actor=(CompositeActor)entityObject;
      if (actor.isOpaque()) {
        Director director=actor.getDirector();
        for (        Object portObject : actor.outputPortList()) {
          IOPort port=(IOPort)portObject;
          director.transferOutputs(port);
        }
      }
    }
  }
  for (  Object portObject : portList()) {
    IOPort port=(IOPort)portObject;
    if (port.isOutput()) {
      for (int i=0; i < port.getWidthInside(); i++) {
        while (port.hasTokenInside(i)) {
          Token token=port.getInside(i);
          port.send(i,token);
        }
      }
    }
  }
}
Program: 74442
Project: 74442
Buggy source:
public void send(int channelIndex,Token[] tokenArray,int vectorLength) throws NoRoomException, IllegalActionException {
  ((TypedIOPort)ModelExecutor.this.getPort(getName())).send(channelIndex,tokenArray,vectorLength);
}

Fixed version (ground truth):
public void send(int channelIndex,Token[] tokenArray,int vectorLength) throws NoRoomException, IllegalActionException {
  TypedIOPort executorPort=(TypedIOPort)ModelExecutor.this.getPort(getName());
  executorPort.send(channelIndex,tokenArray,vectorLength);
}
Program: 74443
Project: 74443
Buggy source:
public ModelGenerator(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  setClassName("String_Node_Str");
  moml=new TypedIOPort(this,"String_Node_Str",true,false);
  moml.setTypeEquals(BaseType.STRING);
  modelName=new TypedIOPort(this,"String_Node_Str",true,false);
  modelName.setTypeEquals(BaseType.STRING);
  model=new TypedIOPort(this,"String_Node_Str",false,true);
  model.setTypeEquals(ActorToken.TYPE);
}

Fixed version (ground truth):
public ModelGenerator(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  setClassName("String_Node_Str");
  moml=new TypedIOPort(this,"String_Node_Str",true,false);
  moml.setTypeEquals(BaseType.STRING);
  modelName=new TypedIOPort(this,"String_Node_Str",true,false);
  modelName.setTypeEquals(BaseType.STRING);
  output.setName("String_Node_Str");
  output.setTypeEquals(ActorToken.TYPE);
}
Program: 74444
Project: 74444
Buggy source:
public void fire() throws IllegalActionException {
  try {
    Entity entity;
    if (moml.getWidth() > 0 && moml.hasToken(0)) {
      String momlString=((StringToken)moml.get(0)).stringValue();
      _parser.reset();
      entity=(Entity)_parser.parse(momlString);
    }
 else {
      if (_emptyModel == null) {
        _emptyModel=new TypedCompositeActor(workspace());
      }
      entity=_emptyModel;
    }
    if (modelName.getWidth() > 0 && modelName.hasToken(0)) {
      String name=((StringToken)modelName.get(0)).stringValue();
      entity.setName(name);
    }
 else {
      entity.setName("String_Node_Str");
    }
    model.send(0,new ActorToken(entity));
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  super.fire();
  try {
    Entity entity;
    if (moml.getWidth() > 0 && moml.hasToken(0)) {
      String momlString=((StringToken)moml.get(0)).stringValue();
      _parser.reset();
      entity=(Entity)_parser.parse(momlString);
    }
 else {
      if (_emptyModel == null) {
        _emptyModel=new TypedCompositeActor(workspace());
      }
      entity=_emptyModel;
    }
    URI uri;
    if (modelName.getWidth() > 0 && modelName.hasToken(0)) {
      String name=((StringToken)modelName.get(0)).stringValue();
      entity.setName(name);
      uri=_getModelURI(name);
    }
 else {
      entity.setName("String_Node_Str");
      uri=_getModelURI("String_Node_Str");
    }
    URIAttribute attribute=(URIAttribute)entity.getAttribute("String_Node_Str",URIAttribute.class);
    if (attribute == null) {
      attribute=new URIAttribute(entity,"String_Node_Str");
    }
    attribute.setURI(uri);
    output.send(0,new ActorToken(entity));
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
}
Program: 74445
Project: 74445
Buggy source:
private static void _updateEntitiesAppearance(CompositeEntity container,GTIngredientsAttribute attribute){
  try {
    container.workspace().getReadAccess();
    if (container instanceof GTEntity) {
      ((GTEntity)container).updateAppearance(attribute);
    }
    for (    Object entity : container.entityList()) {
      if (entity instanceof GTEntity) {
        GTEntity gtEntity=(GTEntity)entity;
        gtEntity.updateAppearance(attribute);
      }
      if (entity instanceof CompositeEntity) {
        _updateEntitiesAppearance((CompositeEntity)entity,attribute);
      }
    }
  }
  finally {
    container.workspace().doneReading();
  }
}

Fixed version (ground truth):
private static void _updateEntitiesAppearance(CompositeEntity container,GTIngredientsAttribute attribute){
  try {
    container.workspace().getReadAccess();
    if (container instanceof GTEntity) {
      if (GTTools.getCorrespondingPatternObject(container) == attribute.getContainer()) {
        GTEntity gtEntity=(GTEntity)container;
        gtEntity.updateAppearance(attribute);
      }
    }
    for (    Object entity : container.entityList()) {
      if (entity instanceof GTEntity) {
        if (GTTools.getCorrespondingPatternObject((NamedObj)entity) == attribute.getContainer()) {
          GTEntity gtEntity=(GTEntity)entity;
          gtEntity.updateAppearance(attribute);
        }
      }
      if (entity instanceof CompositeEntity) {
        _updateEntitiesAppearance((CompositeEntity)entity,attribute);
      }
    }
  }
  finally {
    container.workspace().doneReading();
  }
}
Program: 74446
Project: 74446
Buggy source:
/** 
 * Queue a change request.  If there is a manager, then first call stopFire() before deferring to the base class.
 * @param change The requested change.
 */
public void requestChange(ChangeRequest change){
  Manager manager=getManager();
  if (manager != null) {
    stopFire();
  }
  super.requestChange(change);
}

Fixed version (ground truth):
/** 
 * Queue a change request.  If there is a manager, then first call stopFire() before deferring to the base class.
 * @param change The requested change.
 */
public void requestChange(ChangeRequest change){
  Manager manager=getManager();
  super.requestChange(change);
  if (manager != null) {
    stopFire();
  }
}
Program: 74448
Project: 74448
Buggy source:
public boolean isApplicable(GTEntity entity){
  return true;
}

Fixed version (ground truth):
public boolean isApplicable(NamedObj entity){
  return true;
}
Program: 74449
Project: 74449
Buggy source:
public void initialize() throws IllegalActionException {
  super.initialize();
  _hasToken=true;
}

Fixed version (ground truth):
public void initialize() throws IllegalActionException {
  super.initialize();
  _hasToken=_inputToken != null;
  _outputToken=null;
}
Program: 74450
Project: 74450
Buggy source:
public void send(int channelIndex,Token[] tokenArray,int vectorLength) throws IllegalActionException, NoRoomException {
  if (isOutput() && channelIndex == 0 && vectorLength == 1) {
    Token token=tokenArray[0];
    _checkType(token);
    ToplevelTransformer transformer=(ToplevelTransformer)getContainer();
    transformer._outputToken=(ActorToken)token;
  }
}

Fixed version (ground truth):
public void send(int channelIndex,Token[] tokenArray,int vectorLength) throws IllegalActionException, NoRoomException {
  if (isOutput() && channelIndex == 0 && vectorLength == 1) {
    Token token=tokenArray[0];
    _checkType(token);
    ToplevelTransformer transformer=(ToplevelTransformer)getContainer();
    if (transformer._outputToken == null) {
      transformer._outputToken=(ActorToken)token;
    }
  }
}
Program: 74451
Project: 74451
Buggy source:
/** 
 * Test whether the composite entity is opaque or not. Return <tt>true</tt> if the composite entity is an instance of   {@link CompositeActor} and itis opaque. A composite actor is opaque if it has a director inside, which means the new level of hierarchy that it creates cannot be flattened, or it has a  {@link HierarchyFlatteningAttribute} attributeinside with value <tt>true.
 * @param entity The composite entity to be tested.
 * @return <tt>true</tt> if the composite entity is an instance of {@link CompositeActor} and it is opaque.
 */
protected boolean _isOpaque(CompositeEntity entity){
  if (entity instanceof CompositeActor && ((CompositeActor)entity).isOpaque()) {
    return true;
  }
 else {
    NamedObj container=entity.getContainer();
    Token value=_getAttribute(container,"String_Node_Str",HierarchyFlatteningAttribute.class);
    boolean isOpaque=value == null ? HierarchyFlatteningAttribute.DEFAULT : !((BooleanToken)value).booleanValue();
    return isOpaque;
  }
}

Fixed version (ground truth):
/** 
 * Test whether the composite entity is opaque or not. Return <tt>true</tt> if the composite entity is an instance of   {@link CompositeActor} and itis opaque. A composite actor is opaque if it has a director inside, which means the new level of hierarchy that it creates cannot be flattened, or it has a  {@link HierarchyFlatteningAttribute} attributeinside with value <tt>true.
 * @param entity The composite entity to be tested.
 * @return <tt>true</tt> if the composite entity is an instance of {@link CompositeActor} and it is opaque.
 */
protected boolean _isOpaque(CompositeEntity entity){
  if (entity instanceof CompositeActor && ((CompositeActor)entity).isOpaque()) {
    return true;
  }
 else {
    NamedObj container=entity.getContainer();
    Token value=_getAttribute(container,"String_Node_Str",HierarchyFlatteningAttribute.class);
    boolean isOpaque=value == null ? !HierarchyFlatteningAttribute.DEFAULT : !((BooleanToken)value).booleanValue();
    return isOpaque;
  }
}
Program: 74452
Project: 74452
Buggy source:
/** 
 * Return the list of identifiers within the scope.
 * @return The list of identifiers within the scope.
 */
@SuppressWarnings("String_Node_Str") public Set<?> identifierSet(){
  Set<?> set=super.identifierSet();
  set.addAll(ModelScope.getAllScopedObjectNames(ERGController.this));
  return set;
}

Fixed version (ground truth):
/** 
 * Return the list of identifiers within the scope.
 * @return The list of identifiers within the scope.
 */
@SuppressWarnings("String_Node_Str") public Set<?> identifierSet(){
  Set<Object> set=super.identifierSet();
  set.addAll((Collection<?>)ModelScope.getAllScopedObjectNames(ERGController.this));
  return set;
}
Program: 74454
Project: 74454
Buggy source:
/** 
 * Get the variable with the given name in the scope of the given container.  If the name contains the "::" scoping specifier, then an attribute more deeply in the hierarchy is searched for.  The scope of the object includes any container of the given object, and any variable contained in a scope extending attribute inside any of those containers.
 * @param exclude A variable to exclude from the search.
 * @param container The container to search upwards from.
 * @param name The variable name to search for.
 * @return The variable with the given name or null if the variabledoes not exist.
 */
public static Variable getScopedVariable(Variable exclude,NamedObj container,String name){
  String insideName=name.replaceAll("String_Node_Str","String_Node_Str");
  while (container != null) {
    Variable result=_searchIn(exclude,container,insideName);
    if (result != null) {
      return result;
    }
 else {
      container=container.getContainer();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the variable with the given name in the scope of the given container.  If the name contains the "::" scoping specifier, then an attribute more deeply in the hierarchy is searched for.  The scope of the object includes any container of the given object, and any variable contained in a scope extending attribute inside any of those containers.
 * @param exclude A variable to exclude from the search.
 * @param container The container to search upwards from.
 * @param name The variable name to search for.
 * @return The variable with the given name or null if the variabledoes not exist.
 */
public static Variable getScopedVariable(Variable exclude,NamedObj container,String name){
  String insideName=name.replaceAll("String_Node_Str","String_Node_Str");
  while (container != null) {
    Variable result=_searchIn(exclude,container,insideName);
    if (result != null) {
      return result;
    }
 else {
      NamedObj containerContainer=container.getContainer();
      if (container instanceof ModalController) {
        try {
          State state=(State)((ModalController)container).getRefinedState();
          if (state == null) {
            container=containerContainer;
          }
 else {
            container=state.getContainer();
          }
        }
 catch (        IllegalActionException e) {
          container=containerContainer;
        }
      }
 else {
        container=containerContainer;
      }
    }
  }
  return null;
}
Program: 74455
Project: 74455
Buggy source:
protected NamedObj _getDestination(String name) throws IllegalActionException {
  Event event=(Event)getContainer();
  if (event == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Entity erg=(Entity)event.getContainer();
  if (erg == null) {
    throw new IllegalActionException(this,event,"String_Node_Str");
  }
  IOPort port=(IOPort)erg.getPort(name);
  if (port == null) {
    NamedObj container=erg;
    Attribute variable=null;
    while (variable == null && container != null) {
      variable=_getAttribute(container,name);
      container=container.getContainer();
    }
    if (variable == null) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name);
    }
    if (!(variable instanceof Variable)) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
    }
    return variable;
  }
 else {
    if (!port.isOutput()) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name);
    }
    return port;
  }
}

Fixed version (ground truth):
protected NamedObj _getDestination(String name) throws IllegalActionException {
  Event event=(Event)getContainer();
  if (event == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Entity erg=(Entity)event.getContainer();
  if (erg == null) {
    throw new IllegalActionException(this,event,"String_Node_Str");
  }
  IOPort port=(IOPort)erg.getPort(name);
  if (port == null) {
    NamedObj container=erg;
    Attribute variable=null;
    while (variable == null && container != null) {
      variable=_getAttribute(container,name);
      NamedObj containerContainer=container.getContainer();
      if (container instanceof ModalController) {
        State state=(State)((ModalController)container).getRefinedState();
        if (state == null) {
          container=containerContainer;
        }
 else {
          container=state.getContainer();
        }
      }
 else {
        container=containerContainer;
      }
    }
    if (variable == null) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name);
    }
    if (!(variable instanceof Variable)) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
    }
    return variable;
  }
 else {
    if (!port.isOutput()) {
      throw new IllegalActionException(erg,this,"String_Node_Str" + name);
    }
    return port;
  }
}
Program: 74456
Project: 74456
Buggy source:
/** 
 * Return a scope object that has current values from input ports of this FSMActor in scope.  This scope is used to evaluate guard expressions and set and output actions.
 * @return A scope object that has current values from input ports ofthis FSMActor in scope.
 */
public ParserScope getPortScope(){
  return _objectScope;
}

Fixed version (ground truth):
/** 
 * Return a scope object that has current values from input ports of this FSMActor in scope.  This scope is used to evaluate guard expressions and set and output actions.
 * @return A scope object that has current values from input ports ofthis FSMActor in scope.
 */
public ParserScope getPortScope(){
  if (_objectScopeVersion != workspace().getVersion()) {
    _objectScope=new ERGObjectScope();
    _objectScopeVersion=workspace().getVersion();
  }
  return _objectScope;
}
Program: 74457
Project: 74457
Buggy source:
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == arguments) {
    try {
      _argumentsTree=(ASTPtArrayConstructNode)_parser.generateParseTree(arguments.getExpression());
    }
 catch (    ClassCastException e) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
  }
 else   if (attribute == delay) {
    _delayTree=_parser.generateParseTree(delay.getExpression());
  }
  if (canceling != null && delay != null && isCanceling()) {
    if (!_isZeroDelay()) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
 else     if (_argumentsTree.jjtGetNumChildren() > 0) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == arguments) {
    try {
      _argumentsTree=(ASTPtArrayConstructNode)_parser.generateParseTree(arguments.getExpression());
    }
 catch (    ClassCastException e) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
  }
 else   if (attribute == delay) {
    _delayTree=_parser.generateParseTree(delay.getExpression());
  }
  if (canceling != null && delay != null && isCanceling() && getContainer() != null) {
    if (!_isZeroDelay()) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
 else     if (_argumentsTree.jjtGetNumChildren() > 0) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
  }
}