nus-yam/ex-repair huggingface dataset:
Program: 75648
Project: 75648
Buggy source:
/** 
 * Set the name of the ComponentEntity. If there is already a ComponentEntity of the container with the same name, throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there already is an entityin the container with the same name.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  CompositeEntity container=(CompositeEntity)getContainer();
  if ((container != null)) {
    ComponentEntity another=(ComponentEntity)container.getEntity(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name + "String_Node_Str");
    }
  }
  super.setName(name);
}

Fixed version (ground truth):
/** 
 * Set the name of the ComponentEntity. If there is already a ComponentEntity of the container with the same name, throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there already is an entityin the container with the same name.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  CompositeEntity container=(CompositeEntity)getContainer();
  if ((container != null)) {
    ComponentEntity another=(ComponentEntity)container.getEntity(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name);
    }
  }
  super.setName(name);
}
Program: 75649
Project: 75649
Buggy source:
/** 
 * Set the name of the ComponentRelation. If there is already a ComponentRelation of the container with the same name, throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there is already a relationwith the same name in the container.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  CompositeEntity container=(CompositeEntity)getContainer();
  if ((container != null)) {
    ComponentRelation another=container.getRelation(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name + "String_Node_Str");
    }
  }
  super.setName(name);
}

Fixed version (ground truth):
/** 
 * Set the name of the ComponentRelation. If there is already a ComponentRelation of the container with the same name, throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there is already a relationwith the same name in the container.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  CompositeEntity container=(CompositeEntity)getContainer();
  if ((container != null)) {
    ComponentRelation another=container.getRelation(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name);
    }
  }
  super.setName(name);
}
Program: 75650
Project: 75650
Buggy source:
/** 
 * Set the name of the port. If there is already an port of the container entity with the same name, then throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there is already a portwith the same name in the container.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  Entity container=(Entity)getContainer();
  if ((container != null)) {
    Port another=container.getPort(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name + "String_Node_Str");
    }
  }
  super.setName(name);
}

Fixed version (ground truth):
/** 
 * Set the name of the port. If there is already an port of the container entity with the same name, then throw an exception.
 * @exception IllegalActionException If the name has a period.
 * @exception NameDuplicationException If there is already a portwith the same name in the container.
 */
public void setName(String name) throws IllegalActionException, NameDuplicationException {
  if (name == null) {
    name=new String("String_Node_Str");
  }
  Entity container=(Entity)getContainer();
  if ((container != null)) {
    Port another=container.getPort(name);
    if ((another != null) && (another != this)) {
      throw new NameDuplicationException(container,"String_Node_Str" + name);
    }
  }
  super.setName(name);
}
Program: 75651
Project: 75651
Buggy source:
/** 
 * Return true if the current integration step is accurate. This is determined by asking all the step size control actors in the state transition schedule and output schedule.
 * @return True if the current step is accurate.
 */
public boolean isThisStepAccurate(){
  try {
    _debug(getName() + "String_Node_Str");
    if (!_isStateAccurate()) {
      _stateAcceptable=false;
      return false;
    }
 else     if (!_isOutputAccurate()) {
      _outputAcceptable=false;
      return false;
    }
 else {
      _stateAcceptable=true;
      _outputAcceptable=true;
      return true;
    }
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Return true if the current integration step is accurate. This is determined by asking all the step size control actors in the state transition schedule and output schedule.
 * @return True if the current step is accurate.
 */
public boolean isThisStepAccurate(){
  try {
    _debug(getName() + "String_Node_Str");
    if (!_isStateAccurate()) {
      _stateAcceptable=false;
      return false;
    }
 else     if (!_isOutputAccurate()) {
      _stateAcceptable=true;
      _outputAcceptable=false;
      return false;
    }
 else {
      _stateAcceptable=true;
      _outputAcceptable=true;
      return true;
    }
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
}
Program: 75652
Project: 75652
Buggy source:
/** 
 * Contruct a debug profile for an actor with the associated GraphController.
 */
public DebugProfile(BasicGraphController graphController){
  _graphController=graphController;
  _firingEventTypes=new HashSet();
}

Fixed version (ground truth):
/** 
 * Construct a debug profile for an actor with the associated GraphController.
 * @param graphController The GraphController.
 */
public DebugProfile(BasicGraphController graphController){
  _graphController=graphController;
  _firingEventTypes=new HashSet();
}
Program: 75653
Project: 75653
Buggy source:
/** 
 * Return a list of output ports connected to this port on the outside. NOTE: This method is not as useful as it might seem. In particular, it includes in the returned list output ports that are higher in the hierarchy to which this port is connected on the <i>inside</i>.  This can be confusing because such ports cannot send data to this port.  To get a list of the ports that can send data to this port, use the following sourcePortList() method.
 * @see ptolemy.kernel.ComponentPort#deepConnectedPorts
 * @return An enumeration of IOPort objects.
 */
public List deepConnectedOutPortList(){
  try {
    _workspace.getReadAccess();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    int myDepth=depthInHierarchy();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      if (port.isOutput()) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return a list of output ports connected to this port on the outside. NOTE: This method is not as useful as it might seem. In particular, it includes in the returned list output ports that are higher in the hierarchy to which this port is connected on the <i>inside</i>.  This can be confusing because such ports cannot send data to this port.  To get a list of the ports that can send data to this port, use the following sourcePortList() method.
 * @see ptolemy.kernel.ComponentPort#deepConnectedPorts
 * @return An enumeration of IOPort objects.
 */
public List deepConnectedOutPortList(){
  try {
    _workspace.getReadAccess();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      if (port.isOutput()) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}
Program: 75654
Project: 75654
Buggy source:
/** 
 * Return a list of ports connected to this port on the outside that can send data to this port.  This includes output ports that are connected on the outside to this port, and input ports that are connected on the inside to this port.
 * @return A list of IOPort objects.
 */
public List sourcePortList(){
  try {
    _workspace.getReadAccess();
    Nameable container=getContainer();
    Director excDirector=((Actor)container).getExecutiveDirector();
    int depthOfDirector=excDirector.depthInHierarchy();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      int depth=port.depthInHierarchy();
      if (port.isInput() && depth <= depthOfDirector) {
        result.addLast(port);
      }
 else       if (port.isOutput() && depth > depthOfDirector) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return a list of ports connected to this port on the outside that can send data to this port.  This includes output ports that are connected on the outside to this port, and input ports that are connected on the inside to this port.
 * @return A list of IOPort objects.
 */
public List sourcePortList(){
  try {
    _workspace.getReadAccess();
    Nameable container=getContainer();
    Director excDirector=((Actor)container).getExecutiveDirector();
    int depthOfDirector=excDirector.depthInHierarchy();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      int depth=((NamedObj)port.getContainer()).depthInHierarchy();
      if (port.isInput() && depth <= depthOfDirector) {
        result.addLast(port);
      }
 else       if (port.isOutput() && depth > depthOfDirector) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}
Program: 75655
Project: 75655
Buggy source:
/** 
 * Return a list of input ports connected to this port on the outside. NOTE: This method is not as useful as it might seem. In particular, it includes in the returned list input ports that are higher in the hierarchy to which this port is connected on the <i>inside</i>.  This can be confusing because such ports cannot receive data produced by this port.  To get a list of the ports that can receive data from this port, use the following sinkPortList() method:
 * @see ptolemy.kernel.ComponentPort#deepConnectedPortList
 * @return A list of IOPort objects.
 */
public List deepConnectedInPortList(){
  try {
    _workspace.getReadAccess();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    int myDepth=depthInHierarchy();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      if (port.isInput()) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return a list of input ports connected to this port on the outside. NOTE: This method is not as useful as it might seem. In particular, it includes in the returned list input ports that are higher in the hierarchy to which this port is connected on the <i>inside</i>.  This can be confusing because such ports cannot receive data produced by this port.  To get a list of the ports that can receive data from this port, use the following sinkPortList() method:
 * @see ptolemy.kernel.ComponentPort#deepConnectedPortList
 * @return A list of IOPort objects.
 */
public List deepConnectedInPortList(){
  try {
    _workspace.getReadAccess();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      if (port.isInput()) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}
Program: 75656
Project: 75656
Buggy source:
/** 
 * Return a list of the ports connected to this port on the outside that can accept data from this port.  This include input ports that are connected on the outside to this port, and output ports that are connected on the inside to this one.
 * @return A list of IOPort objects.
 */
public List sinkPortList(){
  try {
    _workspace.getReadAccess();
    Nameable container=getContainer();
    Director excDirector=((Actor)container).getExecutiveDirector();
    int depthOfDirector=excDirector.depthInHierarchy();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      int depth=port.depthInHierarchy();
      if (port.isInput() && depth >= depthOfDirector) {
        result.addLast(port);
      }
 else       if (port.isOutput() && depth < depthOfDirector) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return a list of the ports connected to this port on the outside that can accept data from this port.  This include input ports that are connected on the outside to this port, and output ports that are connected on the inside to this one. If the port is an input port of an atomic actor, then return an empty list.
 * @return A list of IOPort objects.
 */
public List sinkPortList(){
  try {
    _workspace.getReadAccess();
    Nameable container=getContainer();
    Director excDirector=((Actor)container).getExecutiveDirector();
    int depthOfDirector=excDirector.depthInHierarchy();
    LinkedList result=new LinkedList();
    Iterator ports=deepConnectedPortList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      int depth=((NamedObj)port.getContainer()).depthInHierarchy();
      if (port.isInput() && depth >= depthOfDirector) {
        result.addLast(port);
      }
 else       if (port.isOutput() && depth < depthOfDirector) {
        result.addLast(port);
      }
    }
    return result;
  }
  finally {
    _workspace.doneReading();
  }
}
Program: 75657
Project: 75657
Buggy source:
/** 
 * If the argument is the <i>initialState</i> parameters, check that it is a row vector; Other sanity checks, like whether a differential equation matches a state variable name, are done in preinitialize() and run time.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the numerator and thedenominator matrix is not a row vector.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == initialStates) {
    DoubleMatrixToken token=(DoubleMatrixToken)initialStates.getToken();
    if (token.getRowCount() != 1 || token.getColumnCount() < 1) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (getManager() != null && getManager().getState() == Manager.IDLE) {
      _requestInitialization();
    }
  }
 else   if (attribute instanceof Parameter) {
    super.attributeChanged(attribute);
    _requestInitialization();
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the argument is the <i>initialState</i> parameters, check that it is a row vector; Other sanity checks, like whether a differential equation matches a state variable name, are done in preinitialize() and run time.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the numerator and thedenominator matrix is not a row vector.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == initialStates) {
    DoubleMatrixToken token=(DoubleMatrixToken)initialStates.getToken();
    if (token == null) {
      return;
    }
    if (token.getRowCount() != 1 || token.getColumnCount() < 1) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (getManager() != null && getManager().getState() == Manager.IDLE) {
      _requestInitialization();
    }
  }
 else   if (attribute instanceof Parameter) {
    super.attributeChanged(attribute);
    _requestInitialization();
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75659
Project: 75659
Buggy source:
/** 
 * Specify the container NamedObj, adding this attribute to the list of attributes in the container.  Notify parameters that depends on any parameter of this attribute about the change in scope.  If the container already contains an attribute with the same name, then throw an exception and do not make any changes.  Similarly, if the container is not in the same workspace as this attribute, throw an exception. If this attribute is already contained by the NamedObj, do nothing. This method is write-synchronized on the workspace and increments its version number.
 * @param container The container to attach this attribute to..
 * @exception IllegalActionException If this attribute is not of theexpected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment.
 * @exception NameDuplicationException If the container already hasan attribute with the name of this attribute.
 */
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException {
  Nameable oldContainer=getContainer();
  super.setContainer(container);
  if (oldContainer != container) {
    Iterator vars=attributeList(Variable.class).iterator();
    while (vars.hasNext()) {
      Variable var=(Variable)vars.next();
      var._notifyScopeChange();
    }
  }
}

Fixed version (ground truth):
/** 
 * Specify the container NamedObj, adding this attribute to the list of attributes in the container.  Notify parameters that depends on any parameter of this attribute about the change in scope.  If the container already contains an attribute with the same name, then throw an exception and do not make any changes.  Similarly, if the container is not in the same workspace as this attribute, throw an exception. If this attribute is already contained by the NamedObj, do nothing. This method is write-synchronized on the workspace and increments its version number.
 * @param container The container to attach this attribute to..
 * @exception IllegalActionException If this attribute is not of theexpected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment.
 * @exception NameDuplicationException If the container already hasan attribute with the name of this attribute.
 */
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException {
  Nameable oldContainer=getContainer();
  super.setContainer(container);
  if (oldContainer != container) {
    if (container != null) {
      _invalidateShadowedSettables((NamedObj)container.getContainer());
    }
    Iterator vars=attributeList(Variable.class).iterator();
    while (vars.hasNext()) {
      Variable var=(Variable)vars.next();
      var.validate();
    }
  }
}
Program: 75660
Project: 75660
Buggy source:
/** 
 * Create an entity controller associated with the specified graph controller.
 * @param controller The associated graph controller.
 * @param access The access level.
 */
public ActorController(GraphController controller,Access access){
  super(controller,access);
  if (access == FULL) {
    _portDialogFactory=new PortDialogFactory();
    _menuFactory.addMenuItemFactory(_portDialogFactory);
  }
  _menuFactory.addMenuItemFactory(new MenuActionFactory(new LookInsideAction()));
  _menuFactory.addMenuItemFactory(new MenuActionFactory(new ListenToActorAction()));
  if (access == FULL) {
    _breakpointDialogFactory=new BreakpointDialogFactory((BasicGraphController)getController());
    _menuFactory.addMenuItemFactory(_breakpointDialogFactory);
  }
  Filter portFilter=new Filter(){
    public boolean accept(    Object candidate){
      GraphModel model=getController().getGraphModel();
      if (candidate instanceof Port && model.getParent(candidate) instanceof Location) {
        return true;
      }
 else {
        return false;
      }
    }
  }
;
  GlobalLayout layout=new EntityLayout();
  controller.addGraphViewListener(new IncrementalLayoutListener(new IncrLayoutAdapter(layout),portFilter));
}

Fixed version (ground truth):
/** 
 * Create an entity controller associated with the specified graph controller.
 * @param controller The associated graph controller.
 * @param access The access level.
 */
public ActorController(GraphController controller,Access access){
  super(controller,access);
  if (access == FULL) {
    _portDialogFactory=new PortDialogFactory();
    _menuFactory.addMenuItemFactory(_portDialogFactory);
  }
  if (_configuration != null) {
    _menuFactory.addMenuItemFactory(new MenuActionFactory(new LookInsideAction()));
    _addedLookInsideAction=true;
  }
 else {
    _addedLookInsideAction=false;
  }
  _menuFactory.addMenuItemFactory(new MenuActionFactory(new ListenToActorAction()));
  if (access == FULL) {
    _breakpointDialogFactory=new BreakpointDialogFactory((BasicGraphController)getController());
    _menuFactory.addMenuItemFactory(_breakpointDialogFactory);
  }
  Filter portFilter=new Filter(){
    public boolean accept(    Object candidate){
      GraphModel model=getController().getGraphModel();
      if (candidate instanceof Port && model.getParent(candidate) instanceof Location) {
        return true;
      }
 else {
        return false;
      }
    }
  }
;
  GlobalLayout layout=new EntityLayout();
  controller.addGraphViewListener(new IncrementalLayoutListener(new IncrLayoutAdapter(layout),portFilter));
}
Program: 75661
Project: 75661
Buggy source:
/** 
 * Set the configuration.  This is used to open documentation files.
 * @param configuration The configuration.
 */
public void setConfiguration(Configuration configuration){
  super.setConfiguration(configuration);
  if (_portDialogFactory != null) {
    _portDialogFactory.setConfiguration(configuration);
  }
}

Fixed version (ground truth):
/** 
 * Set the configuration.  This is used to open documentation files.
 * @param configuration The configuration.
 */
public void setConfiguration(Configuration configuration){
  super.setConfiguration(configuration);
  if (_portDialogFactory != null) {
    _portDialogFactory.setConfiguration(configuration);
  }
  if (_configuration != null && !_addedLookInsideAction) {
    _menuFactory.addMenuItemFactory(new MenuActionFactory(new LookInsideAction()));
    _addedLookInsideAction=true;
  }
}
Program: 75662
Project: 75662
Buggy source:
/** 
 * Report an error, with an associated object and a descriptive message, for an unexpected code generation situation. The resulting message is pushed onto the top of the code stack.
 * @param object The associated object.
 * @param message The descriptive message.
 */
protected void _unexpectedCase(Object object,String message){
  _push("String_Node_Str" + object.getClass().getName() + "String_Node_Str");
  System.err.println("String_Node_Str" + "String_Node_Str" + message + "String_Node_Str"+ object.getClass().getName());
}

Fixed version (ground truth):
/** 
 * Report an error, with an associated object and a descriptive message, for an unexpected code generation situation. The resulting message is pushed onto the top of the code stack.
 * @param object The associated object.
 * @param message The descriptive message.
 */
protected void _unexpectedCase(Object object,String message){
  _push("String_Node_Str" + object.getClass().getName() + "String_Node_Str");
}
Program: 75663
Project: 75663
Buggy source:
public void defaultCase(Object obj){
  if (obj instanceof Stmt) {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
 else   if (obj instanceof Expr) {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
 else {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
  System.out.println("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void defaultCase(Object obj){
  if (obj instanceof Stmt) {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
 else   if (obj instanceof Expr) {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
 else {
    _push("String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
  }
}
Program: 75667
Project: 75667
Buggy source:
/** 
 * Generate code for an interface header file that implements declarations associated with a class.
 * @param source The class.
 * @return Interface header code for the class.
 */
public String generate(SootClass source){
  StringBuffer bodyCode=new StringBuffer();
  StringBuffer headerCode=new StringBuffer();
  StringBuffer footerCode=new StringBuffer();
  Iterator membersIter;
  String className=source.getName();
  String typeName=CNames.instanceNameOf(source);
  String objectName=CNames.classNameOf(source);
  headerCode.append("String_Node_Str" + typeName + "String_Node_Str");
  headerCode.append("String_Node_Str" + typeName + "String_Node_Str");
  footerCode.append("String_Node_Str");
  bodyCode.append("String_Node_Str" + typeName + "String_Node_Str");
  bodyCode.append("String_Node_Str" + typeName + "String_Node_Str"+ typeName+ "String_Node_Str");
  bodyCode.append("String_Node_Str" + className + "String_Node_Str");
  bodyCode.append("String_Node_Str" + objectName + "String_Node_Str");
  bodyCode.append("String_Node_Str" + className + "String_Node_Str");
  bodyCode.append("String_Node_Str" + objectName + "String_Node_Str"+ objectName+ "String_Node_Str");
  return (headerCode.append(bodyCode.append(footerCode))).toString();
}

Fixed version (ground truth):
/** 
 * Generate code for an interface header file that implements declarations associated with a class.
 * @param source The class.
 * @return Interface header code for the class.
 */
public String generate(SootClass source){
  StringBuffer bodyCode=new StringBuffer();
  StringBuffer headerCode=new StringBuffer();
  StringBuffer footerCode=new StringBuffer();
  Iterator membersIter;
  String className=source.getName();
  String typeName=CNames.instanceNameOf(source);
  String objectName=CNames.classNameOf(source);
  headerCode.append("String_Node_Str" + "String_Node_Str");
  headerCode.append("String_Node_Str" + typeName + "String_Node_Str");
  headerCode.append("String_Node_Str" + typeName + "String_Node_Str");
  footerCode.append("String_Node_Str");
  bodyCode.append("String_Node_Str" + typeName + "String_Node_Str");
  bodyCode.append("String_Node_Str" + typeName + "String_Node_Str"+ typeName+ "String_Node_Str");
  bodyCode.append("String_Node_Str" + className + "String_Node_Str");
  bodyCode.append("String_Node_Str" + objectName + "String_Node_Str");
  bodyCode.append("String_Node_Str" + className + "String_Node_Str");
  bodyCode.append("String_Node_Str" + objectName + "String_Node_Str"+ objectName+ "String_Node_Str");
  return (headerCode.append(bodyCode.append(footerCode))).toString();
}
Program: 75671
Project: 75671
Buggy source:
/** 
 * Evaluate the assertion. If the evaluation returns false, throw a run-time IllegalActionException.
 * @exception IllegalActionException If the evaluation of the assertiontriggers it, or the evaluation yields a null result, or the evaluation yields an incompatible type, or if there is no director.
 */
public void fire() throws IllegalActionException {
  Director director=getDirector();
  if (director == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _time.setToken(new DoubleToken(director.getCurrentTime()));
  Iterator inputPorts=inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort port=(IOPort)(inputPorts.next());
    if (port.getWidth() > 0) {
      if (port.hasToken(0)) {
        Token inputToken=port.get(0);
        Variable var=(Variable)(getAttribute(port.getName()));
        var.setToken(inputToken);
      }
    }
  }
  BooleanToken result=(BooleanToken)assertion.getToken();
  if (result.booleanValue()) {
    throw new IllegalActionException(this,"String_Node_Str" + assertion.getExpression());
  }
}

Fixed version (ground truth):
/** 
 * Evaluate the assertion. If the evaluation returns false, throw a run-time IllegalActionException.
 * @exception IllegalActionException If the evaluation of the assertiontriggers it, or the evaluation yields a null result, or the evaluation yields an incompatible type, or if there is no director.
 */
public void fire() throws IllegalActionException {
  Director director=getDirector();
  if (director == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _time.setToken(new DoubleToken(director.getCurrentTime()));
  Iterator inputPorts=inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort port=(IOPort)(inputPorts.next());
    if (port.getWidth() > 0) {
      if (port.hasToken(0)) {
        Token inputToken=port.get(0);
        Variable var=(Variable)(getAttribute(port.getName()));
        var.setToken(inputToken);
      }
    }
  }
  BooleanToken result=(BooleanToken)assertion.getToken();
  if (!result.booleanValue()) {
    throw new IllegalActionException(this,"String_Node_Str" + assertion.getExpression());
  }
}
Program: 75672
Project: 75672
Buggy source:
/** 
 * Reset all receivers to allow a new firing of the director.
 */
private void _resetAllReceivers(){
  _debug("String_Node_Str");
  _currentNumberOfKnownReceivers=0;
  Iterator receiverIterator=_receivers.iterator();
  while (receiverIterator.hasNext()) {
    ((SRReceiver)receiverIterator.next()).reset();
  }
}

Fixed version (ground truth):
/** 
 * Reset all receivers to allow a new firing of the director.
 */
private void _resetAllReceivers(){
  _debug("String_Node_Str");
  _currentNumberOfKnownReceivers=0;
  if (_receivers == null) {
    return;
  }
  Iterator receiverIterator=_receivers.iterator();
  while (receiverIterator.hasNext()) {
    ((SRReceiver)receiverIterator.next()).reset();
  }
}
Program: 75673
Project: 75673
Buggy source:
/** 
 * Configure the FIR filter with a specified number of taps, tap values, delay line storage, interpolation value, decimation value, and decimation phase.
 * @param numberOfTaps The number of taps.
 * @param taps The tap values.
 * @param data The storage to use for the delay line (this is neededdue to the limited support for arrays in the current version of the C code generator).
 * @param interpolation The interpolation value.
 * @param decimation The decimation value.
 * @param decimationPhase The decimation phase.
 */
public void initialize(float taps[],int numberOfTaps,float data[],int interpolation,int decimation,int decimationPhase){
  _taps=taps;
  _numberOfTaps=numberOfTaps;
  _data=data;
  _interpolation=interpolation;
  _decimation=decimation;
  _decimationPhase=decimationPhase;
  _phaseLength=(int)(numberOfTaps / _interpolation);
  if ((numberOfTaps % _interpolation) != 0) {
    _phaseLength++;
  }
  for (int i=0; i < _phaseLength; i++) {
    _data[i]=0;
  }
  _dataLength=_phaseLength;
}

Fixed version (ground truth):
/** 
 * Configure the FIR filter with a specified number of taps, tap values, delay line storage, interpolation value, decimation value, and decimation phase.
 * @param numberOfTaps The number of taps.
 * @param taps The tap values.
 * @param data The storage to use for the delay line (this is neededdue to the limited support for arrays in the current version of the C code generator).
 * @param interpolation The interpolation value.
 * @param decimation The decimation value.
 * @param decimationPhase The decimation phase.
 */
public void initialize(float taps[],int numberOfTaps,float data[],int interpolation,int decimation,int decimationPhase){
  _taps=taps;
  _numberOfTaps=numberOfTaps;
  _data=data;
  _interpolation=interpolation;
  _decimation=decimation;
  _decimationPhase=decimationPhase;
  _mostRecent=0;
  _phaseLength=(int)(numberOfTaps / _interpolation);
  if ((numberOfTaps % _interpolation) != 0) {
    _phaseLength++;
  }
  for (int i=0; i < _phaseLength; i++) {
    _data[i]=0;
  }
  _dataLength=_phaseLength;
}
Program: 75674
Project: 75674
Buggy source:
/** 
 * Get the token contained by this variable.  The type of the returned token is always that returned by getType().  Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public ptolemy.data.Token getToken() throws IllegalActionException {
  if (_isTokenUnknown)   throw new UnknownResultException(this);
  if (_needsEvaluation || _currentExpression != null && _parseTreeVersion != workspace().getVersion())   _evaluate();
  return _token;
}

Fixed version (ground truth):
/** 
 * Get the token contained by this variable.  The type of the returned token is always that returned by getType().  Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public ptolemy.data.Token getToken() throws IllegalActionException {
  if (_isTokenUnknown)   throw new UnknownResultException(this);
  if (_needsEvaluation)   _evaluate();
  return _token;
}
Program: 75675
Project: 75675
Buggy source:
/** 
 * Get the token contained by this base unit.  Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public Token getToken() throws IllegalActionException {
  Token token=super.getToken();
  if (token != _token) {
    Iterator attributes=attributeList(UnitCategory.class).iterator();
    if (attributes.hasNext()) {
      Attribute category=(Attribute)attributes.next();
      int index=UnitSystem.getUnitCategoryIndex(category.getName());
      if (index >= 0) {
        ((ScalarToken)token).setUnitCategory(index);
      }
    }
    _token=token;
  }
  return _token;
}

Fixed version (ground truth):
/** 
 * Get the token contained by this base unit.  The token contains the unit information specified by the unit category property. Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public Token getToken() throws IllegalActionException {
  Token token=super.getToken();
  if (token != _token) {
    Iterator attributes=attributeList(UnitCategory.class).iterator();
    if (attributes.hasNext()) {
      UnitCategory category=(UnitCategory)attributes.next();
      int index=UnitSystem.getUnitCategoryIndex(category);
      if (index >= 0) {
        ((ScalarToken)token).setUnitCategory(index);
      }
    }
    _token=token;
  }
  return _token;
}
Program: 75676
Project: 75676
Buggy source:
/** 
 * Construct a unit category property with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown.  This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
 * @param container The container.
 * @param name The name of this attribute.
 * @exception IllegalActionException If the attribute is not of anacceptable class for the container, or if the name contains a period.
 * @exception NameDuplicationException If the name coincides withan attribute already in the container.
 */
public UnitCategory(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  UnitSystem.addUnitCategory(name,container.getName());
}

Fixed version (ground truth):
/** 
 * Construct a unit category property with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown.  This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
 * @param container The container.
 * @param name The name of this attribute.
 * @exception IllegalActionException If the attribute is not of anacceptable class for the container, or if the name contains a period.
 * @exception NameDuplicationException If the name coincides withan attribute already in the container.
 */
public UnitCategory(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  UnitSystem.addUnitCategory(this);
}
Program: 75677
Project: 75677
Buggy source:
/** 
 * Return the index assigned to the specified unit category.
 * @param categoryName The name of the unit category.
 * @return The index assigned to the category.
 */
public static int getUnitCategoryIndex(String categoryName){
  Integer index=(Integer)_indexTable.get(categoryName);
  if (index == null) {
    return -1;
  }
 else {
    return index.intValue();
  }
}

Fixed version (ground truth):
/** 
 * Return the index assigned to the specified unit category.
 * @param category The unit category.
 * @return The index assigned to the category.
 */
public static int getUnitCategoryIndex(UnitCategory category){
  Integer index=(Integer)_indexTable.get(category);
  if (index == null) {
    return -1;
  }
 else {
    return index.intValue();
  }
}
Program: 75678
Project: 75678
Buggy source:
/** 
 * Record the specified unit category, and the name of its base unit. If the category is not already recorded, assign a unique index for the category.
 * @param categoryName The name of the unit category.
 * @param baseUnitName The name of the base unit of the category.
 */
public static void addUnitCategory(String categoryName,String baseUnitName){
  Integer index=(Integer)_indexTable.get(categoryName);
  if (index != null) {
    _baseNames[index.intValue()]=baseUnitName;
  }
 else {
    String[] oldNames=_baseNames;
    int length=oldNames.length;
    _baseNames=new String[length + 1];
    System.arraycopy(oldNames,0,_baseNames,0,length);
    index=new Integer(length);
    _indexTable.put(categoryName,index);
    _baseNames[length]=baseUnitName;
  }
}

Fixed version (ground truth):
/** 
 * Register the specified unit category. If the category is not already registered, assign a unique index for the category.
 * @param category The unit category to be registered.
 */
public static void addUnitCategory(UnitCategory category){
  Integer index=(Integer)_indexTable.get(category);
  if (index != null) {
    return;
  }
 else {
    index=new Integer(_categories);
    _indexTable.put(category,index);
    ++_categories;
    _categoryVector.add(category);
  }
}
Program: 75679
Project: 75679
Buggy source:
/** 
 * Return the name of the base unit of the specified category.
 * @param categoryIndex The index of the unit category.
 * @return The name of the base unit of the category.
 */
public static String getBaseUnitName(int categoryIndex){
  if (categoryIndex < 0 || categoryIndex > _baseNames.length - 1) {
    return null;
  }
 else {
    return _baseNames[categoryIndex];
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the base unit of the specified category.
 * @param categoryIndex The index of the unit category.
 * @return The name of the base unit of the category.
 */
public static String getBaseUnitName(int categoryIndex){
  if (categoryIndex < 0 || categoryIndex >= _categories) {
    return "String_Node_Str";
  }
 else {
    UnitCategory category=(UnitCategory)_categoryVector.elementAt(categoryIndex);
    if (category != null) {
      return ((BaseUnit)category.getContainer()).getName();
    }
 else {
      return "String_Node_Str";
    }
  }
}
Program: 75680
Project: 75680
Buggy source:
/** 
 * Return true if the mode controller is ready to fire. If this model is not at the top level and the current time of this director lags behind that of the executive director, update the current time to that of the executive director. Record whether the refinement of the current state of the mode controller is ready to fire.
 * @exception IllegalActionException If there is no controller.FIXME: Changed by liuj, not yet reviewed.
 */
public boolean prefire() throws IllegalActionException {
  super.prefire();
  FSMActor ctrl=getController();
  _firstFire=true;
  return getController().prefire();
}

Fixed version (ground truth):
/** 
 * Return true if the mode controller is ready to fire. If this model is not at the top level and the current time of this director lags behind that of the executive director, update the current time to that of the executive director. Record whether the refinement of the current state of the mode controller is ready to fire.
 * @exception IllegalActionException If there is no controller.FIXME: Changed by liuj, not yet reviewed.
 */
public boolean prefire() throws IllegalActionException {
  CompositeActor actor=(CompositeActor)getContainer();
  Iterator outputPorts=actor.outputPortList().iterator();
  while (outputPorts.hasNext()) {
    IOPort p=(IOPort)outputPorts.next();
    Receiver[][] insideReceivers=p.getInsideReceivers();
    if (insideReceivers == null)     continue;
    for (int i=0; i < insideReceivers.length; i++) {
      if (insideReceivers[i] == null)       continue;
      for (int j=0; j < insideReceivers[i].length; j++) {
        try {
          if (insideReceivers[i][j].hasToken()) {
            insideReceivers[i][j].get();
          }
        }
 catch (        NoTokenException ex) {
          throw new InternalErrorException(this,ex,null);
        }
      }
    }
  }
  super.prefire();
  _firstFire=true;
  FSMActor ctrl=getController();
  return getController().prefire();
}
Program: 75681
Project: 75681
Buggy source:
/** 
 * Return all the sink nodes in this graph in the form of a collection. Each element in the collection is a   {@link Node}.
 * @return The sink nodes in this graph.
 * @see #sinkNodeCount()
 */
public Collection sinkNodes(){
  if (_sinkNodeListener.obsolete()) {
    _sinkNodes=new ArrayList();
    Iterator nodes=nodes().iterator();
    while (nodes.hasNext()) {
      Node node=(Node)nodes.next();
      if (inputEdgeCount(node) == 0) {
        _sinkNodes.add(node);
      }
    }
    _sinkNodeListener.registerComputation();
  }
  return Collections.unmodifiableList(_sinkNodes);
}

Fixed version (ground truth):
/** 
 * Return all the sink nodes in this graph in the form of a collection. Each element in the collection is a   {@link Node}.
 * @return The sink nodes in this graph.
 * @see #sinkNodeCount()
 */
public Collection sinkNodes(){
  if (_sinkNodeListener.obsolete()) {
    _sinkNodes=new ArrayList();
    Iterator nodes=nodes().iterator();
    while (nodes.hasNext()) {
      Node node=(Node)nodes.next();
      if (outputEdgeCount(node) == 0) {
        _sinkNodes.add(node);
      }
    }
    _sinkNodeListener.registerComputation();
  }
  return Collections.unmodifiableList(_sinkNodes);
}
Program: 75682
Project: 75682
Buggy source:
/** 
 * Update the state of the actor and schedule the next firing, if appropriate.
 * @exception IllegalActionException If the director throws it whenscheduling the next firing.
 */
public boolean postfire() throws IllegalActionException {
  _cycleStartTime=_tentativeCycleStartTime;
  _currentValue=_tentativeCurrentValue;
  _phase=_tentativePhase;
  _oldTrigger=_trigger;
  if (_tentativeNextFiringTime != Double.NEGATIVE_INFINITY) {
    getDirector().fireAt(this,_tentativeNextFiringTime);
  }
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Update the state of the actor and schedule the next firing, if appropriate.
 * @exception IllegalActionException If the director throws it whenscheduling the next firing.
 */
public boolean postfire() throws IllegalActionException {
  _cycleStartTime=_tentativeCycleStartTime;
  _currentValue=_tentativeCurrentValue;
  _phase=_tentativePhase;
  if (_tentativeNextFiringTime != Double.NEGATIVE_INFINITY) {
    getDirector().fireAt(this,_tentativeNextFiringTime);
  }
  return super.postfire();
}