nus-yam/ex-repair huggingface dataset:
Program: 74309
Project: 74309
Buggy source:
/** 
 * Add actuator updates to the graph.
 * @param refinement Refinement containing the actuator ports.
 * @param modePeriod Period of the mode defined by the refinement.
 */
private void _getActuators(Refinement refinement,Time modePeriod){
  List<IOPort> outputPorts=refinement.outputPortList();
  for (  IOPort outputPort : outputPorts) {
    int frequency=TDLModuleDirector.getFrequency((NamedObj)outputPort);
    IOPort connectedPort=null;
    List<IOPort> taskOutputPorts=outputPort.deepInsidePortList();
    for (    IOPort taskOuputPort : taskOutputPorts) {
      if (taskOuputPort.getContainer() instanceof TDLTask) {
        connectedPort=taskOuputPort;
      }
    }
    if (connectedPort != null) {
      for (int i=1; i <= frequency; i++) {
        Time invocationEndTime=new Time(_module.getDirector(),modePeriod.getLongValue() / frequency * (i));
        Node node=_getLastNodeBeforeTime(connectedPort,invocationEndTime);
        Node next=null;
        Edge edge=null;
        Collection<Edge> edges=(Collection<Edge>)_graph.outputEdges(node);
        for (        Edge edge1 : edges) {
          edge=edge1;
          if (edge.source().equals(node)) {
            next=edge.sink();
          }
        }
        _graph.removeEdge(edge);
        Node n=new Node(new TDLAction(invocationEndTime,TDLAction.WRITEACTUATOR,outputPort));
        _graph.addNode(n);
        _graph.addEdge(new Edge(node,n,0));
        _graph.addEdge(new Edge(n,next,0));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Add actuator updates to the graph.
 * @param refinement Refinement containing the actuator ports.
 * @param modePeriod Period of the mode defined by the refinement.
 */
private void _getActuators(Refinement refinement,Time modePeriod){
  List<IOPort> outputPorts=refinement.outputPortList();
  for (  IOPort outputPort : outputPorts) {
    int frequency=TDLModuleDirector.getFrequency((NamedObj)outputPort);
    IOPort connectedPort=null;
    List<IOPort> taskOutputPorts=outputPort.deepInsidePortList();
    for (    IOPort taskOutputPort : taskOutputPorts) {
      if (taskOutputPort.isOutput() && taskOutputPort.getContainer() instanceof TDLTask) {
        connectedPort=taskOutputPort;
      }
    }
    if (connectedPort != null && connectedPort.isOutput()) {
      for (int i=1; i <= frequency; i++) {
        Time invocationEndTime=new Time(_module.getDirector(),modePeriod.getLongValue() / frequency * (i));
        Node node=_getLastNodeBeforeTime(connectedPort,invocationEndTime);
        Node next=null;
        Edge edge=null;
        Collection<Edge> edges=(Collection<Edge>)_graph.outputEdges(node);
        for (        Edge edge1 : edges) {
          edge=edge1;
          if (edge.source().equals(node)) {
            next=edge.sink();
          }
        }
        _graph.removeEdge(edge);
        Node n=new Node(new TDLAction(invocationEndTime,TDLAction.WRITEACTUATOR,outputPort));
        _graph.addNode(n);
        _graph.addEdge(new Edge(node,n,0));
        _graph.addEdge(new Edge(n,next,0));
      }
    }
  }
}
Program: 74310
Project: 74310
Buggy source:
/** 
 * Initialize parameters of the director.
 * @throws NameDuplicationException Could occur if parameter with same name already exists.
 */
private void _initialize() throws IllegalActionException, NameDuplicationException {
  stopTime=new Parameter(this,"String_Node_Str");
  stopTime.setExpression("String_Node_Str");
  stopTime.setTypeEquals(BaseType.DOUBLE);
  timeResolution.setVisibility(Settable.FULL);
  try {
    clockSyncError=new Parameter(this,"String_Node_Str");
    clockSyncError.setExpression("String_Node_Str");
    clockSyncError.setTypeEquals(BaseType.DOUBLE);
    networkDelay=new Parameter(this,"String_Node_Str");
    networkDelay.setExpression("String_Node_Str");
    networkDelay.setTypeEquals(BaseType.DOUBLE);
  }
 catch (  KernelException e) {
    throw new IllegalActionException(this,"String_Node_Str" + e.getMessage());
  }
  _platformsToUnblock=new HashSet<Actor>();
  _scheduleListeners=new LinkedList<ScheduleListener>();
}

Fixed version (ground truth):
/** 
 * Initialize parameters of the director.
 * @throws NameDuplicationException Could occur if parameter with same name already exists.
 */
private void _initialize() throws IllegalActionException, NameDuplicationException {
  stopTime=new Parameter(this,"String_Node_Str");
  stopTime.setExpression("String_Node_Str");
  stopTime.setTypeEquals(BaseType.DOUBLE);
  timeResolution.setVisibility(Settable.FULL);
  try {
    clockSyncError=new Parameter(this,"String_Node_Str");
    clockSyncError.setExpression("String_Node_Str");
    clockSyncError.setTypeEquals(BaseType.DOUBLE);
    synchronizeToRealTime=new Parameter(this,"String_Node_Str");
    synchronizeToRealTime.setExpression("String_Node_Str");
    synchronizeToRealTime.setTypeEquals(BaseType.BOOLEAN);
    networkDelay=new Parameter(this,"String_Node_Str");
    networkDelay.setExpression("String_Node_Str");
    networkDelay.setTypeEquals(BaseType.DOUBLE);
  }
 catch (  KernelException e) {
    throw new IllegalActionException(this,"String_Node_Str" + e.getMessage());
  }
  _platformsToUnblock=new HashSet<Actor>();
  _scheduleListeners=new LinkedList<ScheduleListener>();
}
Program: 74312
Project: 74312
Buggy source:
/** 
 * Override the base class to update local variables.
 * @param attribute Attribute that changed.
 * @exception IllegalActionException Thrown if parameter cannot be read.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == clockSyncError) {
    _clockSyncronizationError=((DoubleToken)clockSyncError.getToken()).doubleValue();
  }
 else   if (attribute == networkDelay) {
    _networkDelay=((DoubleToken)networkDelay.getToken()).doubleValue();
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Override the base class to update local variables.
 * @param attribute Attribute that changed.
 * @exception IllegalActionException Thrown if parameter cannot be read.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == clockSyncError) {
    _clockSyncronizationError=((DoubleToken)clockSyncError.getToken()).doubleValue();
  }
 else   if (attribute == networkDelay) {
    _networkDelay=((DoubleToken)networkDelay.getToken()).doubleValue();
  }
 else   if (attribute == synchronizeToRealTime) {
    _synchronizeToRealTime=((BooleanToken)synchronizeToRealTime.getToken()).booleanValue();
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 74315
Project: 74315
Buggy source:
/** 
 * Return the worst case execution time of the actor or 0 if no worst case execution time was specified.
 * @param actor The actor for which the worst case execution time is requested.
 * @return The worst case execution time.
 */
public static double getWCET(Actor actor){
  if (actor instanceof TDLModule) {
    return ((TDLModuleDirector)((TDLModule)actor).getDirector()).getWCET();
  }
  try {
    Parameter parameter=(Parameter)((NamedObj)actor).getAttribute("String_Node_Str");
    if (parameter != null) {
      DoubleToken token=(DoubleToken)parameter.getToken();
      return token.doubleValue();
    }
 else {
      return 0.0;
    }
  }
 catch (  ClassCastException ex) {
    return 0.0;
  }
catch (  IllegalActionException ex) {
    return 0.0;
  }
}

Fixed version (ground truth):
/** 
 * Return the worst case execution time of the actor or 0 if no worst case execution time was specified.
 * @param actor The actor for which the worst case execution time is requested.
 * @return The worst case execution time. 
 */
public static double getWCET(Actor actor){
  try {
    if (actor instanceof TDLModule) {
      return ((TDLModuleDirector)((TDLModule)actor).getDirector()).getWCET();
    }
    Parameter parameter=(Parameter)((NamedObj)actor).getAttribute("String_Node_Str");
    if (parameter != null) {
      DoubleToken token=(DoubleToken)parameter.getToken();
      return token.doubleValue();
    }
 else {
      return 0.0;
    }
  }
 catch (  ClassCastException ex) {
    return 0.0;
  }
catch (  IllegalActionException ex) {
    return 0.0;
  }
}
Program: 74316
Project: 74316
Buggy source:
public static boolean portIsTriggerPort(IOPort port){
  return !(port instanceof ParameterPort) && !(((Actor)port.getContainer()) instanceof TDLModule);
}

Fixed version (ground truth):
public static boolean portIsTriggerPort(IOPort port){
  return !(port instanceof ParameterPort) && !(port.getContainer() instanceof TDLModule);
}
Program: 74317
Project: 74317
Buggy source:
/** 
 * Return true if there is at least one token available to the get() method.
 * @return True if there are more tokens.
 */
public boolean hasToken(){
  IOPort port=getContainer();
  Actor actor=(Actor)port.getContainer();
  return (port.isOutput() && super.hasToken()) || (!(actor.getDirector() instanceof PtidesEmbeddedDirector) && super.hasToken()) || (hasToken(getModelTime()));
}

Fixed version (ground truth):
/** 
 * Return true if there is at least one token available to the get() method.
 * @return True if there are more tokens.
 */
public boolean hasToken(){
  IOPort port=getContainer();
  Actor actor=(Actor)port.getContainer();
  return (port.isOutput() && super.hasToken()) || (hasToken(getModelTime()));
}
Program: 74318
Project: 74318
Buggy source:
/** 
 * Put a token into this receiver and post a trigger event to the director. The director will be responsible to dequeue the trigger event at the correct timestamp and microstep and invoke the corresponding actor whose input port contains this receiver. This receiver may contain more than one events.
 * @param token The token to be put.
 * @param time The time stamp for the token.
 */
public void put(Token token,Time time){
  try {
    _getDirector();
    super.put(token,time);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(null,ex,null);
  }
}

Fixed version (ground truth):
/** 
 * Put a token into this receiver and post a trigger event to the director. The director will be responsible to dequeue the trigger event at the correct timestamp and microstep and invoke the corresponding actor whose input port contains this receiver. This receiver may contain more than one events.
 * @param token The token to be put.
 * @param time The time stamp for the token.
 */
public void put(Token token,Time time){
  super.put(token,time);
}
Program: 74319
Project: 74319
Buggy source:
/** 
 * Return time stamp of next event on that port or null if that port has no events.
 * @param port Port for which time stamp of next event is requested.
 * @return Time stamp of next event or null if there are no events.
 */
private Time _getNextEventTimeStamp(IOPort port){
  Time time=Time.POSITIVE_INFINITY;
  Receiver[][] receivers=port.getReceivers();
  for (int i=0; i < receivers.length; i++) {
    Receiver[] recv=receivers[i];
    for (int j=0; j < recv.length; j++) {
      PtidesReceiver receiver=(PtidesReceiver)recv[j];
      if (receiver.getNextTime() != null && time.compareTo(receiver.getNextTime()) > 0)       time=receiver.getNextTime();
    }
  }
  return time;
}

Fixed version (ground truth):
/** 
 * Return time stamp of next event on that port or null if that port has no events.
 * @param port Port for which time stamp of next event is requested.
 * @return Time stamp of next event or null if there are no events.
 */
private Time _getNextEventTimeStamp(IOPort port){
  Time time=Time.POSITIVE_INFINITY;
  Receiver[][] receivers=port.getReceivers();
  for (int i=0; i < receivers.length; i++) {
    Receiver[] recv=receivers[i];
    for (int j=0; j < recv.length; j++) {
      if (recv[j] instanceof PtidesReceiver) {
        PtidesReceiver receiver=(PtidesReceiver)recv[j];
        if (receiver.getNextTime() != null && time.compareTo(receiver.getNextTime()) > 0)         time=receiver.getNextTime();
      }
    }
  }
  return time;
}
Program: 74325
Project: 74325
Buggy source:
/** 
 * Compare the two timed events. If the first timed event has a time stamp less than that of the second event, then a negative integer is returned. If the first timed event has a time stamp greater than that of the second event, then a positive integer is returned. If they have exactly the same time stamp, then either a negative integer or a positive integer is returned, depending on the LIFO parameter of the director. If LIFO is set to true, then a negative integer is returned in that case. Otherwise, a positive integer is returned instead.
 * @param a The first timed event.
 * @param b The second timed event.
 * @return -1 or +1 depending on whether the time stamp of the firsttimed event is less than, equal to, or greater than that of the second.
 */
public int compare(TimedEvent a,TimedEvent b){
  int result=a.timeStamp.compareTo(b.timeStamp);
  if (result == 0) {
    try {
      boolean isLIFO=((BooleanToken)LIFO.getToken()).booleanValue();
      result=isLIFO ? -1 : 1;
    }
 catch (    IllegalActionException e) {
      throw new KernelRuntimeException(e,"String_Node_Str");
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Compare the two timed events. If the first timed event has a time stamp less than that of the second event, then a negative integer is returned. If the first timed event has a time stamp greater than that of the second event, then a positive integer is returned. If they have exactly the same time stamp, then either a negative integer or a positive integer is returned, depending on the LIFO parameter of the director. If LIFO is set to true, then a negative integer is returned in that case. Otherwise, a positive integer is returned instead.
 * @param a The first timed event.
 * @param b The second timed event.
 * @return -1 or +1 depending on whether the time stamp of the firsttimed event is less than, equal to, or greater than that of the second.
 */
public int compare(TimedEvent a,TimedEvent b){
  if (a == b) {
    return 0;
  }
  int result=a.timeStamp.compareTo(b.timeStamp);
  if (result == 0) {
    if (_newEvent == null || a != _newEvent && b != _newEvent) {
      return 0;
    }
 else {
      try {
        boolean isLIFO=((BooleanToken)LIFO.getToken()).booleanValue();
        if (a == _newEvent) {
          return isLIFO ? -1 : 1;
        }
 else         if (b == _newEvent) {
          return isLIFO ? 1 : -1;
        }
 else {
          return 0;
        }
      }
 catch (      IllegalActionException e) {
        throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else {
    return result;
  }
}
Program: 74326
Project: 74326
Buggy source:
/** 
 * Initialize the schedule by putting the initial events in the event queue. If this director is directly associated with a modal model, it schedules itself to be fired immediately.
 * @exception IllegalActionException If whether an event is initial eventcannot be checked.
 */
protected void _initializeSchedule() throws IllegalActionException {
  _eventQueue.clear();
  _inputQueue.clear();
  ERGController controller=getController();
  if (_isInController()) {
    ERGModalModel modalModel=(ERGModalModel)getContainer().getContainer();
    _currentTime=modalModel.getDirector().getModelTime();
    Iterator<?> entities=controller.deepEntityList().iterator();
    while (entities.hasNext()) {
      Event event=(Event)entities.next();
      boolean isInitial=((BooleanToken)event.isInitialEvent.getToken()).booleanValue();
      if (isInitial) {
        _eventQueue.add(new TimedEvent(_currentTime,event,null));
      }
    }
  }
 else {
    _eventQueue.add(new TimedEvent(_currentTime,controller,null));
    if (_isEmbedded()) {
      _requestFiring();
    }
  }
  if (_isEmbedded()) {
    _delegateFireAt=true;
  }
}

Fixed version (ground truth):
/** 
 * Initialize the schedule by putting the initial events in the event queue. If this director is directly associated with a modal model, it schedules itself to be fired immediately.
 * @exception IllegalActionException If whether an event is initial eventcannot be checked.
 */
protected void _initializeSchedule() throws IllegalActionException {
  _eventQueue.clear();
  _inputQueue.clear();
  ERGController controller=getController();
  if (_isInController()) {
    ERGModalModel modalModel=(ERGModalModel)getContainer().getContainer();
    _currentTime=modalModel.getDirector().getModelTime();
    Iterator<?> entities=controller.deepEntityList().iterator();
    while (entities.hasNext()) {
      Event event=(Event)entities.next();
      boolean isInitial=((BooleanToken)event.isInitialEvent.getToken()).booleanValue();
      if (isInitial) {
        TimedEvent newEvent=new TimedEvent(_currentTime,event,null);
        _addEvent(newEvent,false);
      }
    }
  }
 else {
    TimedEvent newEvent=new TimedEvent(_currentTime,controller,null);
    _addEvent(newEvent,false);
    if (_isEmbedded()) {
      _requestFiring();
    }
  }
  if (_isEmbedded()) {
    _delegateFireAt=true;
  }
}
Program: 74327
Project: 74327
Buggy source:
/** 
 * Schedule an actor or an event at the given time with the given arguments (for events only).
 * @param object The actor or the event.
 * @param time The time.
 * @param arguments Arguments to the event.
 * @exception IllegalActionException If the actor or event is to bescheduled at a time in the past.
 */
private void _fireAt(Object object,Time time,ArrayToken arguments) throws IllegalActionException {
  if (time.compareTo(getModelTime()) < 0) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + getModelTime() + "String_Node_Str"+ time);
  }
  TimedEvent timedEvent=new TimedEvent(time,object,arguments);
  Time topTime=null;
  if (!_eventQueue.isEmpty()) {
    topTime=_eventQueue.peek().timeStamp;
  }
  _eventQueue.add(timedEvent);
  if (object instanceof Actor) {
    _inputQueue.add(timedEvent);
  }
 else   if (object instanceof Event) {
    Event event=(Event)object;
    if (event.fireOnInput()) {
      _inputQueue.add(timedEvent);
    }
  }
  if (_delegateFireAt && (topTime == null || topTime.compareTo(time) > 0)) {
    _requestFiring();
  }
}

Fixed version (ground truth):
/** 
 * Schedule an actor or an event at the given time with the given arguments (for events only).
 * @param object The actor or the event.
 * @param time The time.
 * @param arguments Arguments to the event.
 * @exception IllegalActionException If the actor or event is to bescheduled at a time in the past.
 */
private void _fireAt(Object object,Time time,ArrayToken arguments) throws IllegalActionException {
  if (time.compareTo(getModelTime()) < 0) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + getModelTime() + "String_Node_Str"+ time);
  }
  TimedEvent timedEvent=new TimedEvent(time,object,arguments);
  Time topTime=null;
  if (!_eventQueue.isEmpty()) {
    topTime=_eventQueue.peek().timeStamp;
  }
  boolean addToInputQueue=false;
  if (object instanceof Actor) {
    addToInputQueue=true;
  }
 else   if (object instanceof Event) {
    Event event=(Event)object;
    if (event.fireOnInput()) {
      addToInputQueue=true;
    }
  }
  _addEvent(timedEvent,addToInputQueue);
  if (_delegateFireAt && (topTime == null || topTime.compareTo(time) > 0)) {
    _requestFiring();
  }
}
Program: 74328
Project: 74328
Buggy source:
public ListDirectory(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  directory=new FileParameter(this,"String_Node_Str");
  directory.setExpression("String_Node_Str");
  Parameter allowFiles=new Parameter(directory,"String_Node_Str");
  allowFiles.setTypeEquals(BaseType.BOOLEAN);
  allowFiles.setToken(BooleanToken.FALSE);
  Parameter allowDirectories=new Parameter(directory,"String_Node_Str");
  allowDirectories.setTypeEquals(BaseType.BOOLEAN);
  allowDirectories.setToken(BooleanToken.TRUE);
  filter=new StringParameter(this,"String_Node_Str");
  filter.setExpression("String_Node_Str");
  recursive=new Parameter(this,"String_Node_Str");
  recursive.setTypeEquals(BaseType.BOOLEAN);
  recursive.setExpression("String_Node_Str");
  files=new Parameter(this,"String_Node_Str");
  files.setTypeEquals(new ArrayType(BaseType.GENERAL));
  files.setExpression("String_Node_Str");
  files.setVisibility(Settable.NOT_EDITABLE);
  files.setPersistent(false);
  Variable variable=new Variable(files,"String_Node_Str");
  variable.setExpression("String_Node_Str");
  variable.setPersistent(false);
}

Fixed version (ground truth):
public ListDirectory(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  directory=new FileParameter(this,"String_Node_Str");
  directory.setExpression("String_Node_Str");
  Parameter allowFiles=new Parameter(directory,"String_Node_Str");
  allowFiles.setTypeEquals(BaseType.BOOLEAN);
  allowFiles.setToken(BooleanToken.FALSE);
  Parameter allowDirectories=new Parameter(directory,"String_Node_Str");
  allowDirectories.setTypeEquals(BaseType.BOOLEAN);
  allowDirectories.setToken(BooleanToken.TRUE);
  filter=new StringParameter(this,"String_Node_Str");
  filter.setExpression("String_Node_Str");
  includeFiles=new Parameter(this,"String_Node_Str");
  includeFiles.setTypeEquals(BaseType.BOOLEAN);
  includeFiles.setExpression("String_Node_Str");
  includeDirectories=new Parameter(this,"String_Node_Str");
  includeDirectories.setTypeEquals(BaseType.BOOLEAN);
  includeDirectories.setExpression("String_Node_Str");
  recursive=new Parameter(this,"String_Node_Str");
  recursive.setTypeEquals(BaseType.BOOLEAN);
  recursive.setExpression("String_Node_Str");
  files=new Parameter(this,"String_Node_Str");
  files.setExpression("String_Node_Str");
  files.setVisibility(Settable.NOT_EDITABLE);
  files.setPersistent(false);
  Variable variable=new Variable(files,"String_Node_Str");
  variable.setExpression("String_Node_Str");
  variable.setPersistent(false);
}
Program: 74329
Project: 74329
Buggy source:
public void fire(ArrayToken arguments) throws IllegalActionException {
  File[] listedFiles=RecursiveFileFilter.listFiles(directory.asFile(),((BooleanToken)recursive.getToken()).booleanValue(),filter.stringValue());
  StringBuffer buffer=new StringBuffer("String_Node_Str");
  int i=0;
  for (  File file : listedFiles) {
    if (i++ > 0) {
      buffer.append("String_Node_Str");
    }
    buffer.append('\"');
    buffer.append(StringUtilities.escapeString(file.getPath()));
    buffer.append('\"');
  }
  if (listedFiles.length > 0) {
    buffer.append(' ');
  }
  buffer.append('}');
  files.setExpression(buffer.toString());
  super.fire(arguments);
}

Fixed version (ground truth):
public void fire(ArrayToken arguments) throws IllegalActionException {
  File[] listedFiles=RecursiveFileFilter.listFiles(directory.asFile(),((BooleanToken)recursive.getToken()).booleanValue(),((BooleanToken)includeFiles.getToken()).booleanValue(),((BooleanToken)includeDirectories.getToken()).booleanValue(),filter.stringValue());
  StringBuffer buffer=new StringBuffer("String_Node_Str");
  int i=0;
  for (  File file : listedFiles) {
    if (i++ > 0) {
      buffer.append("String_Node_Str");
    }
    buffer.append('\"');
    buffer.append(StringUtilities.escapeString(file.getPath()));
    buffer.append('\"');
  }
  if (listedFiles.length > 0) {
    buffer.append(' ');
  }
  buffer.append('}');
  files.setExpression(buffer.toString());
  super.fire(arguments);
}
Program: 74332
Project: 74332
Buggy source:
private Object _resolveLabel(String name,Object container){
  if (container instanceof CompositeActor) {
    Object object=((CompositeActor)container).getEntity(name);
    if (object != null) {
      return object;
    }
  }
  if (container instanceof AtomicActor) {
    if (name.endsWith("String_Node_Str")) {
      name=name.replace("String_Node_Str","String_Node_Str");
    }
    Object object=((AtomicActor)container).getPort(name);
    if (object != null) {
      return object;
    }
  }
  if (container instanceof NamedObj) {
    if (name.endsWith("String_Node_Str")) {
      name=name.replace("String_Node_Str","String_Node_Str");
    }
    Object object=((NamedObj)container).getAttribute(name);
    if (object != null) {
      return object;
    }
  }
  return null;
}

Fixed version (ground truth):
private Object _resolveLabel(String name,Object container){
  int dotIndex=name.indexOf('.');
  if (dotIndex >= 0) {
    String subContainerName=name.substring(0,dotIndex);
    if (container instanceof CompositeActor) {
      Object object=((CompositeActor)container).getEntity(subContainerName);
      if (object != null) {
        return _resolveLabel(name.substring(dotIndex + 1),object);
      }
    }
  }
 else {
    if (container instanceof CompositeActor) {
      Object object=((CompositeActor)container).getEntity(name);
      if (object != null) {
        return object;
      }
    }
    if (container instanceof Entity) {
      if (name.endsWith("String_Node_Str")) {
        name=name.replace("String_Node_Str","String_Node_Str");
      }
      Object object=((Entity)container).getPort(name);
      if (object != null) {
        return object;
      }
    }
    if (container instanceof NamedObj) {
      if (name.endsWith("String_Node_Str")) {
        name=name.replace("String_Node_Str","String_Node_Str");
      }
      Object object=((NamedObj)container).getAttribute(name);
      if (object != null) {
        return object;
      }
    }
    if (container instanceof Entity) {
      Object object=((Entity)container).getPort(name);
      if (object != null) {
        return object;
      }
      object=((NamedObj)container).getAttribute(name);
      if (object != null) {
        return object;
      }
    }
  }
  return null;
}
Program: 74333
Project: 74333
Buggy source:
public PropertyRemover(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  new PropertyDisplayGUIFactory(this,"String_Node_Str");
  sharedUtilitiesWrapper=new SharedParameter(this,"String_Node_Str",PropertySolver.class);
  if (sharedUtilitiesWrapper.getExpression().length() == 0) {
    sharedUtilitiesWrapper.setToken(new ObjectToken(new SharedUtilities(sharedUtilitiesWrapper)));
  }
  _sharedUtilities=(SharedUtilities)((ObjectToken)sharedUtilitiesWrapper.getToken()).getValue();
}

Fixed version (ground truth):
public PropertyRemover(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  new PropertyDisplayGUIFactory(this,"String_Node_Str");
  sharedUtilitiesWrapper=new SharedParameter(this,"String_Node_Str",PropertySolver.class);
  if (sharedUtilitiesWrapper.getExpression().length() == 0) {
    sharedUtilitiesWrapper.setToken(new ObjectToken(new SharedUtilities()));
  }
  _sharedUtilities=(SharedUtilities)((ObjectToken)sharedUtilitiesWrapper.getToken()).getValue();
}
Program: 74334
Project: 74334
Buggy source:
public static void main(String[] args){
  testPropertiesAndGenerateReports(args[0]);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  testProperties(args);
}
Program: 74335
Project: 74335
Buggy source:
/** 
 * @param propertyableObject
 * @param namedObj
 * @param attribute
 * @param property
 * @throws IllegalActionException
 */
protected void _regressionTest(NamedObj namedObj,Property property) throws PropertyResolutionException {
  Property previousProperty=getPreviousProperty(namedObj);
  if (previousProperty != null) {
    try {
      PropertyAttribute attribute=_getPropertyAttribute(namedObj);
      _updatePropertyAttribute(attribute,previousProperty);
    }
 catch (    IllegalActionException ex) {
      throw new PropertyResolutionException(this,ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param propertyableObject
 * @param namedObj
 * @param attribute
 * @param property
 * @throws IllegalActionException
 */
protected void _regressionTest(NamedObj namedObj,Property property) throws PropertyResolutionException {
  Property previousProperty=getPreviousProperty(namedObj);
  if (previousProperty != null) {
    try {
      PropertyAttribute attribute=_getPropertyAttribute(namedObj);
      _updatePropertyAttribute(attribute,previousProperty);
    }
 catch (    IllegalActionException ex) {
      throw new PropertyResolutionException(this,ex);
    }
  }
  if (previousProperty != property && !previousProperty.equals(property)) {
    if (previousProperty == null || (previousProperty != null && !previousProperty.equals(property))) {
      addErrors(_eol + "String_Node_Str" + getUseCaseName()+ "String_Node_Str"+ namedObj.getFullName()+ "String_Node_Str"+ _eol+ "String_Node_Str"+ previousProperty+ "String_Node_Str"+ property+ "String_Node_Str");
    }
  }
}
Program: 74336
Project: 74336
Buggy source:
public PropertySolver(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  action=new SharedParameter(this,"String_Node_Str",PropertySolver.class,TRAINING);
  action.setStringMode(true);
  _addActions(action);
  sharedUtilitiesWrapper=new SharedParameter(this,"String_Node_Str",PropertySolver.class);
  sharedUtilitiesWrapper.setPersistent(false);
  sharedUtilitiesWrapper.setVisibility(Settable.NONE);
  if (sharedUtilitiesWrapper.getExpression().length() == 0) {
    sharedUtilitiesWrapper.setToken(new ObjectToken(new SharedUtilities(sharedUtilitiesWrapper)));
  }
  Collection<SharedParameter> parameters=sharedUtilitiesWrapper.sharedParameterSet();
  for (  SharedParameter parameter : parameters) {
    parameters=parameter.sharedParameterSet();
  }
  _sharedUtilities=(SharedUtilities)((ObjectToken)sharedUtilitiesWrapper.getToken()).getValue();
  _highlighter=new PropertyHighlighter(this,"String_Node_Str");
  manualAnnotation=new Parameter(this,"String_Node_Str",BooleanToken.FALSE);
  manualAnnotation.setTypeEquals(BaseType.BOOLEAN);
  all=new SharedParameter(this,"String_Node_Str",PropertySolver.class,"String_Node_Str");
  all.setTypeEquals(BaseType.BOOLEAN);
}

Fixed version (ground truth):
public PropertySolver(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  action=new SharedParameter(this,"String_Node_Str",PropertySolver.class,TRAINING);
  action.setStringMode(true);
  _addActions(action);
  sharedUtilitiesWrapper=new SharedParameter(this,"String_Node_Str",PropertySolver.class);
  sharedUtilitiesWrapper.setPersistent(false);
  sharedUtilitiesWrapper.setVisibility(Settable.NONE);
  if (sharedUtilitiesWrapper.getExpression().length() == 0) {
    sharedUtilitiesWrapper.setToken(new ObjectToken(new SharedUtilities()));
  }
  Collection<SharedParameter> parameters=sharedUtilitiesWrapper.sharedParameterSet();
  for (  SharedParameter parameter : parameters) {
    parameters=parameter.sharedParameterSet();
  }
  _sharedUtilities=(SharedUtilities)((ObjectToken)sharedUtilitiesWrapper.getToken()).getValue();
  _highlighter=new PropertyHighlighter(this,"String_Node_Str");
  manualAnnotation=new Parameter(this,"String_Node_Str",BooleanToken.FALSE);
  manualAnnotation.setTypeEquals(BaseType.BOOLEAN);
  all=new SharedParameter(this,"String_Node_Str",PropertySolver.class,"String_Node_Str");
  all.setTypeEquals(BaseType.BOOLEAN);
}
Program: 74337
Project: 74337
Buggy source:
/** 
 * @param propertyable
 * @return
 * @throws IllegalActionException
 */
private PropertyAttribute _getPropertyAttribute(NamedObj propertyable) throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * @param propertyable
 * @return
 * @throws IllegalActionException
 */
protected PropertyAttribute _getPropertyAttribute(NamedObj propertyable) throws IllegalActionException {
}
Program: 74338
Project: 74338
Buggy source:
public SharedUtilities(SharedParameter parameter){
  id=count++;
}

Fixed version (ground truth):
public SharedUtilities(){
  id=count++;
}
Program: 74340
Project: 74340
Buggy source:
private PyObject _createObject() throws IllegalActionException {
  if (_class == null) {
    _class=(PyClass)_interpreter.get(_CLASS_NAME);
  }
  PyObject object=_class.__call__();
  if (object == null) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  object.__setattr__("String_Node_Str",new PyJavaInstance(this));
  Iterator attributes=attributeList().iterator();
  while (attributes.hasNext()) {
    Attribute attribute=(Attribute)attributes.next();
    String mangledName=_mangleName(attribute.getName());
    if (_debugging) {
      _debug("String_Node_Str" + attribute.getName() + "String_Node_Str"+ mangledName+ "String_Node_Str");
    }
    object.__setattr__(new PyString(mangledName),new PyJavaInstance(attribute));
  }
  Iterator ports=portList().iterator();
  while (ports.hasNext()) {
    Port port=(Port)ports.next();
    String mangledName=_mangleName(port.getName());
    if (_debugging) {
      _debug("String_Node_Str" + port.getName() + "String_Node_Str"+ mangledName+ "String_Node_Str");
    }
    object.__setattr__(new PyString(mangledName),new PyJavaInstance(port));
  }
  for (int i=0; i < _METHOD_NAMES.length; ++i) {
    String methodName=_METHOD_NAMES[i];
    PyMethod method=null;
    try {
      method=(PyMethod)object.__findattr__(methodName);
    }
 catch (    ClassCastException ex) {
    }
    _methodMap.put(methodName,method);
  }
  return object;
}

Fixed version (ground truth):
private PyObject _createObject() throws IllegalActionException {
  if (_class == null) {
    _evaluateScript();
  }
  PyObject object=_class.__call__();
  if (object == null) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  object.__setattr__("String_Node_Str",new PyJavaInstance(this));
  Iterator attributes=attributeList().iterator();
  while (attributes.hasNext()) {
    Attribute attribute=(Attribute)attributes.next();
    String mangledName=_mangleName(attribute.getName());
    if (_debugging) {
      _debug("String_Node_Str" + attribute.getName() + "String_Node_Str"+ mangledName+ "String_Node_Str");
    }
    object.__setattr__(new PyString(mangledName),new PyJavaInstance(attribute));
  }
  Iterator ports=portList().iterator();
  while (ports.hasNext()) {
    Port port=(Port)ports.next();
    String mangledName=_mangleName(port.getName());
    if (_debugging) {
      _debug("String_Node_Str" + port.getName() + "String_Node_Str"+ mangledName+ "String_Node_Str");
    }
    object.__setattr__(new PyString(mangledName),new PyJavaInstance(port));
  }
  for (int i=0; i < _METHOD_NAMES.length; ++i) {
    String methodName=_METHOD_NAMES[i];
    PyMethod method=null;
    try {
      method=(PyMethod)object.__findattr__(methodName);
    }
 catch (    ClassCastException ex) {
    }
    _methodMap.put(methodName,method);
  }
  return object;
}
Program: 74342
Project: 74342
Buggy source:
private void _clearCaches(){
  _cachedCreatedObjects.clear();
  _cachedIgnoredObjects.clear();
  _cachedNegatedObjects.clear();
  _cachedOptionalObjects.clear();
}

Fixed version (ground truth):
private void _clearCaches(){
  _cachedCreatedObjects.clear();
  _cachedIgnoredObjects.clear();
  _cachedNegatedObjects.clear();
  _cachedOptionalContainers.clear();
}
Program: 74343
Project: 74343
Buggy source:
protected boolean _isIgnored(Object object){
  Boolean ignored=_cachedIgnoredObjects.get(object);
  if (ignored != null) {
    return ignored.booleanValue();
  }
  if (_isCreated(object) || GTTools.isIgnored(object)) {
    return true;
  }
  boolean optional=_isOptional(object);
  boolean result;
  if (optional && _ignoredOptionalObjects.containsKey(object) && _ignoredOptionalObjects.get(object)) {
    result=true;
  }
 else {
    result=false;
  }
  _cachedIgnoredObjects.put(object,result);
  return result;
}

Fixed version (ground truth):
protected boolean _isIgnored(Object object){
  Boolean ignored=_cachedIgnoredObjects.get(object);
  if (ignored != null) {
    return ignored.booleanValue();
  }
  boolean result;
  if (_isCreated(object) || GTTools.isIgnored(object)) {
    result=true;
  }
 else   if (object instanceof NamedObj) {
    NamedObj optionalContainer=_getOptionalContainer((NamedObj)object);
    result=optionalContainer != null && _ignoredOptionalObjects.containsKey(optionalContainer) && _ignoredOptionalObjects.get(optionalContainer);
  }
 else {
    result=false;
  }
  _cachedIgnoredObjects.put(object,result);
  return result;
}
Program: 74345
Project: 74345
Buggy source:
private void _setOrClearPatternObjectAttributes(NamedObj object,boolean isSet,Collection<?> filter){
  try {
    if (filter == null || filter.contains(object)) {
      PatternObjectAttribute patternObject=GTTools.getPatternObjectAttribute(object);
      if (isSet) {
        if (patternObject == null) {
          patternObject=new PatternObjectAttribute(object,"String_Node_Str");
        }
        String name=_getNameWithinContainer(object,getFrameController().getTransformationRule().getPattern());
        patternObject.setPersistent(true);
        patternObject.setExpression(name);
      }
 else       if (patternObject != null) {
        patternObject.setPersistent(false);
        patternObject.setExpression("String_Node_Str");
      }
    }
  }
 catch (  KernelException e) {
    throw new KernelRuntimeException(e,"String_Node_Str");
  }
  try {
    object.workspace().getReadAccess();
    Collection<?> children=GTTools.getChildren(object,true,true,true,true);
    for (    Object childObject : children) {
      NamedObj child=(NamedObj)childObject;
      _setOrClearPatternObjectAttributes(child,isSet,filter);
    }
  }
  finally {
    if (filter == null) {
      object.workspace().doneReading();
    }
  }
}

Fixed version (ground truth):
private void _setOrClearPatternObjectAttributes(NamedObj object,boolean isSet,Collection<?> filter){
  try {
    Collection<?> children;
    if (filter == null) {
      children=GTTools.getChildren(object,false,true,true,true);
    }
 else {
      children=filter;
    }
    for (    Object childObject : children) {
      NamedObj child=(NamedObj)childObject;
      PatternObjectAttribute patternObject=GTTools.getPatternObjectAttribute(child);
      if (isSet) {
        if (patternObject == null) {
          patternObject=new PatternObjectAttribute(child,"String_Node_Str");
        }
        String name=_getNameWithinContainer(child,getFrameController().getTransformationRule().getPattern());
        patternObject.setPersistent(true);
        patternObject.setExpression(name);
      }
 else       if (patternObject != null) {
        patternObject.setPersistent(false);
        patternObject.setExpression("String_Node_Str");
      }
      if (child instanceof CompositeEntity) {
        _setOrClearPatternObjectAttributes((CompositeEntity)child,isSet,null);
      }
    }
  }
 catch (  KernelException e) {
    throw new KernelRuntimeException(e,"String_Node_Str");
  }
}
Program: 74346
Project: 74346
Buggy source:
public void copy(){
  if (!getFrameController().isTableActive()) {
    CompositeEntity model=getFrameController().getActiveModel();
    String header="String_Node_Str";
    if (GTTools.isInPattern(model)) {
      header=_COPY_FROM_PATTERN_HEADER;
      _setOrClearPatternObjectAttributes(model,true,_getSelectionSet());
      super.copy();
      _setOrClearPatternObjectAttributes(model,false,_getSelectionSet());
    }
 else     if (GTTools.isInReplacement(model)) {
      header=_COPY_FROM_REPLACEMENT_HEADER;
      super.copy();
    }
    Clipboard clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
    Transferable transferable=clipboard.getContents(this);
    if (transferable == null) {
      return;
    }
    try {
      String data=(String)transferable.getTransferData(DataFlavor.stringFlavor);
      clipboard.setContents(new StringSelection(header + data),this);
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
public void copy(){
  if (!getFrameController().isTableActive()) {
    CompositeEntity model=getFrameController().getActiveModel();
    String header="String_Node_Str";
    if (GTTools.isInPattern(model)) {
      header=_COPY_FROM_PATTERN_HEADER;
      try {
        model.workspace().getReadAccess();
        _setOrClearPatternObjectAttributes(model,true,_getSelectionSet());
      }
  finally {
        model.workspace().doneReading();
      }
      super.copy();
      try {
        model.workspace().getReadAccess();
        _setOrClearPatternObjectAttributes(model,false,_getSelectionSet());
      }
  finally {
        model.workspace().doneReading();
      }
    }
 else     if (GTTools.isInReplacement(model)) {
      header=_COPY_FROM_REPLACEMENT_HEADER;
      super.copy();
    }
    Clipboard clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
    Transferable transferable=clipboard.getContents(this);
    if (transferable == null) {
      return;
    }
    try {
      String data=(String)transferable.getTransferData(DataFlavor.stringFlavor);
      clipboard.setContents(new StringSelection(header + data),this);
    }
 catch (    Exception e) {
    }
  }
}
Program: 74347
Project: 74347
Buggy source:
protected void _postParse(MoMLParser parser){
  Iterator<?> topObjects=parser.topObjectsCreated().iterator();
  while (topObjects.hasNext()) {
    NamedObj topObject=(NamedObj)topObjects.next();
    if (_isToPattern || _isFromReplacement && _isToReplacement) {
      _setOrClearPatternObjectAttributes(topObject,false,null);
    }
  }
  if (_isFromPattern && _isToReplacement || _isFromReplacement && _isToPattern) {
    parser.clearTopObjectsList();
  }
 else {
    super._postParse(parser);
  }
}

Fixed version (ground truth):
protected void _postParse(MoMLParser parser){
  Iterator<?> topObjects=parser.topObjectsCreated().iterator();
  while (topObjects.hasNext()) {
    NamedObj topObject=(NamedObj)topObjects.next();
    if (_isToPattern || _isFromReplacement && _isToReplacement) {
      try {
        topObject.workspace().getReadAccess();
        _setOrClearPatternObjectAttributes(topObject,false,null);
      }
  finally {
        topObject.workspace().doneReading();
      }
    }
  }
  if (_isFromPattern && _isToReplacement || _isFromReplacement && _isToPattern) {
    parser.clearTopObjectsList();
  }
 else {
    super._postParse(parser);
  }
}
Program: 74349
Project: 74349
Buggy source:
private static String _checkArgumentName(String name) throws IllegalActionException {
  if (name.startsWith("String_Node_Str")) {
    return '\\' + name;
  }
 else {
    return name;
  }
}

Fixed version (ground truth):
private static String _checkArgumentName(String name) throws IllegalActionException {
  return name.replaceAll("String_Node_Str","String_Node_Str");
}
Program: 74350
Project: 74350
Buggy source:
/** 
 * Put the given file path and code content into the current scope using the given signature as the key. It assumes the given signature already exists in the current scope.
 * @param signature The given signature.
 * @param filePath The given file path.
 * @param code The given code content.
 */
public void putCode(Signature signature,String filePath,StringBuffer code){
  LinkedHashMap currentScope=_codeTableList.getLast();
  Object[] codeBlock=(Object[])currentScope.get(signature);
  codeBlock[0]=filePath;
  codeBlock[1]=code;
}

Fixed version (ground truth):
/** 
 * Put the given file path and code content into the current scope using the given signature as the key. It assumes the given signature already exists in the current scope.
 * @param signature The given signature.
 * @param filePath The given file path.
 * @param code The given code content.
 */
public void putCode(Signature signature,String filePath,StringBuffer code){
  LinkedHashMap currentScope=(LinkedHashMap)_codeTableList.getLast();
  Object[] codeBlock=(Object[])currentScope.get(signature);
  codeBlock[0]=filePath;
  codeBlock[1]=code;
}
Program: 74351
Project: 74351
Buggy source:
/** 
 * Add port to the port hashtable.
 * @param name The name of the port.
 * @param value A String representing the port.
 */
public void addPort(String name,String value) throws IllegalActionException, NameDuplicationException {
  _portHash.put(name,value);
  new ConfigurableAttribute(this,"String_Node_Str" + name);
}

Fixed version (ground truth):
/** 
 * Add port to the port hashtable.
 * @param name The name of the port.
 * @param value A String representing the port.
 */
public void addPort(String name,String value) throws IllegalActionException, NameDuplicationException, Exception {
  _portHash.put(name,value);
  ConfigurableAttribute port=new ConfigurableAttribute(this,"String_Node_Str" + name);
  port.configure(null,null,value);
}
Program: 74352
Project: 74352
Buggy source:
/** 
 * Add a property to the property hashtable.
 * @param name The name of the property.
 * @param value A string representing the propety.
 */
public void addProperty(String name,String value) throws NameDuplicationException, IllegalActionException {
  _propertyHash.put(name,value);
  new ConfigurableAttribute(this,"String_Node_Str" + name);
}

Fixed version (ground truth):
/** 
 * Add a property to the property hashtable.
 * @param name The name of the property.
 * @param value A string representing the propety.
 */
public void addProperty(String name,String value) throws NameDuplicationException, IllegalActionException, Exception {
  _propertyHash.put(name,value);
  ConfigurableAttribute ca=new ConfigurableAttribute(this,"String_Node_Str" + name);
  ca.configure(null,null,value);
}
Program: 74354
Project: 74354
Buggy source:
/** 
 * Create director for this controller.
 * @exception IllegalActionException If the controller is incompatiblewith the director.
 * @exception NameDuplicationException If the name of the directorcoincides with a director already in the controller.
 */
private void _init() throws IllegalActionException, NameDuplicationException {
  director=new ERGDirector(this,"String_Node_Str");
  new SingletonAttribute(director,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Create director for this controller.
 * @exception IllegalActionException If the controller is incompatiblewith the director.
 * @exception NameDuplicationException If the name of the directorcoincides with a director already in the controller.
 */
private void _init() throws IllegalActionException, NameDuplicationException {
  director=new ERGDirector(this,"String_Node_Str");
  new SingletonAttribute(director,"String_Node_Str");
  LIFO=new Parameter(this,"String_Node_Str");
  LIFO.setTypeEquals(BaseType.BOOLEAN);
  LIFO.setToken(BooleanToken.TRUE);
  director.LIFO.setToken(BooleanToken.TRUE);
}