nus-yam/ex-repair huggingface dataset:
Program: 74082
Project: 74082
Buggy source:
/** 
 * Check whether the given Ptolemy model object has any connections, i.e. is connected to any other components via some link.
 * @param namedObj The Ptolemy model object which is to be analyzed
 * @return True if the object is an Actor and any port has any relations oris connected to any other port; true if the object is a Relation; false if the object is an Attribute. Defaults to false.
 */
protected static boolean _isConnected(NamedObj namedObj){
  if (namedObj instanceof Attribute) {
    return false;
  }
  if (namedObj instanceof Actor) {
    Actor actor=(Actor)namedObj;
    List<Port> ports=new ArrayList<Port>();
    ports.addAll(actor.inputPortList());
    ports.addAll(actor.outputPortList());
    for (    Port port : ports) {
      if (!port.connectedPortList().isEmpty() || !port.linkedRelationList().isEmpty()) {
        return true;
      }
    }
    return false;
  }
  if (namedObj instanceof Relation) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check whether the given Ptolemy model object has any connections, i.e. is connected to any other components via some link.
 * @param namedObj The Ptolemy model object which is to be analyzed
 * @return True if the object is an Actor and any port has any relations oris connected to any other port; true if the object is a Relation; false if the object is an Attribute. Defaults to false.
 */
protected static boolean _isConnected(NamedObj namedObj){
  if (namedObj instanceof Attribute) {
    return false;
  }
  if (namedObj instanceof Actor) {
    Actor actor=(Actor)namedObj;
    List<Port> ports=new ArrayList<Port>();
    ports.addAll(actor.inputPortList());
    ports.addAll(actor.outputPortList());
    for (    Port port : ports) {
      if (!port.connectedPortList().isEmpty() || !port.linkedRelationList().isEmpty()) {
        return true;
      }
    }
    return false;
  }
  if (namedObj instanceof Relation) {
    return true;
  }
  if (namedObj instanceof Port) {
    return true;
  }
  return false;
}
Program: 74083
Project: 74083
Buggy source:
protected static void _showUnnecessaryRelations(CompositeActor parent,boolean show){
  PtolemyModelUtil util=new PtolemyModelUtil();
  for (Iterator containedIterator=parent.containedObjectsIterator(); containedIterator.hasNext(); ) {
    Object containedElement=containedIterator.next();
    if (containedElement instanceof Relation) {
      Relation relation=(Relation)containedElement;
      List<Vertex> vertices=relation.attributeList(ptolemy.moml.Vertex.class);
      for (      Vertex vertex : vertices) {
        List linkedObjects=relation.linkedObjectsList();
        if (linkedObjects.size() == 2) {
          try {
            if (show)             util._hideVertex(relation.getName(),vertex.getName(),false);
 else             util._hideVertex(relation.getName(),vertex.getName(),true);
            util._performChangeRequest(parent);
          }
 catch (          Exception e) {
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
protected static void _showUnnecessaryRelations(CompositeActor parent,boolean show){
  PtolemyModelUtil util=new PtolemyModelUtil();
  for (Iterator containedIterator=parent.containedObjectsIterator(); containedIterator.hasNext(); ) {
    Object containedElement=containedIterator.next();
    if (containedElement instanceof Relation) {
      Relation relation=(Relation)containedElement;
      List<Vertex> vertices=relation.attributeList(ptolemy.moml.Vertex.class);
      for (      Vertex vertex : vertices) {
        List linkedObjects=relation.linkedObjectsList();
        if (linkedObjects.size() == 2) {
          try {
            if (show)             util._hideVertex(relation.getName(),vertex.getName(),false);
 else             util._hideVertex(relation.getName(),vertex.getName(),true);
          }
 catch (          Exception e) {
          }
        }
      }
    }
  }
  util._performChangeRequest(parent);
}
Program: 74084
Project: 74084
Buggy source:
protected void _hideVertex(String relationName,String vertexName,boolean hide){
  String moml="String_Node_Str" + relationName + "String_Node_Str"+ "String_Node_Str"+ vertexName+ "String_Node_Str"+ "String_Node_Str"+ hide+ "String_Node_Str"+ "String_Node_Str";
  _momlChangeRequest.append(moml);
}

Fixed version (ground truth):
protected void _hideVertex(String relationName,String vertexName,boolean hide){
  String propertyString="String_Node_Str" + hide + "String_Node_Str";
  if (!hide)   propertyString="String_Node_Str";
  String moml="String_Node_Str" + relationName + "String_Node_Str"+ "String_Node_Str"+ vertexName+ "String_Node_Str"+ propertyString+ "String_Node_Str";
  _momlChangeRequest.append(moml);
}
Program: 74085
Project: 74085
Buggy source:
private void _replaceRelation(KPort kPort,KNode kNode,Relation newRelation,Relation oldRelation) throws IllegalActionException {
  Port port=null;
  Relation sourceRelation=null;
  if (kPort != null) {
    port=_kieler2PtolemyPorts.get(kPort);
  }
  if (port == null) {
    NamedObj namedObj=_kieler2ptolemyEntityNodes.get(kNode);
    if (namedObj instanceof Port) {
      port=(Port)namedObj;
    }
 else     if (namedObj instanceof Relation) {
      sourceRelation=(Relation)namedObj;
    }
  }
  if (port != null) {
    List<Relation> linkedRelations=port.linkedRelationList();
    int index=linkedRelations.indexOf(oldRelation);
    if (port.linkedRelationList().size() > 2) {
      port.unlink(index);
      port.insertLink(index,newRelation);
    }
 else {
      _ptolemyModelUtil._unlinkPort(port.getName(_compositeActor),index);
      _ptolemyModelUtil._performChangeRequest(_compositeActor);
      _ptolemyModelUtil._linkPort(port.getName(_compositeActor),"String_Node_Str",newRelation.getName(_compositeActor),index);
    }
  }
 else   if (sourceRelation != null) {
    _ptolemyModelUtil._link("String_Node_Str",sourceRelation.getName(),"String_Node_Str",newRelation.getName(_compositeActor));
  }
}

Fixed version (ground truth):
private void _replaceRelation(KPort kPort,KNode kNode,Relation newRelation,Relation oldRelation) throws IllegalActionException {
  Port port=null;
  Relation sourceRelation=null;
  if (kPort != null) {
    port=_kieler2PtolemyPorts.get(kPort);
  }
  if (port == null) {
    NamedObj namedObj=_kieler2ptolemyEntityNodes.get(kNode);
    if (namedObj instanceof Port) {
      port=(Port)namedObj;
    }
 else     if (namedObj instanceof Relation) {
      sourceRelation=(Relation)namedObj;
    }
  }
  if (port != null) {
    boolean outsideLink=true;
    List<Relation> linkedRelations=port.linkedRelationList();
    if (linkedRelations.isEmpty() && port instanceof ComponentPort) {
      linkedRelations=((ComponentPort)port).insideRelationList();
      outsideLink=false;
    }
    int index=linkedRelations.indexOf(oldRelation);
    if (outsideLink) {
      _ptolemyModelUtil._unlinkPort(port.getName(_compositeActor),index);
      _ptolemyModelUtil._performChangeRequest(_compositeActor);
      _ptolemyModelUtil._linkPort(port.getName(_compositeActor),"String_Node_Str",newRelation.getName(_compositeActor),index);
    }
 else {
      if (port instanceof ComponentPort) {
        ((ComponentPort)port).unlinkInside(index);
        ((ComponentPort)port).insertInsideLink(index,newRelation);
      }
    }
  }
 else   if (sourceRelation != null) {
    _ptolemyModelUtil._link("String_Node_Str",sourceRelation.getName(),"String_Node_Str",newRelation.getName(_compositeActor));
  }
}
Program: 74088
Project: 74088
Buggy source:
/** 
 * Show the specified message in a modal dialog. This is deferred to execute in the swing event thread if it is called outside that thread.
 * @param info The message.
 */
protected void _message(String info){
  Object[] message=new Object[1];
  message[0]=StringUtilities.ellipsis(info,StringUtilities.ELLIPSIS_LENGTH_LONG);
  Object[] options={"String_Node_Str"};
  JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE,null,options,options[0]);
}

Fixed version (ground truth):
/** 
 * Show the specified message in a modal dialog. This is deferred to execute in the swing event thread if it is called outside that thread.
 * @param info The message.
 */
protected void _message(String info){
  Object[] message=new Object[1];
  message[0]=_messageComponent(StringUtilities.ellipsis(info,StringUtilities.ELLIPSIS_LENGTH_LONG));
  Object[] options={"String_Node_Str"};
  JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE,null,options,options[0]);
}
Program: 74089
Project: 74089
Buggy source:
/** 
 * Show the specified message and throwable information. If the throwable is an instance of CancelException, then it is not shown.  By default, only the message of the throwable is thrown.  The stack trace information is only shown if the user clicks on the "Display Stack Trace" button. This is deferred to execute in the swing event thread if it is called outside that thread.
 * @param info The message.
 * @param throwable The throwable.
 * @see ptolemy.util.CancelException
 */
protected void _error(String info,Throwable throwable){
  if (throwable instanceof ptolemy.util.CancelException) {
    return;
  }
  Object[] message=new Object[1];
  String string;
  if (info != null) {
    string=info + "String_Node_Str" + throwable.getMessage();
  }
 else {
    string=throwable.getMessage();
  }
  message[0]=StringUtilities.ellipsis(string,StringUtilities.ELLIPSIS_LENGTH_SHORT);
  Object[] options={"String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,MessageHandler.shortDescription(throwable),JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE,null,options,options[0]);
  if (selected == 1) {
    _showStackTrace(throwable,info);
  }
}

Fixed version (ground truth):
/** 
 * Show the specified message and throwable information. If the throwable is an instance of CancelException, then it is not shown.  By default, only the message of the throwable is thrown.  The stack trace information is only shown if the user clicks on the "Display Stack Trace" button. This is deferred to execute in the swing event thread if it is called outside that thread.
 * @param info The message.
 * @param throwable The throwable.
 * @see ptolemy.util.CancelException
 */
protected void _error(String info,Throwable throwable){
  if (throwable instanceof ptolemy.util.CancelException) {
    return;
  }
  Object[] message=new Object[1];
  String string;
  if (info != null) {
    string=info + "String_Node_Str" + throwable.getMessage();
  }
 else {
    string=throwable.getMessage();
  }
  message[0]=_messageComponent(StringUtilities.ellipsis(string,StringUtilities.ELLIPSIS_LENGTH_SHORT));
  Object[] options={"String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,MessageHandler.shortDescription(throwable),JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE,null,options,options[0]);
  if (selected == 1) {
    _showStackTrace(throwable,info);
  }
}
Program: 74090
Project: 74090
Buggy source:
/** 
 * Show the specified message and throwable information in a modal dialog.  If the user clicks on the "Cancel" button, then throw an exception. This gives the user the option of not continuing the execution, something that is particularly useful if continuing execution will result in repeated warnings. By default, only the message of the throwable is shown.  The stack trace information is only shown if the user clicks on the "Display Stack Trace" button. NOTE: If this is called outside the swing event thread, then no cancel button is presented and no CancelException will be thrown.  This is because the displaying of the message must be deferred to the swing event thread, according to the swing architecture, or we could get deadlock or rendering problems.
 * @param info The message.
 * @param throwable The throwable.
 * @exception ptolemy.util.CancelException If the user clicks on the"Cancel" button.
 */
protected void _warning(String info,Throwable throwable) throws CancelException {
  Object[] message=new Object[1];
  message[0]=StringUtilities.ellipsis(info,StringUtilities.ELLIPSIS_LENGTH_LONG);
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 1) {
    _showStackTrace(throwable,info);
  }
 else   if (selected == 2) {
    throw new ptolemy.util.CancelException();
  }
}

Fixed version (ground truth):
/** 
 * Show the specified message and throwable information in a modal dialog.  If the user clicks on the "Cancel" button, then throw an exception. This gives the user the option of not continuing the execution, something that is particularly useful if continuing execution will result in repeated warnings. By default, only the message of the throwable is shown.  The stack trace information is only shown if the user clicks on the "Display Stack Trace" button. NOTE: If this is called outside the swing event thread, then no cancel button is presented and no CancelException will be thrown.  This is because the displaying of the message must be deferred to the swing event thread, according to the swing architecture, or we could get deadlock or rendering problems.
 * @param info The message.
 * @param throwable The throwable.
 * @exception ptolemy.util.CancelException If the user clicks on the"Cancel" button.
 */
protected void _warning(String info,Throwable throwable) throws CancelException {
  Object[] message=new Object[1];
  message[0]=_messageComponent(StringUtilities.ellipsis(info,StringUtilities.ELLIPSIS_LENGTH_LONG));
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 1) {
    _showStackTrace(throwable,info);
  }
 else   if (selected == 2) {
    throw new ptolemy.util.CancelException();
  }
}
Program: 74091
Project: 74091
Buggy source:
/** 
 * Ask the user a yes/no question, and return true if the answer is yes.
 * @param question The yes/no question.
 * @return True if the answer is yes.
 */
protected boolean _yesNoQuestion(String question){
  Object[] message=new Object[1];
  message[0]=StringUtilities.ellipsis(question,StringUtilities.ELLIPSIS_LENGTH_LONG);
  Object[] options={"String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Ask the user a yes/no question, and return true if the answer is yes.
 * @param question The yes/no question.
 * @return True if the answer is yes.
 */
protected boolean _yesNoQuestion(String question){
  Object[] message=new Object[1];
  message[0]=_messageComponent(StringUtilities.ellipsis(question,StringUtilities.ELLIPSIS_LENGTH_LONG));
  Object[] options={"String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    return true;
  }
 else {
    return false;
  }
}
Program: 74092
Project: 74092
Buggy source:
/** 
 * Ask the user a yes/no/cancel question, and return true if the answer is yes.
 * @param question The yes/no/cancel question.
 * @return True if the answer is yes.
 * @exception ptolemy.util.CancelException If the user clicks onthe "Cancel" button.
 */
protected boolean _yesNoCancelQuestion(String question) throws CancelException {
  Object[] message=new Object[1];
  message[0]=StringUtilities.ellipsis(question,StringUtilities.ELLIPSIS_LENGTH_LONG);
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    return true;
  }
 else   if (selected == 2) {
    throw new ptolemy.util.CancelException();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Ask the user a yes/no/cancel question, and return true if the answer is yes.
 * @param question The yes/no/cancel question.
 * @return True if the answer is yes.
 * @exception ptolemy.util.CancelException If the user clicks onthe "Cancel" button.
 */
protected boolean _yesNoCancelQuestion(String question) throws CancelException {
  Object[] message=new Object[1];
  message[0]=_messageComponent(StringUtilities.ellipsis(question,StringUtilities.ELLIPSIS_LENGTH_LONG));
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int selected=JOptionPane.showOptionDialog(getContext(),message,"String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    return true;
  }
 else   if (selected == 2) {
    throw new ptolemy.util.CancelException();
  }
 else {
    return false;
  }
}
Program: 74093
Project: 74093
Buggy source:
/** 
 * Display a stack trace dialog. The "info" argument is a string printed at the top of the dialog instead of the Throwable message.
 * @param throwable The throwable.
 * @param info A message.
 */
protected void _showStackTrace(Throwable throwable,String info){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new PrintWriter(sw);
  throwable.printStackTrace(pw);
  JTextArea text=new JTextArea(sw.toString(),60,80);
  JScrollPane stext=new JScrollPane(text);
  stext.setPreferredSize(new Dimension(600,300));
  text.setCaretPosition(0);
  text.setEditable(false);
  Object[] message=new Object[2];
  String string;
  if (info != null) {
    string=info + "String_Node_Str" + throwable.getMessage();
  }
 else {
    string=throwable.getMessage();
  }
  message[0]=StringUtilities.ellipsis(string,StringUtilities.ELLIPSIS_LENGTH_LONG);
  message[1]=stext;
  JOptionPane.showMessageDialog(getContext(),message,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
}

Fixed version (ground truth):
/** 
 * Display a stack trace dialog. The "info" argument is a string printed at the top of the dialog instead of the Throwable message.
 * @param throwable The throwable.
 * @param info A message.
 */
protected void _showStackTrace(Throwable throwable,String info){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new PrintWriter(sw);
  throwable.printStackTrace(pw);
  JTextArea text=new JTextArea(sw.toString(),60,80);
  JScrollPane stext=new JScrollPane(text);
  stext.setPreferredSize(new Dimension(600,300));
  text.setCaretPosition(0);
  text.setEditable(false);
  Object[] message=new Object[2];
  String string;
  if (info != null) {
    string=info + "String_Node_Str" + throwable.getMessage();
  }
 else {
    string=throwable.getMessage();
  }
  message[0]=_messageComponent(StringUtilities.ellipsis(string,StringUtilities.ELLIPSIS_LENGTH_LONG));
  message[1]=stext;
  JOptionPane.showMessageDialog(getContext(),message,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
}
Program: 74094
Project: 74094
Buggy source:
public StringBuffer generateCode(ModelType modelType,String inputTemporalFormula,FormulaType formulaType,int variableSpanSize,int FSMBufferSize) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  StringBuffer systemDescription=new StringBuffer("String_Node_Str");
switch (modelType) {
case Kripke:
    if (_model instanceof CompositeActor)     systemDescription.append(SMVUtility.generateSMVDescription((CompositeActor)_model.clone(),inputTemporalFormula,formulaType.toString(),String.valueOf(variableSpanSize)));
 else     systemDescription.append(((FmvAutomaton)_model.clone()).convertToSMVFormat(inputTemporalFormula,formulaType,variableSpanSize));
  break;
case CTA:
systemDescription.append(REDUtility.generateREDDescription((CompositeActor)_model.clone(),inputTemporalFormula,formulaType,variableSpanSize,FSMBufferSize));
break;
case Maude:
if (_model instanceof CompositeActor) if (template.getExpression().trim().equals("String_Node_Str")) {
systemDescription.append(RTMaudeUtility.generateRTMDescription((CompositeActor)_model,inputTemporalFormula,true));
}
 else {
systemDescription.append(RTMaudeUtility.generateRTMDescription(template.openForReading(),(CompositeActor)_model,inputTemporalFormula));
}
break;
}
return systemDescription;
}

Fixed version (ground truth):
public StringBuffer generateCode(ModelType modelType,String inputTemporalFormula,FormulaType formulaType,int variableSpanSize,int delayActorBufferSize) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  StringBuffer systemDescription=new StringBuffer("String_Node_Str");
switch (modelType) {
case Kripke:
    if (_model instanceof CompositeActor)     systemDescription.append(SMVUtility.generateSMVDescription((CompositeActor)_model.clone(),inputTemporalFormula,formulaType.toString(),String.valueOf(variableSpanSize)));
 else     systemDescription.append(((FmvAutomaton)_model.clone()).convertToSMVFormat(inputTemporalFormula,formulaType,variableSpanSize));
  break;
case CTA:
systemDescription.append(REDUtility.generateREDDescription((CompositeActor)_model.clone(),inputTemporalFormula,formulaType,variableSpanSize,delayActorBufferSize));
break;
case Maude:
if (_model instanceof CompositeActor) if (template.getExpression().trim().equals("String_Node_Str")) {
systemDescription.append(RTMaudeUtility.generateRTMDescription((CompositeActor)_model,inputTemporalFormula,true));
}
 else {
systemDescription.append(RTMaudeUtility.generateRTMDescription(template.openForReading(),(CompositeActor)_model,inputTemporalFormula));
}
break;
}
return systemDescription;
}
Program: 74095
Project: 74095
Buggy source:
/** 
 * Return true if the contained elements form a lattice; false, otherwise.
 */
public boolean isLattice(){
  List<LatticeElement> elements=(List<LatticeElement>)deepEntityList();
  _clearHighlightColor(elements);
  PropertyLattice lattice=new Lattice(elements);
  if ((lattice.top() == null)) {
    MessageHandler.error("String_Node_Str");
    return false;
  }
 else {
    NamedObj top=(NamedObj)lattice.top();
    _debug("String_Node_Str" + top.getName());
  }
  if ((lattice.bottom() == null)) {
    MessageHandler.error("String_Node_Str");
    return false;
  }
 else {
    NamedObj bottom=(NamedObj)lattice.bottom();
    _debug("String_Node_Str" + bottom.getName());
  }
  for (int i=0; i < (elements.size() - 1); i++) {
    for (int j=i + 1; j < elements.size(); j++) {
      NamedObj lub=(NamedObj)lattice.leastUpperBound(elements.get(i),elements.get(j));
      if (lub == null) {
        MessageHandler.error("String_Node_Str" + elements.get(i).getName() + "String_Node_Str"+ elements.get(j).getName()+ "String_Node_Str"+ "String_Node_Str");
        return false;
      }
 else {
        _debug("String_Node_Str" + elements.get(i).getName() + "String_Node_Str"+ elements.get(j).getName()+ "String_Node_Str"+ lub.getName());
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if the contained elements form a lattice; false, otherwise.
 */
public boolean isLattice(){
  List<LatticeElement> elements=(List<LatticeElement>)deepEntityList();
  _clearHighlightColor(elements);
  PropertyLattice lattice=new Lattice(elements);
  try {
    if ((lattice.top() == null)) {
      _debug("String_Node_Str");
      MessageHandler.error("String_Node_Str");
      return false;
    }
 else {
      LatticeProperty top=(LatticeProperty)lattice.top();
      _debug("String_Node_Str" + top.toString());
    }
  }
 catch (  GraphStateException e) {
    _debug("String_Node_Str");
    MessageHandler.error("String_Node_Str");
    return false;
  }
  if ((lattice.bottom() == null)) {
    _debug("String_Node_Str");
    MessageHandler.error("String_Node_Str");
    return false;
  }
 else {
    LatticeProperty bottom=(LatticeProperty)lattice.bottom();
    _debug("String_Node_Str" + bottom.toString());
  }
  List<LatticeProperty> latticeProperties=((Lattice)lattice).getLatticeProperties();
  for (int i=0; i < (latticeProperties.size() - 1); i++) {
    for (int j=i + 1; j < latticeProperties.size(); j++) {
      LatticeProperty lub=(LatticeProperty)lattice.leastUpperBound(latticeProperties.get(i),latticeProperties.get(j));
      if (lub == null) {
        _debug("String_Node_Str");
        MessageHandler.error("String_Node_Str" + elements.get(i).getName() + "String_Node_Str"+ elements.get(j).getName()+ "String_Node_Str"+ "String_Node_Str");
        return false;
      }
 else {
        _debug("String_Node_Str" + elements.get(i).getName() + "String_Node_Str"+ elements.get(j).getName()+ "String_Node_Str"+ lub.toString());
      }
    }
  }
  _debug("String_Node_Str");
  return true;
}
Program: 74096
Project: 74096
Buggy source:
public static NamedObj getCorrespondingPatternObject(NamedObj replacementObject){
  if (replacementObject instanceof Replacement) {
    return ((TransformationRule)replacementObject.getContainer()).getPattern();
  }
  PatternObjectAttribute attribute=getPatternObjectAttribute(replacementObject);
  if (attribute == null) {
    return null;
  }
  CompositeActorMatcher container=getContainingPatternOrReplacement(replacementObject);
  if (container == null) {
    return null;
  }
  String patternObjectName=attribute.getExpression();
  if (patternObjectName.equals("String_Node_Str")) {
    return null;
  }
  TransformationRule transformer=(TransformationRule)container.getContainer();
  Pattern pattern=transformer.getPattern();
  if (replacementObject instanceof Attribute) {
    return pattern.getAttribute(patternObjectName);
  }
 else   if (replacementObject instanceof Entity) {
    return pattern.getEntity(patternObjectName);
  }
 else   if (replacementObject instanceof Relation) {
    return pattern.getRelation(patternObjectName);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static NamedObj getCorrespondingPatternObject(NamedObj replacementObject){
  if (replacementObject instanceof Replacement) {
    return ((TransformationRule)replacementObject.getContainer()).getPattern();
  }
  PatternObjectAttribute attribute;
  try {
    attribute=getPatternObjectAttribute(replacementObject,false);
  }
 catch (  KernelException e) {
    attribute=null;
  }
  if (attribute == null) {
    return null;
  }
  CompositeActorMatcher container=getContainingPatternOrReplacement(replacementObject);
  if (container == null) {
    return null;
  }
  String patternObjectName=attribute.getExpression();
  if (patternObjectName.equals("String_Node_Str")) {
    return null;
  }
  TransformationRule transformer=(TransformationRule)container.getContainer();
  Pattern pattern=transformer.getPattern();
  if (replacementObject instanceof Attribute) {
    return pattern.getAttribute(patternObjectName);
  }
 else   if (replacementObject instanceof Entity) {
    return pattern.getEntity(patternObjectName);
  }
 else   if (replacementObject instanceof Relation) {
    return pattern.getRelation(patternObjectName);
  }
 else {
    return null;
  }
}
Program: 74097
Project: 74097
Buggy source:
public static PatternObjectAttribute getPatternObjectAttribute(NamedObj object){
  Attribute attribute=object.getAttribute("String_Node_Str");
  if (attribute != null && attribute instanceof PatternObjectAttribute) {
    return (PatternObjectAttribute)attribute;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static PatternObjectAttribute getPatternObjectAttribute(NamedObj object,boolean createNew) throws IllegalActionException, NameDuplicationException {
  Attribute attribute=object.getAttribute("String_Node_Str");
  if (createNew && (attribute == null || !(attribute instanceof PatternObjectAttribute))) {
    attribute=new PatternObjectAttribute(object,"String_Node_Str");
  }
  return (PatternObjectAttribute)attribute;
}
Program: 74098
Project: 74098
Buggy source:
public void removeRows(int[] rows){
  if (_cellEditor != null) {
    _cellEditor.stopCellEditing();
  }
  TransformationRule transformer=(TransformationRule)getModel();
  CompositeActorMatcher replacement=transformer.getReplacement();
  List<ComponentEntity> entities=new LinkedList<ComponentEntity>();
  for (int i=0; i < rows.length; i++) {
    String replacementName=_getCellEditorValue((JPanel)_tableModel.getValueAt(rows[i],2));
    ComponentEntity entity=replacement.getEntity(replacementName);
    if (entity != null) {
      entities.add(entity);
    }
  }
  int i=0;
  for (  ComponentEntity entity : entities) {
    _setPatternObject(entity,"String_Node_Str",i++ > 0);
  }
}

Fixed version (ground truth):
public void removeRows(int[] rows){
  if (_cellEditor != null) {
    _cellEditor.stopCellEditing();
  }
  TransformationRule transformer=(TransformationRule)getModel();
  CompositeActorMatcher replacement=transformer.getReplacement();
  List<ComponentEntity> entities=new LinkedList<ComponentEntity>();
  for (int i=0; i < rows.length; i++) {
    String replacementName=_getCellEditorValue((JPanel)_tableModel.getValueAt(rows[i],2));
    ComponentEntity entity=replacement.getEntity(replacementName);
    if (entity != null) {
      entities.add(entity);
    }
  }
  if (entities.isEmpty()) {
    _refreshTable();
  }
 else {
    int i=0;
    for (    ComponentEntity entity : entities) {
      _setPatternObject(entity,"String_Node_Str",i++ > 0);
    }
  }
}
Program: 74099
Project: 74099
Buggy source:
private void _setOrClearPatternObjectAttributes(NamedObj object,boolean isSet,Collection<?> filter){
  try {
    Collection<?> children;
    if (filter == null) {
      children=GTTools.getChildren(object,false,true,true,true);
    }
 else {
      children=filter;
    }
    PatternObjectAttribute patternObject=GTTools.getPatternObjectAttribute(object);
    if (isSet) {
      if (patternObject == null) {
        patternObject=new PatternObjectAttribute(object,"String_Node_Str");
      }
      String name=_getNameWithinContainer(object,getFrameController().getTransformationRule().getPattern());
      patternObject.setPersistent(true);
      patternObject.setExpression(name);
    }
 else     if (patternObject != null) {
      patternObject.setPersistent(false);
      patternObject.setExpression("String_Node_Str");
    }
    for (    Object child : children) {
      _setOrClearPatternObjectAttributes((NamedObj)child,isSet,null);
    }
  }
 catch (  KernelException e) {
    throw new KernelRuntimeException(e,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void _setOrClearPatternObjectAttributes(NamedObj object,boolean isSet,Collection<?> filter){
  try {
    Collection<?> children;
    if (filter == null) {
      children=GTTools.getChildren(object,false,true,true,true);
    }
 else {
      children=filter;
    }
    PatternObjectAttribute patternObject=GTTools.getPatternObjectAttribute(object,false);
    if (isSet) {
      if (patternObject == null) {
        patternObject=new PatternObjectAttribute(object,"String_Node_Str");
      }
      String name=_getNameWithinContainer(object,getFrameController().getTransformationRule().getPattern());
      patternObject.setPersistent(true);
      patternObject.setExpression(name);
    }
 else     if (patternObject != null) {
      patternObject.setPersistent(false);
      patternObject.setExpression("String_Node_Str");
    }
    for (    Object child : children) {
      _setOrClearPatternObjectAttributes((NamedObj)child,isSet,null);
    }
  }
 catch (  KernelException e) {
    throw new KernelRuntimeException(e,"String_Node_Str");
  }
}
Program: 74101
Project: 74101
Buggy source:
private void _setPatternObject(NamedObj replacementObject,String patternObjectName,boolean mergeWithPrevious){
  String moml="String_Node_Str" + patternObjectName + "String_Node_Str";
  MoMLChangeRequest request=new MoMLChangeRequest(this,replacementObject,moml);
  request.setUndoable(true);
  request.setMergeWithPreviousUndo(mergeWithPrevious);
  replacementObject.requestChange(request);
}

Fixed version (ground truth):
private void _setPatternObject(NamedObj replacementObject,String patternObjectName,boolean mergeWithPrevious){
  if (patternObjectName.equals("String_Node_Str")) {
    try {
      PatternObjectAttribute attribute=GTTools.getPatternObjectAttribute(replacementObject,false);
      if (attribute != null) {
        attribute.setContainer(null);
      }
    }
 catch (    KernelException e) {
      throw new InternalErrorException(replacementObject,e,"String_Node_Str");
    }
  }
 else {
    String moml="String_Node_Str" + patternObjectName + "String_Node_Str";
    MoMLChangeRequest request=new MoMLChangeRequest(this,replacementObject,moml);
    request.setUndoable(true);
    request.setMergeWithPreviousUndo(mergeWithPrevious);
    replacementObject.requestChange(request);
  }
}
Program: 74104
Project: 74104
Buggy source:
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}

Fixed version (ground truth):
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}
Program: 74105
Project: 74105
Buggy source:
/** 
 */
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.modal.kernel.FSMActor actor=(ptolemy.domains.modal.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @throws IllegalActionException 
 */
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.modal.kernel.FSMActor actor=(ptolemy.domains.modal.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}
Program: 74106
Project: 74106
Buggy source:
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    Iterator transitions=state.outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      try {
        result.add(getParseTree(transition.guardExpression));
      }
 catch (      IllegalActionException ex) {
        throw new AssertionError("String_Node_Str" + transition.getGuardExpression() + "String_Node_Str"+ KernelException.stackTraceToString(ex));
      }
      OutputActionsAttribute outputActions=transition.outputActions;
      result.addAll(_getParseTrees(outputActions));
      CommitActionsAttribute setActions=transition.setActions;
      result.addAll(_getParseTrees(setActions));
    }
  }
  return result;
}

Fixed version (ground truth):
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    Iterator transitions=state.outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      try {
        result.add(getParseTree(transition.guardExpression));
      }
 catch (      IllegalActionException ex) {
        throw new AssertionError("String_Node_Str" + transition.getGuardExpression() + "String_Node_Str"+ KernelException.stackTraceToString(ex));
      }
      OutputActionsAttribute outputActions=transition.outputActions;
      result.addAll(_getParseTrees(outputActions));
      CommitActionsAttribute setActions=transition.setActions;
      result.addAll(_getParseTrees(setActions));
    }
  }
  return result;
}
Program: 74107
Project: 74107
Buggy source:
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}

Fixed version (ground truth):
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}
Program: 74108
Project: 74108
Buggy source:
/** 
 */
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.modal.kernel.FSMActor actor=(ptolemy.domains.modal.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}

Fixed version (ground truth):
/** 
 */
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.modal.kernel.FSMActor actor=(ptolemy.domains.modal.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    result.addAll(getParseTrees(state));
  }
  return result;
}
Program: 74109
Project: 74109
Buggy source:
protected List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException {
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    Iterator transitions=state.outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      try {
        result.add(getParseTree(transition.guardExpression));
      }
 catch (      IllegalActionException ex) {
        throw new AssertionError("String_Node_Str" + transition.getGuardExpression() + "String_Node_Str"+ KernelException.stackTraceToString(ex));
      }
      OutputActionsAttribute outputActions=transition.outputActions;
      result.addAll(_getParseTrees(outputActions));
      CommitActionsAttribute setActions=transition.setActions;
      result.addAll(_getParseTrees(setActions));
    }
  }
  return result;
}

Fixed version (ground truth):
protected List<ASTPtRootNode> _getAttributeParseTrees(){
  List<ASTPtRootNode> result=super._getAttributeParseTrees();
  ptolemy.domains.fsm.kernel.FSMActor actor=(ptolemy.domains.fsm.kernel.FSMActor)getComponent();
  Iterator states=actor.entityList(State.class).iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    Iterator transitions=state.outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      try {
        result.add(getParseTree(transition.guardExpression));
      }
 catch (      IllegalActionException ex) {
        throw new AssertionError("String_Node_Str" + transition.getGuardExpression() + "String_Node_Str"+ KernelException.stackTraceToString(ex));
      }
      OutputActionsAttribute outputActions=transition.outputActions;
      result.addAll(_getParseTrees(outputActions));
      CommitActionsAttribute setActions=transition.setActions;
      result.addAll(_getParseTrees(setActions));
    }
  }
  return result;
}
Program: 74110
Project: 74110
Buggy source:
/** 
 * Generate wrap up code. This method reads the <code>wrapupBlock</code> from Expression.c, replaces macros with their values and appends the processed code block to the given code buffer.
 * @return The processed code string.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
public String generateWrapupCode() throws IllegalActionException {
  CParseTreeCodeGenerator parseTreeCG=(CParseTreeCodeGenerator)getParseTreeCodeGenerator();
  StringBuffer code=new StringBuffer();
  code.append(super.generateWrapupCode());
  code.append(processCode(parseTreeCG.generateWrapupCode()));
  parseTreeCG=null;
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate wrap up code. This method reads the <code>wrapupBlock</code> from Expression.c, replaces macros with their values and appends the processed code block to the given code buffer.
 * @return The processed code string.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
public String generateWrapupCode() throws IllegalActionException {
  CParseTreeCodeGenerator parseTreeCG=(CParseTreeCodeGenerator)getParseTreeCodeGenerator();
  StringBuffer code=new StringBuffer();
  code.append(super.generateWrapupCode());
  code.append(processCode(parseTreeCG.generateWrapupCode()));
  return code.toString();
}
Program: 74111
Project: 74111
Buggy source:
/** 
 * Return a new parse tree code generator to use with expressions.
 * @return the parse tree code generator to use with expressions.
 */
public ParseTreeCodeGenerator getParseTreeCodeGenerator(){
  _parseTreeCodeGenerator=new CParseTreeCodeGenerator(_codeGenerator);
  return _parseTreeCodeGenerator;
}

Fixed version (ground truth):
/** 
 * Return a new parse tree code generator to use with expressions.
 * @return the parse tree code generator to use with expressions.
 */
public ParseTreeCodeGenerator getParseTreeCodeGenerator(){
  if (!(_parseTreeCodeGenerator instanceof CParseTreeCodeGenerator)) {
    _parseTreeCodeGenerator=new CParseTreeCodeGenerator(_codeGenerator);
  }
  return _parseTreeCodeGenerator;
}
Program: 74112
Project: 74112
Buggy source:
/** 
 * Create a new instance of the C code generator helper.
 * @param component The actor object for this helper.
 */
public CCodeGeneratorHelper(Object component){
  super(component);
  _parseTreeCodeGenerator=getParseTreeCodeGenerator();
}

Fixed version (ground truth):
/** 
 * Create a new instance of the C code generator helper.
 * @param component The actor object for this helper.
 */
public CCodeGeneratorHelper(Object component){
  super(component);
}
Program: 74113
Project: 74113
Buggy source:
/** 
 * Evaluate the parse tree with the specified root node using the specified scope to resolve the values of variables.
 * @param node The root of the parse tree.
 * @param scope The scope for evaluation.
 * @return The result of evaluation.
 * @exception IllegalActionException If an error occurs duringevaluation.
 */
public ptolemy.data.Token evaluateParseTree(ASTPtRootNode node,ParserScope scope) throws IllegalActionException {
  ParseTreeTypeInference typeInference=new ParseTreeTypeInference();
  typeInference.inferTypes(node,scope);
  _scope=scope;
  node.visit(this);
  _scope=null;
  return _evaluatedChildToken;
}

Fixed version (ground truth):
/** 
 * Evaluate the parse tree with the specified root node using the specified scope to resolve the values of variables.
 * @param node The root of the parse tree.
 * @param scope The scope for evaluation.
 * @return The result of evaluation.
 * @exception IllegalActionException If an error occurs duringevaluation.
 */
public ptolemy.data.Token evaluateParseTree(ASTPtRootNode node,ParserScope scope) throws IllegalActionException {
  ParseTreeTypeInference typeInference=new ParseTreeTypeInference();
  typeInference.inferTypes(node,scope);
  _scope=scope;
  node.visit(this);
  return _evaluatedChildToken;
}
Program: 74114
Project: 74114
Buggy source:
/** 
 * Return a new parse tree code generator to use with expressions.
 * @return the parse tree code generator to use with expressions.
 */
public ParseTreeCodeGenerator getParseTreeCodeGenerator(){
  _parseTreeCodeGenerator=new JavaParseTreeCodeGenerator();
  return _parseTreeCodeGenerator;
}

Fixed version (ground truth):
/** 
 * Return a new parse tree code generator to use with expressions.
 * @return the parse tree code generator to use with expressions.
 */
public ParseTreeCodeGenerator getParseTreeCodeGenerator(){
  if (!(_parseTreeCodeGenerator instanceof JavaParseTreeCodeGenerator)) {
    _parseTreeCodeGenerator=new JavaParseTreeCodeGenerator();
  }
  return _parseTreeCodeGenerator;
}
Program: 74116
Project: 74116
Buggy source:
/** 
 * Transfer inputs from the environment to inside. This also marks the receivers that get data as inputs so that the data will not be overwritten later in the same iteration.
 * @exception IllegalActionException If the transferInputs(Port)method throws it.
 * @return True if at least one token is transferred.
 */
private boolean _transferInputsToInside() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean result=false;
  CompositeActor container=(CompositeActor)getContainer();
  Iterator inports=container.inputPortList().iterator();
  while (inports.hasNext() && !_stopRequested) {
    IOPort port=(IOPort)inports.next();
    result=result || super.transferInputs(port);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Transfer inputs from the environment to inside. This also marks the receivers that get data as inputs so that the data will not be overwritten later in the same iteration.
 * @exception IllegalActionException If the transferInputs(Port)method throws it.
 * @return True if at least one token is transferred.
 */
private boolean _transferInputsToInside() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean result=false;
  CompositeActor container=(CompositeActor)getContainer();
  Iterator inports=container.inputPortList().iterator();
  while (inports.hasNext() && !_stopRequested) {
    IOPort port=(IOPort)inports.next();
    result=super.transferInputs(port) || result;
  }
  return result;
}