nus-yam/ex-repair huggingface dataset:
Program: 76588
Project: 76588
Buggy source:
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception CloneNotSupportedException If the initialize() method of thecontainer or one of the deeply contained actors throws it.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws IllegalActionException {
  _cQueue=new CalendarQueue(new DECQComparator());
  _dag=new DirectedAcyclicGraph();
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _startTimeInitialized=false;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  super.initialize();
  _computeDepth();
}

Fixed version (ground truth):
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws IllegalActionException {
  _cQueue=new CalendarQueue(new DECQComparator());
  _dag=new DirectedAcyclicGraph();
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _startTimeInitialized=false;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  super.initialize();
  _computeDepth();
}
Program: 76589
Project: 76589
Buggy source:
private void _computeDepth(){
  Object[] sort=(Object[])_dag.topologicalSort();
  for (int i=sort.length - 1; i >= 0; i--) {
    IOPort p=(IOPort)sort[i];
    System.out.println(p.description(FULLNAME) + "String_Node_Str" + i);
    Receiver[][] r;
    try {
      r=p.getReceivers();
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
    }
    if (r == null) {
      continue;
    }
    for (int j=r.length - 1; j >= 0; j--) {
      for (int k=r[j].length - 1; k >= 0; k--) {
        DEReceiver der=(DEReceiver)r[j][k];
        der.setDepth(i);
      }
    }
  }
}

Fixed version (ground truth):
private void _computeDepth(){
  Object[] sort=(Object[])_dag.topologicalSort();
  System.out.println("String_Node_Str");
  for (int i=sort.length - 1; i >= 0; i--) {
    IOPort p=(IOPort)sort[i];
    System.out.println(p.description(FULLNAME) + "String_Node_Str" + i);
    Receiver[][] r;
    try {
      r=p.getReceivers();
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
    }
    if (r == null) {
      continue;
    }
    for (int j=r.length - 1; j >= 0; j--) {
      for (int k=r[j].length - 1; k >= 0; k--) {
        DEReceiver der=(DEReceiver)r[j][k];
        der.setDepth(i);
      }
    }
  }
}
Program: 76590
Project: 76590
Buggy source:
/** 
 * Fire the one actor identified by the prefire() method as ready to fire. If there are multiple simultaneous events destined to this actor, then they have all been dequeued from the global queue and put into the corresponding receivers. <p> NOTE: Currently, this means that there may be multiple simultaneous events in a given receiver.  Since many actors may be written in such a way that they do not expect this, this may change in the future. I.e., these events may be made visible over multiple firings rather than all at once.
 */
public void fire() throws IllegalActionException {
  super.fire();
}

Fixed version (ground truth):
/** 
 * Fire the one actor identified by the prefire() method as ready to fire. If there are multiple simultaneous events destined to this actor, then they have all been dequeued from the global queue and put into the corresponding receivers. <p> NOTE: Currently, this means that there may be multiple simultaneous events in a given receiver.  Since many actors may be written in such a way that they do not expect this, this may change in the future. I.e., these events may be made visible over multiple firings rather than all at once.
 * @exception IllegalActionException If the parent class throws it.
 */
public void fire() throws IllegalActionException {
  super.fire();
}
Program: 76591
Project: 76591
Buggy source:
/** 
 * Broadcast a token to all receivers connected to this output port with the specified time delay.  The time stamp of of the token is equal to current time plus the specified delay.
 * @param token The token to send.
 * @param delay The time stamp of the token being broadcast.
 * @exception CloneNotSupportedException If there is more than onedestination and the token cannot be cloned.
 * @exception IllegalActionException If the port is not an output.
 */
public void broadcast(Token token,double delay) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    Receiver fr[][]=getRemoteReceivers();
    if (fr == null) {
      return;
    }
    for (int j=0; j < fr.length; j++) {
      send(j,token,delay);
    }
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Broadcast a token to all receivers connected to this output port with the specified time delay.  The time stamp of of the token is equal to current time plus the specified delay.
 * @param token The token to send.
 * @param delay The time stamp of the token being broadcast.
 * @exception IllegalActionException If the port is not an output.
 */
public void broadcast(Token token,double delay) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    Receiver fr[][]=getRemoteReceivers();
    if (fr == null) {
      return;
    }
    for (int j=0; j < fr.length; j++) {
      send(j,token,delay);
    }
  }
  finally {
    workspace().doneReading();
  }
}
Program: 76592
Project: 76592
Buggy source:
/** 
 * Send a token with the specified time delay to the receivers connected on the specified channel.  The time stamp of of the token is equal to current time plus the specified delay.
 * @param channelindex The index of the channel, from 0 to width-1.
 * @param token The token to send.
 * @param delay The time delay of the token being sent.
 * @exception CloneNotSupportedException If the token cannot be clonedand there is more than one destination.
 * @exception IllegalActionException If the port is not an output,or if the index is out of range.
 */
public void send(int channelindex,Token token,double delay) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (channelindex >= getWidth() || channelindex < 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    Receiver[][] fr=getRemoteReceivers();
    if (fr == null || fr[channelindex] == null)     return;
    for (int j=0; j < fr[channelindex].length; j++) {
      try {
        ((DEReceiver)fr[channelindex][j]).put(token,delay);
      }
 catch (      ClassCastException e) {
        throw new InvalidStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
    }
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Send a token with the specified time delay to the receivers connected on the specified channel.  The time stamp of of the token is equal to current time plus the specified delay.
 * @param channelindex The index of the channel, from 0 to width-1.
 * @param token The token to send.
 * @param delay The time delay of the token being sent.
 * @exception IllegalActionException If the port is not an output,or if the index is out of range.
 */
public void send(int channelindex,Token token,double delay) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    if (!isOutput()) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    if (channelindex >= getWidth() || channelindex < 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    Receiver[][] fr=getRemoteReceivers();
    if (fr == null || fr[channelindex] == null)     return;
    for (int j=0; j < fr[channelindex].length; j++) {
      try {
        ((DEReceiver)fr[channelindex][j]).put(token,delay);
      }
 catch (      ClassCastException e) {
        throw new InvalidStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
    }
  }
  finally {
    workspace().doneReading();
  }
}
Program: 76593
Project: 76593
Buggy source:
/** 
 * Get a token from the receiver.  The token returned is one that was put in the receiver with a time stamp equal to or earlier than the current time.  If there is no such token, throw an exception.
 * @return A token.
 * @exception NoSuchItemException If there are no more tokens.
 */
public Token get() throws NoTokenException {
  if (_tokens.isEmpty()) {
    throw new NoTokenException(getContainer(),"String_Node_Str");
  }
  return (Token)_tokens.take();
}

Fixed version (ground truth):
/** 
 * Get a token from the receiver.  The token returned is one that was put in the receiver with a time stamp equal to or earlier than the current time.  If there is no such token, throw an exception.
 * @return A token.
 * @exception NoTokenException If there are no more tokens.
 */
public Token get() throws NoTokenException {
  if (_tokens.isEmpty()) {
    throw new NoTokenException(getContainer(),"String_Node_Str");
  }
  return (Token)_tokens.take();
}
Program: 76594
Project: 76594
Buggy source:
/** 
 * Make a token available to the get() method. Normally, only a director should use this method. It uses it when its current time matches the time stamp of the token.
 * @param token The token to make available.
 */
protected void _triggerEvent(Token token) throws IllegalActionException {
  _tokens.insertFirst(token);
}

Fixed version (ground truth):
/** 
 * Make a token available to the get() method. Normally, only a director should use this method. It uses it when its current time matches the time stamp of the token.
 * @param token The token to make available.
 */
protected void _triggerEvent(Token token){
  _tokens.insertFirst(token);
}
Program: 76595
Project: 76595
Buggy source:
/** 
 * Return the container.
 * @return An instance of IOPort.
 */
public Nameable getContainer(){
  return _container;
}

Fixed version (ground truth):
/** 
 * Return the container.
 * @return An instance of IOPort.
 */
public IOPort getContainer(){
  return _container;
}
Program: 76596
Project: 76596
Buggy source:
/** 
 * Create receivers for each input port.
 * @exception IllegalActionException If any port throws it.
 */
public void createReceivers() throws IllegalActionException {
  Enumeration inputPorts=inputPorts();
  while (inputPorts.hasMoreElements()) {
    IOPort inport=(IOPort)inputPorts.nextElement();
    inport.createReceivers();
  }
}

Fixed version (ground truth):
/** 
 * Create receivers for each input port.
 * @exception IllegalActionException If any port throws it.
 */
public void createReceivers() throws IllegalActionException {
  Enumeration ports=getPorts();
  while (ports.hasMoreElements()) {
    IOPort oneport=(IOPort)ports.nextElement();
    oneport.createReceivers();
  }
}
Program: 76599
Project: 76599
Buggy source:
/** 
 * Produce an output event at the current time, and then schedule a firing in the future.
 * @exception CloneNotSupportedException If there is more than onedestination and the output token cannot be cloned.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  DECQDirector dir=(DECQDirector)getDirector();
  output.broadcast(new DoubleToken(_value));
  dir.enqueueEvent(this,_interval,0);
}

Fixed version (ground truth):
/** 
 * Produce an output event at the current time, and then schedule a firing in the future.
 * @exception CloneNotSupportedException If there is more than onedestination and the output token cannot be cloned.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  output.broadcast(new DoubleToken(_value));
  refireAtTime(_interval);
}
Program: 76600
Project: 76600
Buggy source:
/** 
 * Produce the initializer event that will cause the generation of the first output at time zero.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  super.initialize();
  DECQDirector dir=(DECQDirector)getDirector();
  dir.enqueueEvent(this,0.0,0);
}

Fixed version (ground truth):
/** 
 * Produce the initializer event that will cause the generation of the first output at time zero.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  super.initialize();
  refireAtTime(0.0);
}
Program: 76601
Project: 76601
Buggy source:
/** 
 * Rescale the plot so that all the data plotted is visible.
 */
public void wrapup(){
  _plot.fillPlot();
}

Fixed version (ground truth):
/** 
 * Rescale the plot so that all the data plotted is visible.
 */
public void wrapup() throws IllegalActionException {
  _plot.fillPlot();
  super.wrapup();
}
Program: 76602
Project: 76602
Buggy source:
/** 
 * Add new input data to the plot.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  if (_firstFiring) {
    DECQDirector dir=((DECQDirector)getDirector());
    if (dir == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    _plot.setXRange(dir.getStartTime(),dir.getStopTime());
    _plot.setYRange(getYMin(),getYMax());
    _firstFiring=false;
  }
  int numEmptyChannel=0;
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      double curTime=((DECQDirector)getDirector()).getCurrentTime();
      while (input.hasToken(i)) {
        DoubleToken curToken=null;
        try {
          curToken=(DoubleToken)input.get(i);
        }
 catch (        NoSuchItemException e) {
        }
        double curValue=curToken.doubleValue();
        _plot.addPoint(i,curTime,curValue,false);
      }
    }
 else {
      numEmptyChannel++;
    }
  }
  if (numEmptyChannel == width) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Add new input data to the plot.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  if (_firstFiring) {
    _plot.setXRange(getStartTime(),getStopTime());
    _plot.setYRange(getYMin(),getYMax());
    _firstFiring=false;
  }
  int numEmptyChannel=0;
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      double curTime=((DECQDirector)getDirector()).getCurrentTime();
      while (input.hasToken(i)) {
        DoubleToken curToken=null;
        try {
          curToken=(DoubleToken)input.get(i);
        }
 catch (        NoSuchItemException e) {
        }
        double curValue=curToken.doubleValue();
        _plot.addPoint(i,curTime,curValue,false);
      }
    }
 else {
      numEmptyChannel++;
    }
  }
  if (numEmptyChannel == width) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}
Program: 76603
Project: 76603
Buggy source:
/** 
 * Produce an output event at the current time, and then schedule a firing in the future.
 * @exception CloneNotSupportedException If there is more than onedestination and the output token cannot be cloned.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  DECQDirector dir=(DECQDirector)getDirector();
  output.broadcast(new DoubleToken(_value));
  double exp=-Math.log((1 - Math.random())) * _lambda;
  dir.enqueueEvent(this,exp,0);
}

Fixed version (ground truth):
/** 
 * Produce an output event at the current time, and then schedule a firing in the future.
 * @exception CloneNotSupportedException If there is more than onedestination and the output token cannot be cloned.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  output.broadcast(new DoubleToken(_value));
  double exp=-Math.log((1 - Math.random())) * _lambda;
  refireAtTime(exp);
}
Program: 76604
Project: 76604
Buggy source:
/** 
 * Produce the initializer event that will cause the generation of the first event at time zero.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  super.initialize();
  DECQDirector dir=(DECQDirector)getDirector();
  dir.enqueueEvent(this,0.0,0);
}

Fixed version (ground truth):
/** 
 * Produce the initializer event that will cause the generation of the first event at time zero.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If there is no director.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  super.initialize();
  refireAtTime(0.0);
}
Program: 76606
Project: 76606
Buggy source:
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception CloneNotSupportedException If the initialize() method of thecontainer or one of the deeply contained actors throws it.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _computeDepth();
  super.initialize();
}

Fixed version (ground truth):
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception CloneNotSupportedException If the initialize() method of thecontainer or one of the deeply contained actors throws it.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _startTimeInitialized=false;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _computeDepth();
  super.initialize();
}
Program: 76608
Project: 76608
Buggy source:
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception CloneNotSupportedException If the initialize() method of thecontainer or one of the deeply contained actors throws it.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _startTimeInitialized=false;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _computeDepth();
  super.initialize();
}

Fixed version (ground truth):
/** 
 * Set current time to zero, calculate priorities for simultaneous events, and invoke the initialize() methods of all actors deeply contained by the container.  To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their initialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception CloneNotSupportedException If the initialize() method of thecontainer or one of the deeply contained actors throws it.
 * @exception IllegalActionException If there is a delay-free loop, orif the initialize() method of the container or one of the deeply contained actors throws it.
 */
public void initialize() throws CloneNotSupportedException, IllegalActionException {
  _cQueue=new CalendarQueue(new DECQComparator());
  _dag=new DirectedGraph();
  _currentTime=0.0;
  _startTime=Double.MAX_VALUE;
  _startTimeInitialized=false;
  _constructDirectedGraph();
  if (!_dag.isAcyclic()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _computeDepth();
  super.initialize();
}
Program: 76610
Project: 76610
Buggy source:
private void _computeDepth(){
  Object[] sort=(Object[])_dag.topSort();
  for (int i=sort.length - 1; i >= 0; i--) {
    IOPort p=(IOPort)sort[i];
    Receiver[][] r;
    try {
      r=p.getReceivers();
    }
 catch (    IllegalActionException e) {
      throw new InvalidStateException("String_Node_Str" + "String_Node_Str");
    }
    if (r == null) {
      continue;
    }
    for (int j=r.length - 1; j >= 0; j--) {
      for (int k=r[j].length - 1; k >= 0; k--) {
        DEReceiver der=(DEReceiver)r[j][k];
        der.setDepth(i);
      }
    }
  }
}

Fixed version (ground truth):
private void _computeDepth(){
  Object[] sort=(Object[])_dag.topSort();
  for (int i=sort.length - 1; i >= 0; i--) {
    IOPort p=(IOPort)sort[i];
    System.out.println(p.description(FULLNAME) + "String_Node_Str" + i);
    Receiver[][] r;
    try {
      r=p.getReceivers();
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
    }
    if (r == null) {
      continue;
    }
    for (int j=r.length - 1; j >= 0; j--) {
      for (int k=r[j].length - 1; k >= 0; k--) {
        DEReceiver der=(DEReceiver)r[j][k];
        der.setDepth(i);
      }
    }
  }
}
Program: 76611
Project: 76611
Buggy source:
/** 
 * Add new input data to the plot.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  if (_firstFiring) {
    DECQDirector dir=((DECQDirector)getDirector());
    if (dir == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    _plot.setXRange(dir.getStartTime(),dir.getStopTime());
    _plot.setYRange(getYMin(),getYMax());
    _firstFiring=false;
  }
  int numEmptyChannel=0;
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    try {
      DoubleToken curToken=(DoubleToken)input.get(i);
      double curValue=curToken.doubleValue();
      double curTime=((DECQDirector)getDirector()).getCurrentTime();
      _plot.addPoint(i,curTime,curValue,false);
    }
 catch (    NoSuchItemException e) {
      numEmptyChannel++;
    }
  }
  if (numEmptyChannel == width) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Add new input data to the plot.
 */
public void fire() throws CloneNotSupportedException, IllegalActionException {
  if (_firstFiring) {
    DECQDirector dir=((DECQDirector)getDirector());
    if (dir == null) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    _plot.setXRange(dir.getStartTime(),dir.getStopTime());
    _plot.setYRange(getYMin(),getYMax());
    _firstFiring=false;
  }
  int numEmptyChannel=0;
  int width=input.getWidth();
  for (int i=0; i < width; i++) {
    if (input.hasToken(i)) {
      double curTime=((DECQDirector)getDirector()).getCurrentTime();
      while (input.hasToken(i)) {
        DoubleToken curToken=null;
        try {
          curToken=(DoubleToken)input.get(i);
        }
 catch (        NoSuchItemException e) {
        }
        double curValue=curToken.doubleValue();
        _plot.addPoint(i,curTime,curValue,false);
      }
    }
 else {
      numEmptyChannel++;
    }
  }
  if (numEmptyChannel == width) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}
Program: 76612
Project: 76612
Buggy source:
/** 
 * Constructor.
 * @param container The composite actor that this actor belongs too.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public DEWaitingTime(CompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new DEIOPort(this,"String_Node_Str",false,true);
  waiter=new DEIOPort(this,"String_Node_Str",true,false);
  waitee=new DEIOPort(this,"String_Node_Str",true,false);
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param container The composite actor that this actor belongs too.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public DEWaitingTime(CompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new DEIOPort(this,"String_Node_Str",false,true);
  waiter=new DEIOPort(this,"String_Node_Str",true,false);
  waitee=new DEIOPort(this,"String_Node_Str",true,false);
  waiter.before(waitee);
  waitee.triggers(output);
}
Program: 76613
Project: 76613
Buggy source:
/** 
 * Return an element from the history.  If the offset argument is zero, return the most recent token in the history, which is token most recently taken from the queue. If the offset is 1, return the second most recent token, etc. If there is no such token in the history (the offset is greater than or equal to the number of objects in the history, or is negative), throw an exception.
 * @exception NoSuchItemException The offset is out of range.
 */
public Token previous(int offset) throws NoSuchItemException {
  try {
    return (Token)_queue.previous(offset);
  }
 catch (  NoSuchElementException ex) {
    throw new NoSuchItemException(getContainer(),"String_Node_Str" + offset + "String_Node_Str"+ "String_Node_Str"+ historySize());
  }
}

Fixed version (ground truth):
/** 
 * Return an element from the history.  If the offset argument is zero, return the most recent token in the history, which is the token most recently taken from the queue. If the offset is 1, return the second most recent token, etc. If there is no such token in the history (the offset is greater than or equal to the number of objects in the history, or is negative), throw an exception.
 * @exception NoSuchItemException The offset is out of range.
 */
public Token previous(int offset) throws NoSuchItemException {
  try {
    return (Token)_queue.previous(offset);
  }
 catch (  NoSuchElementException ex) {
    throw new NoSuchItemException(getContainer(),"String_Node_Str" + offset + "String_Node_Str"+ "String_Node_Str"+ historySize());
  }
}
Program: 76614
Project: 76614
Buggy source:
/** 
 * Return a token on the queue.  If the offset argument is zero, return the most recent token that was put on the queue. If the offset is 1, return second most recent the token, etc. Do not remove the token from the queue. If there is no such token on the queue (the offset is greater than or equal to the size, or is negative), throw an exception.
 * @param offset The offset from the most recent item on the queue.
 * @exception NoSuchItemException The offset is out of range.
 */
public Token get(int offset) throws NoSuchItemException {
  try {
    return (Token)_queue.get(offset);
  }
 catch (  NoSuchElementException ex) {
    throw new NoSuchItemException(getContainer(),"String_Node_Str" + offset + "String_Node_Str"+ _queue.size());
  }
}

Fixed version (ground truth):
/** 
 * Return a token on the queue.  If the offset argument is zero, return the most recent token that was put on the queue. If the offset is 1, return the second most recent token, etc. Do not remove the token from the queue. If there is no such token on the queue (the offset is greater than or equal to the size, or is negative), throw an exception.
 * @param offset The offset from the most recent item on the queue.
 * @exception NoSuchItemException The offset is out of range.
 */
public Token get(int offset) throws NoSuchItemException {
  try {
    return (Token)_queue.get(offset);
  }
 catch (  NoSuchElementException ex) {
    throw new NoSuchItemException(getContainer(),"String_Node_Str" + offset + "String_Node_Str"+ _queue.size());
  }
}
Program: 76616
Project: 76616
Buggy source:
/** 
 * Constructs an Exception with a detail message that includes the names of the first two arguments plus the third argument string.
 * @param obj1 The first object.
 * @param obj2 The second object.
 * @param detail The message.
 */
public InvalidStateException(Nameable obj1,Nameable obj2,String detail){
  String obj1string=_getFullName(obj1);
  String obj2string=_getFullName(obj2);
  String prefix;
  if (obj1string != "String_Node_Str") {
    if (obj2string != "String_Node_Str") {
      prefix=new String(obj1string + "String_Node_Str" + obj2string);
    }
 else {
      prefix=obj1string;
    }
  }
 else {
    prefix=obj2string;
  }
  _setMessage(prefix);
  if (detail != null) {
    if (!detail.equals("String_Node_Str")) {
      if (!prefix.equals("String_Node_Str")) {
        _setMessage(new String(prefix + "String_Node_Str" + detail));
      }
 else {
        _setMessage(detail);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructs an Exception with a detail message that includes the names of the first two arguments plus the third argument string.
 * @param obj1 The first object.
 * @param obj2 The second object.
 * @param detail The message.
 */
public InvalidStateException(Nameable obj1,Nameable obj2,String detail){
  String obj1string=_getFullName(obj1);
  String obj2string=_getFullName(obj2);
  String prefix;
  if (!obj1string.equals("String_Node_Str")) {
    if (!obj2string.equals("String_Node_Str")) {
      prefix=new String(obj1string + "String_Node_Str" + obj2string);
    }
 else {
      prefix=obj1string;
    }
  }
 else {
    prefix=obj2string;
  }
  _setMessage(prefix);
  if (detail != null) {
    if (!detail.equals("String_Node_Str")) {
      if (!prefix.equals("String_Node_Str")) {
        _setMessage(new String(prefix + "String_Node_Str" + detail));
      }
 else {
        _setMessage(detail);
      }
    }
  }
}
Program: 76617
Project: 76617
Buggy source:
public void incr(){
  _count++;
}

Fixed version (ground truth):
private void incr(){
  _count++;
}
Program: 76618
Project: 76618
Buggy source:
/** 
 * Indicate that the calling thread is finished writing. This wakes up any threads that are suspended on access to this workspace so that they may contend for permissions. It also increments the version number of the workspace.
 */
public synchronized void doneWriting(){
  _writeReq--;
  _writer=null;
  incrVersion();
  notifyAll();
}

Fixed version (ground truth):
/** 
 * Indicate that the calling thread is finished writing. This wakes up any threads that are suspended on access to this workspace so that they may contend for permissions. It also increments the version number of the workspace.
 */
public synchronized void doneWriting(){
  _writeReq--;
  _writeDepth--;
  if (_writeDepth == 0) {
    _writer=null;
    incrVersion();
    notifyAll();
  }
 else   if (_writeDepth < 0) {
    throw new InvalidStateException(this,"String_Node_Str");
  }
}
Program: 76619
Project: 76619
Buggy source:
public boolean zero(){
  return _count <= 0;
}

Fixed version (ground truth):
private boolean zero(){
  return _count <= 0;
}
Program: 76620
Project: 76620
Buggy source:
/** 
 * Obtain permission to write to objects in the workspace. Permission is granted if there are no other threads that currently have read or write permission.  In particular, it <i>is</i> granted if this thread already has write permission, or if it is the only thread with read permission. This method suspends the calling thread until such permission has been obtained.  It is essential that doneWriting() be called after this, or read or write permission may never again be granted in this workspace.
 */
public synchronized void write(){
  _writeReq++;
  while (true) {
    Thread current=Thread.currentThread();
    if (current == _writer) {
      return;
    }
    if (_writer == null) {
      if (_readers.isEmpty()) {
        _writer=Thread.currentThread();
        return;
      }
      if (_readers.size() == 1 && _readers.get(current) != null) {
        _writer=Thread.currentThread();
        return;
      }
    }
    try {
      wait();
    }
 catch (    InterruptedException ex) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Obtain permission to write to objects in the workspace. Permission is granted if there are no other threads that currently have read or write permission.  In particular, it <i>is</i> granted if this thread already has write permission, or if it is the only thread with read permission. This method suspends the calling thread until such permission has been obtained.  It is essential that doneWriting() be called after this, or read or write permission may never again be granted in this workspace.
 */
public synchronized void write(){
  _writeReq++;
  while (true) {
    Thread current=Thread.currentThread();
    if (current == _writer) {
      _writeDepth++;
      return;
    }
    if (_writer == null) {
      if (_readers.isEmpty()) {
        _writer=Thread.currentThread();
        _writeDepth=1;
        return;
      }
      if (_readers.size() == 1 && _readers.get(current) != null) {
        _writer=Thread.currentThread();
        _writeDepth=1;
        return;
      }
    }
    try {
      wait();
    }
 catch (    InterruptedException ex) {
    }
  }
}
Program: 76621
Project: 76621
Buggy source:
public ReadCount(){
}

Fixed version (ground truth):
private ReadCount(){
}
Program: 76622
Project: 76622
Buggy source:
public void decr(){
  _count--;
}

Fixed version (ground truth):
private void decr(){
  _count--;
}
Program: 76623
Project: 76623
Buggy source:
public void wrapup(){
  _terminateAll();
  return;
}

Fixed version (ground truth):
/** 
 * This terminates all the actors in the corresponding CompositeActor
 */
public void wrapup(){
  _terminateAll();
  return;
}
Program: 76624
Project: 76624
Buggy source:
public void startNewActors(){
synchronized (workspace()) {
    workspace().notifyAll();
    return;
  }
}

Fixed version (ground truth):
/** 
 * This should go. Currently this notifies the director to process new actors
 */
public void startNewActors(){
synchronized (workspace()) {
    workspace().notifyAll();
    return;
  }
}
Program: 76625
Project: 76625
Buggy source:
/** 
 * Decreases the number of queues blocked on a read
 */
public void readUnblock(Receptionist recep){
synchronized (workspace()) {
    _readBlockCount--;
    _readblockedQs.removeOneOf(recep);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Decreases the number of queues blocked on a read
 * @param recep is the receptionist/queue being unblocked on a read
 */
public void readUnblock(Receptionist recep){
synchronized (workspace()) {
    _readBlockCount--;
    _readblockedQs.removeOneOf(recep);
    return;
  }
}
Program: 76626
Project: 76626
Buggy source:
public void postfire(){
  return;
}

Fixed version (ground truth):
/** 
 * Does nothing for PN 
 */
public void postfire(){
  return;
}
Program: 76627
Project: 76627
Buggy source:
/** 
 * Increments the no of queues blocked on read. Also checks for deadlocks 
 */
public void readBlock(Receptionist recep){
synchronized (workspace()) {
    _readBlockCount++;
    _readblockedQs.insertFirst(recep);
    _checkForDeadlock(0);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Increments the no of queues blocked on read. Also checks for deadlocks 
 * @param recep is the receptionist/queue that is blocking on a read
 */
public void readBlock(Receptionist recep){
synchronized (workspace()) {
    _readBlockCount++;
    _readblockedQs.insertFirst(recep);
    _checkForDeadlock(0);
    return;
  }
}
Program: 76628
Project: 76628
Buggy source:
public ThreadGroup getProcessGroup(){
  return _processGroup;
}

Fixed version (ground truth):
/** 
 * returns the threadGroup in which all the threads corresponding to  PN actors are started.
 */
public ThreadGroup getProcessGroup(){
  return _processGroup;
}
Program: 76629
Project: 76629
Buggy source:
/** 
 * Increments the capacity, if it can be incremented. Else increments the number of stars blocked while writing and checks for deadlocks.
 * @param latest input port that blocked the corresponding output staron a write.
 */
public void writeBlock(Receptionist recep) throws IllegalActionException {
synchronized (workspace()) {
    _writeBlockCount++;
    _writeblockedQs.insertFirst(recep);
    _checkForDeadlock(0);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Increments the capacity, if it can be incremented. Else increments the number of stars blocked while writing and checks for deadlocks.
 * @param latest input port that blocked the corresponding output staron a write.
 */
public void writeBlock(Receptionist recep){
synchronized (workspace()) {
    _writeBlockCount++;
    _writeblockedQs.insertFirst(recep);
    _checkForDeadlock(0);
    return;
  }
}
Program: 76630
Project: 76630
Buggy source:
/** 
 * If the stars can be blocked on a write, then unblock it and  decrement the number of stars blocked on write.
 */
public void writeUnblock(Receptionist recep){
synchronized (workspace()) {
    _writeBlockCount--;
    _writeblockedQs.removeOneOf(recep);
    return;
  }
}

Fixed version (ground truth):
/** 
 * If the stars can be blocked on a write, then unblock it and  decrement the number of stars blocked on write.
 * @param recep is the receptionist/queue being unblocked
 */
public void writeUnblock(Receptionist recep){
synchronized (workspace()) {
    _writeBlockCount--;
    _writeblockedQs.removeOneOf(recep);
    return;
  }
}
Program: 76631
Project: 76631
Buggy source:
/** 
 * Creates a thread for each PN star and handles deadlocks and terminates
 * @exception IllegalActionException is thrown by submethods 
 */
public boolean prefire(){
synchronized (workspace()) {
    if (_debug > 5)     System.out.println("String_Node_Str");
    Enumeration allMyStars=getNewActors();
    clearNewActors();
    while (allMyStars.hasMoreElements()) {
      PNActor star=(PNActor)allMyStars.nextElement();
      Thread temp=new Thread(_processGroup,star);
      star.setThread(temp);
      star.initialize();
      temp.start();
    }
    _mutate=false;
    if (_debug > 5)     System.out.println("String_Node_Str");
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Creates a thread for each new PN actor, initializes the actors and starts the threads corresponding to each new actor.
 * @returns true
 */
public boolean prefire(){
synchronized (workspace()) {
    if (_debug > 5)     System.out.println("String_Node_Str");
    Enumeration allMyStars=getNewActors();
    clearNewActors();
    while (allMyStars.hasMoreElements()) {
      PNActor star=(PNActor)allMyStars.nextElement();
      Thread temp=new Thread(_processGroup,star);
      star.setThread(temp);
      star.initialize();
      temp.start();
    }
    _mutate=false;
    if (_debug > 5)     System.out.println("String_Node_Str");
    return true;
  }
}
Program: 76632
Project: 76632
Buggy source:
public void fire() throws IllegalActionException {
  setComplete(_handleDeadlock());
  if (_debug > 5)   System.out.println("String_Node_Str");
  return;
}

Fixed version (ground truth):
/** 
 * This handles deadlocks in the PN systems and sets the complete flag to true or false depending on whether it detected a real deadlock or a mutation respectively
 * @exception IllegalActionException should not be thrown.
 */
public void fire() throws IllegalActionException {
  setComplete(_handleDeadlock());
  if (_debug > 5)   System.out.println("String_Node_Str");
  return;
}
Program: 76633
Project: 76633
Buggy source:
/** 
 * This is obsolete. Should go. Please donot use it anymore. 
 */
public void setMutate(boolean mutate){
synchronized (workspace()) {
    _mutate=mutate;
    workspace().notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * This is obsolete. Should go. Please donot use it anymore. 
 * @param mutate true to indicate mutation
 */
public void setMutate(boolean mutate){
synchronized (workspace()) {
    _mutate=mutate;
    workspace().notifyAll();
  }
}
Program: 76636
Project: 76636
Buggy source:
/** 
 * Add the value of the argument Token to this Token. Type resolution also occurs here, with the returned Token type chosen to achieve a lossless conversion. FIXME: what do do about long in the next six methods?
 * @param a The token to add to this Token
 * @exception Thrown if the passed token is not of a type that can be added to this Tokens value in a lossless fashion.
 */
public Token add(pt.data.Token a) throws IllegalActionException {
  if (a instanceof StringToken) {
    String result=toString() + a.toString();
    return new StringToken(result);
  }
 else   if (a instanceof ScalarToken) {
    _value=_value + ((ScalarToken)a).doubleValue();
    return new DoubleToken(_value);
  }
 else {
    String str="String_Node_Str" + this.getClass().getName() + "String_Node_Str";
    str=str + a.getClass().getName();
    throw new IllegalActionException("String_Node_Str" + str);
  }
}

Fixed version (ground truth):
/** 
 * Add the value of the argument Token to this Token. Type resolution also occurs here, with the returned Token type chosen to achieve a lossless conversion. FIXME: what do do about long in the next six methods?
 * @param a The token to add to this Token
 * @exception Thrown if the passed token is not of a type that can be added to this Tokens value in a lossless fashion.
 */
public Token add(pt.data.Token a) throws IllegalActionException {
  if (a instanceof StringToken) {
    String result=toString() + a.toString();
    return new StringToken(result);
  }
 else   if (a instanceof ScalarToken) {
    double tmp=_value + ((ScalarToken)a).doubleValue();
    return new DoubleToken(tmp);
  }
 else {
    String str="String_Node_Str" + this.getClass().getName() + "String_Node_Str";
    str=str + a.getClass().getName();
    throw new IllegalActionException("String_Node_Str" + str);
  }
}
Program: 76637
Project: 76637
Buggy source:
/** 
 * Subtract the value of the argument Token from this Token. Type  resolution also occurs here, with the returned Token type chosen to  achieve a lossless conversion. 
 * @param a The token to subtract to this Token
 * @exception Thrown if the passed token is not of a type that can be subtracted from this Tokens value in a lossless fashion.
 */
public Token subtract(Token a) throws IllegalActionException {
  if (a instanceof ScalarToken) {
    _value=_value - ((ScalarToken)a).doubleValue();
    return new DoubleToken(_value);
  }
 else {
    String str="String_Node_Str" + this.getClass().getName();
    str=str + "String_Node_Str" + a.getClass().getName();
    throw new IllegalActionException("String_Node_Str" + str);
  }
}

Fixed version (ground truth):
/** 
 * Subtract the value of the argument Token from this Token. Type  resolution also occurs here, with the returned Token type chosen to  achieve a lossless conversion. 
 * @param a The token to subtract to this Token
 * @exception Thrown if the passed token is not of a type that can be subtracted from this Tokens value in a lossless fashion.
 */
public Token subtract(Token a) throws IllegalActionException {
  if (a instanceof ScalarToken) {
    double tmp=_value - ((ScalarToken)a).doubleValue();
    return new DoubleToken(tmp);
  }
 else {
    String str="String_Node_Str" + this.getClass().getName();
    str=str + "String_Node_Str" + a.getClass().getName();
    throw new IllegalActionException("String_Node_Str" + str);
  }
}
Program: 76638
Project: 76638
Buggy source:
/** 
 * Set the value of the token to be the specified value.
 */
public void setValue(double value){
  _value=value;
}

Fixed version (ground truth):
/** 
 * Set the value in the token 
 * @param d The new value for the token
 */
public void setValue(double d){
  _value=d;
}