nus-yam/ex-repair huggingface dataset:
Program: 73342
Project: 73342
Buggy source:
/** 
 * Parent constructor that replaces either targetEntity if replaceTargetEntity is true or otherwise all entities connected to it with a proxy instance (RemoteSink or RemoteSource). The proxy actor is named the same as the original with addition of "_remote" suffix. All links of the targetEntity are removed. The proxy actor dynamically adds ports that were present in the targetEntity (with the same port name) or  and connects them to the targetEntity's relations.
 * @param container The container
 * @param targetEntity the targetEntity to be replaced by a proxy
 * @param replaceTargetEntity true to replace the target entity with the proxy,otherwise replace all entities connecting to it with one proxy
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 * @exception CloneNotSupportedException If port cloning is not supported
 */
public RemoteActor(CompositeEntity container,ComponentEntity targetEntity,boolean replaceTargetEntity) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  super(container,targetEntity.getName() + "String_Node_Str");
  if (replaceTargetEntity) {
    replaceTargetEntity(targetEntity);
  }
 else {
    replaceConnectingEntities(targetEntity);
  }
  setTargetEntityName(targetEntity.getName());
}

Fixed version (ground truth):
/** 
 * Parent constructor that replaces either targetEntity if replaceTargetEntity is true or otherwise all entities connected to it with a proxy instance (RemoteSink or RemoteSource). The proxy actor is named the same as the original with addition of "_remote" suffix. All links of the targetEntity are removed. The proxy actor dynamically adds ports that were present in the targetEntity (with the same port name) or  and connects them to the targetEntity's relations.
 * @param container The container
 * @param targetEntity the targetEntity to be replaced by a proxy
 * @param replaceTargetEntity true to replace the target entity with the proxy,otherwise replace all entities connecting to it with one proxy
 * @param portTypes Map of ports and their resolved types
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 * @exception CloneNotSupportedException If port cloning is not supported
 */
public RemoteActor(CompositeEntity container,ComponentEntity targetEntity,boolean replaceTargetEntity,HashMap<String,Type> portTypes) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  this(container,targetEntity.getName() + "String_Node_Str");
  setTargetEntityName(targetEntity.getFullName());
  _targetEntityName.setExpression(getTargetEntityName());
  if (replaceTargetEntity) {
    replaceTargetEntity(targetEntity,portTypes);
  }
 else {
    replaceConnectingEntities(targetEntity,portTypes);
  }
}
Program: 73344
Project: 73344
Buggy source:
/** 
 * Return the name of the target entity.
 * @return the targetEntityName
 * @see #setTargetActorName(String)
 */
public String getTargetEntityName(){
  return _targetEntityName;
}

Fixed version (ground truth):
/** 
 * Return the full name of the target entity.
 * @return the targetEntityName
 * @see #setTargetActorName(String)
 */
public String getTargetEntityName(){
  return _targetEntityName.getExpression();
}
Program: 73345
Project: 73345
Buggy source:
/** 
 * Replace the targetEntity with the proxy. This configuration would allow execution of the model where sinks or sources run remotely and proxies execute instead of them and pass information to/from them.
 * @param targetEntity The target entity that is replaced with the proxy
 * @exception CloneNotSupportedException
 * @exception IllegalActionException
 * @exception NameDuplicationException
 */
private void replaceTargetEntity(ComponentEntity targetEntity) throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  ArrayList<Attribute> attributes=new ArrayList<Attribute>(targetEntity.attributeList());
  for (  Attribute attribute : attributes) {
    attribute.setContainer(this);
  }
  for (  Object portObject : targetEntity.portList()) {
    if (!(portObject instanceof IOPort)) {
      continue;
    }
    IOPort port=(IOPort)portObject;
    IOPort remotePort=clonePort(port);
    remotePort.setName(port.getName());
    remotePort.setContainer(this);
    for (    Object relationObject : port.linkedRelationList()) {
      Relation relation=(Relation)relationObject;
      port.unlink(relation);
      remotePort.link(relation);
    }
    port.unlinkAll();
  }
  targetEntity.setContainer(null);
}

Fixed version (ground truth):
/** 
 * Replace the targetEntity with the proxy. This configuration would allow execution of the model where sinks or sources run remotely and proxies execute instead of them and pass information to/from them.
 * @param targetEntity The target entity that is replaced with the proxy
 * @param portTypes The map of ports and their resolved types
 * @exception CloneNotSupportedException
 * @exception IllegalActionException
 * @exception NameDuplicationException
 */
private void replaceTargetEntity(ComponentEntity targetEntity,HashMap<String,Type> portTypes) throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  ArrayList<Attribute> attributes=new ArrayList<Attribute>(targetEntity.attributeList());
  for (  Attribute attribute : attributes) {
    attribute.setContainer(this);
  }
  for (  Object portObject : targetEntity.portList()) {
    if (!(portObject instanceof IOPort)) {
      continue;
    }
    IOPort port=(IOPort)portObject;
    IOPort remotePort=(IOPort)port.clone(port.workspace());
    remotePort.setName(port.getName());
    remotePort.setContainer(this);
    remotePort.setPersistent(true);
    if (remotePort instanceof TypedIOPort) {
      Type type=portTypes.get(port.getFullName());
      ((TypedIOPort)remotePort).setTypeEquals(type);
      StringAttribute targetPortName=new StringAttribute(remotePort,"String_Node_Str");
      targetPortName.setExpression(port.getFullName());
    }
    for (    Object relationObject : port.linkedRelationList()) {
      Relation relation=(Relation)relationObject;
      port.unlink(relation);
      remotePort.link(relation);
    }
    port.unlinkAll();
  }
  targetEntity.setContainer(null);
}
Program: 73346
Project: 73346
Buggy source:
/** 
 * Set the name of the target entity.
 * @param targetEntityName the target entity name
 * @see #getTargetActorName()
 */
public void setTargetEntityName(String targetEntityName){
  this._targetEntityName=targetEntityName;
}

Fixed version (ground truth):
/** 
 * Set the full name of the target entity.
 * @param targetEntityName the target entity name
 * @throws IllegalActionException If the change is not acceptable to the container.
 * @see #getTargetActorName()
 */
public void setTargetEntityName(String targetEntityName) throws IllegalActionException {
  _targetEntityName.setExpression(targetEntityName);
}
Program: 73347
Project: 73347
Buggy source:
/** 
 * Replace the targetSink with the RemoteSink instance.
 * @see RemoteActor
 * @param container The container
 * @param targetSink The target sink
 * @param replaceTargetEntity replaceTargetEntity true to replace the target entity with the proxy,otherwise replace all entities connecting to it with one proxy
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 * @exception CloneNotSupportedException If port cloning is not supported
 */
public RemoteSink(CompositeEntity container,ComponentEntity targetSink,boolean replaceTargetEntity) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  super(container,targetSink,replaceTargetEntity);
}

Fixed version (ground truth):
/** 
 * Replace the targetSink with the RemoteSink instance.
 * @see RemoteActor
 * @param container The container
 * @param targetSink The target sink
 * @param replaceTargetEntity replaceTargetEntity true to replace the target entity with the proxy,otherwise replace all entities connecting to it with one proxy
 * @param portTypes Map of ports and their resolved types
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 * @exception CloneNotSupportedException If port cloning is not supported
 */
public RemoteSink(CompositeEntity container,ComponentEntity targetSink,boolean replaceTargetEntity,HashMap<String,Type> portTypes) throws IllegalActionException, NameDuplicationException, CloneNotSupportedException {
  super(container,targetSink,replaceTargetEntity,portTypes);
}
Program: 73348
Project: 73348
Buggy source:
/** 
 * Return the MoML string that will change the boolean value of the isAcceptable parameter in a Concept to its opposite value (false to true, and true to false).
 * @param isAcceptableParameter The isAcceptable parameter.
 * @return The MoML string that will execute the change.
 * @throws IllegalActionException Thrown if there is a problem gettingthe current value of the isAcceptable parameter.
 */
private String _getToggleAcceptabilityMoML(Parameter isAcceptableParameter) throws IllegalActionException {
  BooleanToken value=(BooleanToken)isAcceptableParameter.getToken();
  value=value.not();
  return new String("String_Node_Str" + isAcceptableParameter.getName() + "String_Node_Str"+ value.toString()+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Return the MoML string that will change the boolean value of the isAcceptable parameter in a Concept to its opposite value (false to true, and true to false).
 * @param isAcceptableParameter The isAcceptable parameter.
 * @return The MoML string that will execute the change.
 * @throws IllegalActionException Thrown if there is a problem gettingthe current value of the isAcceptable parameter.
 */
private String _getToggleAcceptabilityMoML(Parameter isAcceptableParameter) throws IllegalActionException {
  BooleanToken value=(BooleanToken)isAcceptableParameter.getToken();
  value=value.not();
  return "String_Node_Str" + isAcceptableParameter.getName() + "String_Node_Str"+ value.toString()+ "String_Node_Str";
}
Program: 73349
Project: 73349
Buggy source:
/** 
 * Return a MoML String that will delete the given node from the Ontology model. This assumes that the context is the container of the concept.
 * @param node The node to be deleted.
 * @return A valid MoML string.
 */
public String getDeleteNodeMoML(Object node){
  NamedObj deleteObj=((Locatable)node).getContainer();
  NamedObj container=deleteObj.getContainer();
  return new String("String_Node_Str" + deleteObj.getName(container) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Return a MoML String that will delete the given node from the Ontology model. This assumes that the context is the container of the concept.
 * @param node The node to be deleted.
 * @return A valid MoML string.
 */
public String getDeleteNodeMoML(Object node){
  NamedObj deleteObj=((Locatable)node).getContainer();
  NamedObj container=deleteObj.getContainer();
  return "String_Node_Str" + deleteObj.getName(container) + "String_Node_Str";
}
Program: 73350
Project: 73350
Buggy source:
/** 
 * Return a MoML String that will delete the given node from the ontology solver model. This assumes that the context is the container of the ontology.
 * @param node The node to be deleted.
 * @return A valid MoML string.
 */
public String getDeleteNodeMoML(Object node){
  NamedObj deleteObj=((Locatable)node).getContainer();
  NamedObj container=deleteObj.getContainer();
  return new String("String_Node_Str" + deleteObj.getName(container) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Return a MoML String that will delete the given node from the ontology solver model. This assumes that the context is the container of the ontology.
 * @param node The node to be deleted.
 * @return A valid MoML string.
 */
public String getDeleteNodeMoML(Object node){
  NamedObj deleteObj=((Locatable)node).getContainer();
  NamedObj container=deleteObj.getContainer();
  return "String_Node_Str" + deleteObj.getName(container) + "String_Node_Str";
}
Program: 73352
Project: 73352
Buggy source:
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    ComponentEntity newObject=(ComponentEntity)super._propagateExistence(container);
    newObject.setContainer((CompositeEntity)container);
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}

Fixed version (ground truth):
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    ComponentEntity newObject=(ComponentEntity)super._propagateExistence(container);
    if (container instanceof CompositeEntity) {
      throw new InternalErrorException(container + "String_Node_Str");
    }
 else {
      newObject.setContainer((CompositeEntity)container);
    }
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}
Program: 73353
Project: 73353
Buggy source:
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    ComponentRelation newObject=(ComponentRelation)super._propagateExistence(container);
    newObject.setContainer((CompositeEntity)container);
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}

Fixed version (ground truth):
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    ComponentRelation newObject=(ComponentRelation)super._propagateExistence(container);
    if (container instanceof CompositeEntity) {
      throw new InternalErrorException(container + "String_Node_Str");
    }
 else {
      newObject.setContainer((CompositeEntity)container);
    }
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}
Program: 73355
Project: 73355
Buggy source:
/** 
 * Add an attribute.  This method should not be used directly. Instead, call setContainer() on the attribute. Derived classes may further constrain the class of the attribute. To do this, they should override this method to throw an exception when the argument is not an instance of the expected class. This method is write-synchronized on the workspace and increments its version number.
 * @param p The attribute to be added.
 * @exception NameDuplicationException If this object alreadyhas an attribute with the same name.
 * @exception IllegalActionException If the attribute is not anan instance of the expect class (in derived classes).
 */
protected void _addAttribute(Attribute p) throws NameDuplicationException, IllegalActionException {
  if (_decorator == null) {
    if (p.getName().equals("String_Node_Str")) {
      _decoratorPath=(StringAttribute)p;
      _decoratorPath.setVisibility(Settable.NONE);
    }
  }
  super._addAttribute(p);
}

Fixed version (ground truth):
/** 
 * Add an attribute.  This method should not be used directly. Instead, call setContainer() on the attribute. Derived classes may further constrain the class of the attribute. To do this, they should override this method to throw an exception when the argument is not an instance of the expected class. This method is write-synchronized on the workspace and increments its version number.
 * @param p The attribute to be added.
 * @exception NameDuplicationException If this object alreadyhas an attribute with the same name.
 * @exception IllegalActionException If the attribute is not anan instance of the expect class (in derived classes).
 */
protected void _addAttribute(Attribute p) throws NameDuplicationException, IllegalActionException {
  if (_decorator == null) {
    if (p.getName().equals("String_Node_Str") && p instanceof StringAttribute) {
      _decoratorPath=(StringAttribute)p;
      _decoratorPath.setVisibility(Settable.NONE);
    }
  }
  super._addAttribute(p);
}
Program: 73356
Project: 73356
Buggy source:
/** 
 * The remove() method is not supported because is is not supported in NamedObj.ContainedObjectsIterator.remove().
 */
public void remove(){
  super.remove();
}

Fixed version (ground truth):
/** 
 * The remove() method is not supported because is is not supported in NamedObj.ContainedObjectsIterator.remove().
 */
public void remove(){
  throw new UnsupportedOperationException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}
Program: 73358
Project: 73358
Buggy source:
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    Port newObject=(Port)super._propagateExistence(container);
    newObject.setContainer((Entity)container);
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}

Fixed version (ground truth):
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    Port newObject=(Port)super._propagateExistence(container);
    if (container instanceof CompositeEntity) {
      throw new InternalErrorException(container + "String_Node_Str");
    }
 else {
      newObject.setContainer((Entity)container);
    }
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}
Program: 73364
Project: 73364
Buggy source:
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    Port newObject=(Port)super._propagateExistence(container);
    if (!(container instanceof CompositeEntity)) {
      throw new InternalErrorException(container + "String_Node_Str");
    }
 else {
      newObject.setContainer((Entity)container);
    }
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}

Fixed version (ground truth):
/** 
 * Propagate existence of this object to the specified object. This overrides the base class to set the container.
 * @param container Object to contain the new object.
 * @exception IllegalActionException If the objectcannot be cloned.
 * @return A new object of the same class and nameas this one.
 */
protected NamedObj _propagateExistence(NamedObj container) throws IllegalActionException {
  try {
    Port newObject=(Port)super._propagateExistence(container);
    if (!(container instanceof Entity)) {
      throw new InternalErrorException(container + "String_Node_Str");
    }
 else {
      newObject.setContainer((Entity)container);
    }
    return newObject;
  }
 catch (  NameDuplicationException e) {
    throw new InternalErrorException(e);
  }
}
Program: 73365
Project: 73365
Buggy source:
/** 
 * Return a default Configuration, or null to do without one. This configuration will be created before any command-line arguments are processed.  If there are no command-line arguments, then the default configuration is given by _createEmptyConfiguration() instead.  This method merges the compile-time configuration file values from   {@link ptolemy.util.StringUtilities#mergePropertiesFile()}. Subclasses should call  {@link ptolemy.actor.gui.PtolemyPreferences#setDefaultPreferences(Configuration)}.
 * @return null
 * @exception Exception Thrown in derived classes if the defaultconfiguration cannot be opened.
 */
protected Configuration _createDefaultConfiguration() throws Exception {
  try {
    StringUtilities.mergePropertiesFile();
  }
 catch (  Exception ex) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return a default Configuration, or null to do without one. This configuration will be created before any command-line arguments are processed.  If there are no command-line arguments, then the default configuration is given by _createEmptyConfiguration() instead.  This method merges the compile-time configuration file values from   {@link ptolemy.util.StringUtilities#mergePropertiesFile()}. Subclasses should call  {@link ptolemy.actor.gui.PtolemyPreferences#setDefaultPreferences(Configuration)}.
 * @return null
 * @exception Exception Thrown in derived classes if the defaultconfiguration cannot be opened.
 */
protected Configuration _createDefaultConfiguration() throws Exception {
  try {
    StringUtilities.mergePropertiesFile();
  }
 catch (  Throwable throwable) {
  }
  return null;
}
Program: 73366
Project: 73366
Buggy source:
/** 
 * Throw an exception that includes the elements of the args parameter.
 * @param cause The throwable that caused the problem.
 * @param args An array of Strings.
 * @exception Exception Always thrown
 */
public static void throwArgsException(Throwable cause,String[] args) throws Exception {
  StringBuffer argsStringBuffer=new StringBuffer();
  try {
    for (int i=0; i < args.length; i++) {
      if (argsStringBuffer.length() > 0) {
        argsStringBuffer.append("String_Node_Str");
      }
      argsStringBuffer.append(args[i]);
    }
  }
 catch (  Exception ex2) {
  }
  throw new Exception("String_Node_Str" + argsStringBuffer.toString() + "String_Node_Str",cause);
}

Fixed version (ground truth):
/** 
 * Throw an exception that includes the elements of the args parameter.
 * @param cause The throwable that caused the problem.
 * @param args An array of Strings.
 * @exception Exception Always thrown
 */
public static void throwArgsException(Throwable cause,String[] args) throws Exception {
  StringBuffer argsStringBuffer=new StringBuffer();
  try {
    for (int i=0; i < args.length; i++) {
      if (argsStringBuffer.length() > 0) {
        argsStringBuffer.append("String_Node_Str");
      }
      argsStringBuffer.append(args[i]);
    }
  }
 catch (  Throwable throwable) {
  }
  throw new Exception("String_Node_Str" + argsStringBuffer.toString() + "String_Node_Str",cause);
}
Program: 73368
Project: 73368
Buggy source:
/** 
 * Return true if the specified file names a directory that contains a file named configuration.xml and a file named intro.htm
 * @param directory the directory in which the potentialdirectory was found.
 * @param name the name of the directory or file.
 * @return true if the file is a directory thatcontains a file called configuration.xml
 */
public boolean accept(File directory,String name){
  try {
    File configurationDirectory=new File(directory,name);
    if (!configurationDirectory.isDirectory()) {
      return false;
    }
    File configurationFile=new File(configurationDirectory,"String_Node_Str");
    File introFile=new File(configurationDirectory,"String_Node_Str");
    if (configurationFile.isFile() && introFile.isFile()) {
      return true;
    }
  }
 catch (  Exception ex) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return true if the specified file names a directory that contains a file named configuration.xml and a file named intro.htm
 * @param directory the directory in which the potentialdirectory was found.
 * @param name the name of the directory or file.
 * @return true if the file is a directory thatcontains a file called configuration.xml
 */
public boolean accept(File directory,String name){
  try {
    File configurationDirectory=new File(directory,name);
    if (!configurationDirectory.isDirectory()) {
      return false;
    }
    File configurationFile=new File(configurationDirectory,"String_Node_Str");
    File introFile=new File(configurationDirectory,"String_Node_Str");
    if (configurationFile.isFile() && introFile.isFile()) {
      return true;
    }
  }
 catch (  Throwable throwable) {
    return false;
  }
  return false;
}
Program: 73370
Project: 73370
Buggy source:
/** 
 * Show the SyntacticGraph in a Tableau. 
 */
protected void _showGraph(){
  try {
    Configuration config=(Configuration)Configuration.configurations().get(0);
    _syntaxTableau=config.openInstance(_syntaxGraph);
    _syntaxTableau.show();
  }
 catch (  Exception ex) {
  }
}

Fixed version (ground truth):
/** 
 * Show the SyntacticGraph in a Tableau.
 * @exception IllegalActionException Thrown if there is a problemgetting the configuration, opening the instance of the syntactic graph or showing the tableau.
 */
protected void _showGraph() throws IllegalActionException {
  try {
    Configuration config=(Configuration)Configuration.configurations().get(0);
    _syntaxTableau=config.openInstance(_syntaxGraph);
    _syntaxTableau.show();
  }
 catch (  Exception ex) {
    throw new IllegalActionException(getComponent(),ex,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 73371
Project: 73371
Buggy source:
/** 
 * Get the normal of the site.
 */
public double getNormal(){
switch (_side) {
case SwingConstants.NORTH:
    return -Math.PI / 2;
case SwingConstants.SOUTH:
  return Math.PI / 2;
case SwingConstants.EAST:
return 0.0;
case SwingConstants.WEST:
return Math.PI;
}
return 0.0;
}

Fixed version (ground truth):
/** 
 * Get the normal of the site.
 */
public double getNormal(){
switch (_side) {
case SwingConstants.NORTH:
    return -Math.PI / 2;
case SwingConstants.SOUTH:
  return Math.PI / 2;
case SwingConstants.WEST:
return Math.PI;
case SwingConstants.EAST:
default :
return 0.0;
}
}
Program: 73372
Project: 73372
Buggy source:
/** 
 * Get the angle of the normal to this site, in radians between zero and 2pi.
 */
public double getNormal(){
switch (_id) {
case SwingConstants.EAST:
    return 0.0;
case SwingConstants.NORTH_EAST:
  return piOver4 * 7;
case SwingConstants.NORTH:
return piOver4 * 6;
case SwingConstants.NORTH_WEST:
return piOver4 * 5;
case SwingConstants.WEST:
return piOver4 * 4;
case SwingConstants.SOUTH_WEST:
return piOver4 * 3;
case SwingConstants.SOUTH:
return piOver4 * 2;
case SwingConstants.SOUTH_EAST:
return piOver4 * 1;
}
return 0.0;
}

Fixed version (ground truth):
/** 
 * Get the angle of the normal to this site, in radians between zero and 2pi.
 */
public double getNormal(){
switch (_id) {
case SwingConstants.NORTH_EAST:
    return piOver4 * 7;
case SwingConstants.NORTH:
  return piOver4 * 6;
case SwingConstants.NORTH_WEST:
return piOver4 * 5;
case SwingConstants.WEST:
return piOver4 * 4;
case SwingConstants.SOUTH_WEST:
return piOver4 * 3;
case SwingConstants.SOUTH:
return piOver4 * 2;
case SwingConstants.SOUTH_EAST:
return piOver4 * 1;
case SwingConstants.EAST:
default :
return 0.0;
}
}
Program: 73373
Project: 73373
Buggy source:
/** 
 * Output an Ipl image.
 * @exception IllegalActionException If thrown while writing to the port.   
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    ObjectToken inputToken=(ObjectToken)input.get(0);
    Image inputObject=(Image)inputToken.getValue();
    if (!(inputObject instanceof Image)) {
      throw new IllegalActionException(this,"String_Node_Str" + inputObject.getClass());
    }
    _frame=new IplImage();
    output.send(0,new ObjectToken(_frame));
  }
}

Fixed version (ground truth):
/** 
 * Output an Ipl image.
 * @exception IllegalActionException If thrown while writing to the port.   
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    ObjectToken inputToken=(ObjectToken)input.get(0);
    Image inputObject=(Image)inputToken.getValue();
    _frame=new IplImage();
    output.send(0,new ObjectToken(_frame));
  }
}
Program: 73374
Project: 73374
Buggy source:
/** 
 * Output a frame.
 * @exception IllegalActionException If thrown while writing to the port.   
 */
public void fire() throws IllegalActionException {
  _frame=cvQueryFrame(_capture);
  if (Platform.isWindows() && highgui.libname.indexOf("String_Node_Str") > 0) {
    _frame.origin=IPL_ORIGIN_TL;
    cvFlip(_frame,_frame,0);
  }
  output.send(0,new ObjectToken(_frame));
}

Fixed version (ground truth):
/** 
 * Output a frame.
 * @exception IllegalActionException If thrown while writing to the port.   
 */
public void fire() throws IllegalActionException {
  _frame=cvQueryFrame(_capture);
  if (Platform.isWindows() && highgui.libname.indexOf("String_Node_Str") >= 0) {
    _frame.origin=IPL_ORIGIN_TL;
    cvFlip(_frame,_frame,0);
  }
  output.send(0,new ObjectToken(_frame));
}
Program: 73376
Project: 73376
Buggy source:
private boolean evaluateStatement(AST ast) throws IllegalActionException, NameDuplicationException {
switch (ast.getType()) {
case PtalonTokenTypes.DANGLING_PORTS_OKAY:
    break;
case PtalonTokenTypes.ATTACH_DANGLING_PORTS:
  break;
case PtalonTokenTypes.PORT:
return addPort(ast);
case PtalonTokenTypes.MULTIPORT:
return addMultiPort(ast);
case PtalonTokenTypes.INPORT:
return addInPort(ast);
case PtalonTokenTypes.MULTIINPORT:
return addMultiInPort(ast);
case PtalonTokenTypes.OUTPORT:
return addOutPort(ast);
case PtalonTokenTypes.MULTIOUTPORT:
return addMultiOutPort(ast);
case PtalonTokenTypes.PARAMETER:
return addParameter(ast);
case PtalonTokenTypes.PARAM_EQUALS:
break;
case PtalonTokenTypes.ACTOR:
break;
case PtalonTokenTypes.ACTOR_EQUALS:
return addActorDefinition(ast);
case PtalonTokenTypes.RELATION:
return addRelation(ast);
case PtalonTokenTypes.TRANSPARENT:
return addTransparentRelation(ast);
case PtalonTokenTypes.ACTOR_DECLARATION:
return addActorDeclaration(ast);
case PtalonTokenTypes.IF:
break;
case PtalonTokenTypes.FOR:
return addForLoop(ast);
}
return false;
}

Fixed version (ground truth):
private boolean evaluateStatement(AST ast) throws IllegalActionException, NameDuplicationException {
switch (ast.getType()) {
case PtalonTokenTypes.DANGLING_PORTS_OKAY:
case PtalonTokenTypes.ATTACH_DANGLING_PORTS:
case PtalonTokenTypes.PARAM_EQUALS:
case PtalonTokenTypes.ACTOR:
case PtalonTokenTypes.IF:
    break;
case PtalonTokenTypes.PORT:
  return addPort(ast);
case PtalonTokenTypes.MULTIPORT:
return addMultiPort(ast);
case PtalonTokenTypes.INPORT:
return addInPort(ast);
case PtalonTokenTypes.MULTIINPORT:
return addMultiInPort(ast);
case PtalonTokenTypes.OUTPORT:
return addOutPort(ast);
case PtalonTokenTypes.MULTIOUTPORT:
return addMultiOutPort(ast);
case PtalonTokenTypes.PARAMETER:
return addParameter(ast);
case PtalonTokenTypes.ACTOR_EQUALS:
return addActorDefinition(ast);
case PtalonTokenTypes.RELATION:
return addRelation(ast);
case PtalonTokenTypes.TRANSPARENT:
return addTransparentRelation(ast);
case PtalonTokenTypes.ACTOR_DECLARATION:
return addActorDeclaration(ast);
case PtalonTokenTypes.FOR:
return addForLoop(ast);
}
return false;
}
Program: 73378
Project: 73378
Buggy source:
/** 
 * Traverse all the entities in the model and place them in the sensors and actuators variables.
 */
protected void _modelStaticAnalysis(){
  int actuatorIndex=0;
  int sensorIndex=0;
  for (  Actor actor : (List<Actor>)((CompositeActor)_director.getContainer()).deepEntityList()) {
    if (actor instanceof ActuatorSetup) {
      actuators.put(actor,new Integer(actuatorIndex));
      actuatorIndex++;
    }
    if (actor instanceof SensorHandler) {
      sensors.put(actor,new Integer(sensorIndex));
      sensorIndex++;
    }
  }
}

Fixed version (ground truth):
/** 
 * Traverse all the entities in the model and place them in the sensors and actuators variables.
 */
protected void _modelStaticAnalysis(){
  int actuatorIndex=0;
  int sensorIndex=0;
  for (  Actor actor : (List<Actor>)((CompositeActor)_director.getContainer()).deepEntityList()) {
    if (actor instanceof ActuatorSetup) {
      actuators.put(actor,Integer.valueOf(actuatorIndex));
      actuatorIndex++;
    }
    if (actor instanceof SensorHandler) {
      sensors.put(actor,Integer.valueOf(sensorIndex));
      sensorIndex++;
    }
  }
}
Program: 73380
Project: 73380
Buggy source:
/** 
 * Generate The fire function code. This method is called when the firing code of each actor is not inlined. Each actor's firing code is in a function with the same name as that of the actor.
 * @return The fire function code.
 * @exception IllegalActionException If thrown while generating fire code.
 */
public String generateFireFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  Actor actor;
  ptolemy.actor.CompositeActor container=(ptolemy.actor.CompositeActor)getComponent().getContainer();
  getCodeGenerator().getAdapter(container);
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    actor=(Actor)actors.next();
    getAdapter(actor);
    if (actor.getDisplayName().contains("String_Node_Str")) {
    }
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate The fire function code. This method is called when the firing code of each actor is not inlined. Each actor's firing code is in a function with the same name as that of the actor.
 * @return The fire function code.
 * @exception IllegalActionException If thrown while generating fire code.
 */
public String generateFireFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  Actor actor;
  ptolemy.actor.CompositeActor container=(ptolemy.actor.CompositeActor)getComponent().getContainer();
  getCodeGenerator().getAdapter(container);
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    actor=(Actor)actors.next();
    getAdapter(actor);
  }
  return code.toString();
}
Program: 73382
Project: 73382
Buggy source:
/** 
 * Return an unique label for the given port channel referenced by the given helper. By default, this delegates to the helper to generate the reference. Subclass may override this method to generate the desire label according to the given parameters.
 * @param port The given port.
 * @param channelAndOffset The given channel and offset.
 * @param forComposite Whether the given helper is associated witha CompositeActor
 * @param isWrite The type of the reference. True if this isa write reference; otherwise, this is a read reference.
 * @param helper The specified helper.
 * @return an unique reference label for the given port channel.
 * @exception IllegalActionException If the helper throws it whilegenerating the label.
 */
public String getReference(TypedIOPort port,String[] channelAndOffset,boolean forComposite,boolean isWrite,CodeGeneratorHelper helper) throws IllegalActionException {
  if (port.isOutput()) {
    if (channelAndOffset[0] == "String_Node_Str") {
      channelAndOffset[0]="String_Node_Str";
    }
    return CodeGeneratorHelper.generateName(port);
  }
 else {
    return super.getReference(port,channelAndOffset,forComposite,isWrite,helper);
  }
}

Fixed version (ground truth):
/** 
 * Return an unique label for the given port channel referenced by the given helper. By default, this delegates to the helper to generate the reference. Subclass may override this method to generate the desire label according to the given parameters.
 * @param port The given port.
 * @param channelAndOffset The given channel and offset.
 * @param forComposite Whether the given helper is associated witha CompositeActor
 * @param isWrite The type of the reference. True if this isa write reference; otherwise, this is a read reference.
 * @param helper The specified helper.
 * @return an unique reference label for the given port channel.
 * @exception IllegalActionException If the helper throws it whilegenerating the label.
 */
public String getReference(TypedIOPort port,String[] channelAndOffset,boolean forComposite,boolean isWrite,CodeGeneratorHelper helper) throws IllegalActionException {
  if (port.isOutput()) {
    if (channelAndOffset[0].equals("String_Node_Str")) {
      channelAndOffset[0]="String_Node_Str";
    }
    return CodeGeneratorHelper.generateName(port);
  }
 else {
    return super.getReference(port,channelAndOffset,forComposite,isWrite,helper);
  }
}
Program: 73383
Project: 73383
Buggy source:
/** 
 * Return a reference to the driver. This method is similar to the getReference() method however it it tailored  for use by a driver method.
 * @param port The port whose information is desired.
 * @param channelAndOffset The given channel and offset.
 * @param forComposite Whether the given helper is associated witha CompositeActor
 * @param isWrite The type of the reference. True if this isa write reference; otherwise, this is a read reference.
 * @param helper The specified helper.
 * @return an unique reference label for the given port channel.
 * @exception IllegalActionException If the helper throws it whilegenerating the label.
 */
public String getDriverReference(TypedIOPort port,String[] channelAndOffset,boolean forComposite,boolean isWrite,CodeGeneratorHelper helper) throws IllegalActionException {
  if (port.isOutput()) {
    if (channelAndOffset[0] == "String_Node_Str") {
      channelAndOffset[0]="String_Node_Str";
    }
    return CodeGeneratorHelper.generateName(port) + "String_Node_Str";
  }
 else {
    return super.getReference(port,channelAndOffset,forComposite,isWrite,helper);
  }
}

Fixed version (ground truth):
/** 
 * Return a reference to the driver. This method is similar to the getReference() method however it it tailored  for use by a driver method.
 * @param port The port whose information is desired.
 * @param channelAndOffset The given channel and offset.
 * @param forComposite Whether the given helper is associated witha CompositeActor
 * @param isWrite The type of the reference. True if this isa write reference; otherwise, this is a read reference.
 * @param helper The specified helper.
 * @return an unique reference label for the given port channel.
 * @exception IllegalActionException If the helper throws it whilegenerating the label.
 */
public String getDriverReference(TypedIOPort port,String[] channelAndOffset,boolean forComposite,boolean isWrite,CodeGeneratorHelper helper) throws IllegalActionException {
  if (port.isOutput()) {
    if (channelAndOffset[0].equals("String_Node_Str")) {
      channelAndOffset[0]="String_Node_Str";
    }
    return CodeGeneratorHelper.generateName(port) + "String_Node_Str";
  }
 else {
    return super.getReference(port,channelAndOffset,forComposite,isWrite,helper);
  }
}
Program: 73385
Project: 73385
Buggy source:
public static void main(String[] args){
  int fps=DEFAULT_FPS;
  long period=(long)1000.0 / fps;
  System.out.println("String_Node_Str" + fps + "String_Node_Str"+ period+ "String_Node_Str");
  new TourModelsGL(period * 1000000L);
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    Runnable doActions=new Runnable(){
      public void run(){
        try {
          int fps=DEFAULT_FPS;
          long period=(long)1000.0 / fps;
          System.out.println("String_Node_Str" + fps + "String_Node_Str"+ period+ "String_Node_Str");
          new TourModelsGL(period * 1000000L);
        }
 catch (        Exception ex) {
          System.err.println(ex.toString());
          ex.printStackTrace();
        }
      }
    }
;
    SwingUtilities.invokeAndWait(doActions);
  }
 catch (  Exception ex) {
    System.err.println(ex.toString());
    ex.printStackTrace();
  }
}
Program: 73386
Project: 73386
Buggy source:
/** 
 * Main method that can be used for testing.
 * @param args An array of length 1 that names the portto be used
 * @exception Exception If anything goes wrong.
 */
public static void main(String[] args) throws Exception {
  int timOut=10000;
  Server[] ser=new Server[2];
  ser[0]=new Server(Integer.valueOf(args[0]),timOut);
  ser[1]=new Server(Integer.valueOf(args[0]) + 1,timOut);
  double[] dbl=new double[1];
  for (int i=0; i < dbl.length; i++) {
    dbl[i]=i;
  }
  int iLoo=0;
  while (true) {
    for (int iSer=0; iSer < 2; iSer++) {
      Thread.sleep(10);
      ser[iSer].read();
      ser[iSer].write(0,new Double(iLoo).doubleValue(),dbl);
      System.out.println("String_Node_Str" + iLoo);
    }
    iLoo++;
  }
}

Fixed version (ground truth):
/** 
 * Main method that can be used for testing.
 * @param args An array of length 1 that names the portto be used
 * @exception Exception If anything goes wrong.
 */
public static void main(String[] args) throws Exception {
  int timOut=10000;
  Server[] ser=new Server[2];
  ser[0]=new Server(Integer.valueOf(args[0]),timOut);
  ser[1]=new Server(Integer.valueOf(args[0]) + 1,timOut);
  double[] dbl=new double[1];
  for (int i=0; i < dbl.length; i++) {
    dbl[i]=i;
  }
  int iLoo=0;
  while (true) {
    for (int iSer=0; iSer < 2; iSer++) {
      Thread.sleep(10);
      ser[iSer].read();
      ser[iSer].write(0,Double.valueOf(iLoo).doubleValue(),dbl);
      System.out.println("String_Node_Str" + iLoo);
    }
    iLoo++;
  }
}
Program: 73387
Project: 73387
Buggy source:
/** 
 * Create an XML string representation of XMLDBAttribute object.
 * @return The XML string representation of XMLDBAttribute object.
 */
public String getAttributeXMLStringFormat(){
  String attributeNode="String_Node_Str" + _attributeId + "String_Node_Str"+ "String_Node_Str"+ _attributeName+ "String_Node_Str"+ _attributeType+ "String_Node_Str";
  StringBuffer attributeBuffer=new StringBuffer(attributeNode);
  if (_attributeType.equalsIgnoreCase(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
    if (_attributeValues != null && _attributeValues.size() > 0) {
      for (int i=0; i < _attributeValues.size(); i++) {
        attributeBuffer.append("String_Node_Str" + _attributeValues.get(i).toString() + "String_Node_Str");
      }
    }
  }
  attributeBuffer.append("String_Node_Str");
  attributeNode=attributeBuffer.toString();
  return attributeNode;
}

Fixed version (ground truth):
/** 
 * Create an XML string representation of XMLDBAttribute object.
 * @return The XML string representation of XMLDBAttribute object.
 */
public String getAttributeXMLStringFormat(){
  String attributeNode="String_Node_Str" + _attributeId + "String_Node_Str"+ "String_Node_Str"+ _attributeName+ "String_Node_Str"+ _attributeType+ "String_Node_Str";
  StringBuffer attributeBuffer=new StringBuffer(attributeNode);
  if (_attributeType.equalsIgnoreCase(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
    if (_attributeValues != null && _attributeValues.size() > 0) {
      for (int i=0; i < _attributeValues.size(); i++) {
        attributeBuffer.append("String_Node_Str" + _attributeValues.get(i) + "String_Node_Str");
      }
    }
  }
  attributeBuffer.append("String_Node_Str");
  attributeNode=attributeBuffer.toString();
  return attributeNode;
}
Program: 73390
Project: 73390
Buggy source:
/** 
 * Remove the DTD from the model content.
 * @param modelConetnet The model content.
 * @return The model content after the DTD part is removed.
 */
private String removeDTD(String modelConetnet){
  String newModelContent="String_Node_Str";
  newModelContent=modelConetnet;
  if (newModelContent.indexOf("String_Node_Str") == 0) {
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str") + 1);
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent.trim();
  }
  if (newModelContent.indexOf("String_Node_Str") == 0) {
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str") + 1);
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent.trim();
  }
  return newModelContent;
}

Fixed version (ground truth):
/** 
 * Remove the DTD from the model content.
 * @param modelConetnet The model content.
 * @return The model content after the DTD part is removed.
 */
private String removeDTD(String modelConetnet){
  String newModelContent="String_Node_Str";
  newModelContent=modelConetnet;
  if (newModelContent.indexOf("String_Node_Str") == 0) {
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str") + 1);
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.trim();
  }
  if (newModelContent.indexOf("String_Node_Str") == 0) {
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str") + 1);
    newModelContent=newModelContent.substring(newModelContent.indexOf("String_Node_Str"));
    newModelContent=newModelContent.trim();
  }
  return newModelContent;
}