nus-yam/ex-repair huggingface dataset:
Program: 73517
Project: 73517
Buggy source:
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sinkports, or if any of the outside sink ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort output : (List<IOPort>)outputPortList()) {
      for (      IOPort sinkPort : (List<IOPort>)output.sinkPortList()) {
        if (sinkPort.getContainer() == getContainer()) {
          flag=true;
          if (PtidesBasicDirector.isNetworkPort(sinkPort)) {
            throw new IllegalActionException(this,sinkPort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sinkports, or if any of the outside sink ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort output : (List<IOPort>)outputPortList()) {
      for (      IOPort sinkPort : (List<IOPort>)output.sinkPortList()) {
        if (sinkPort.getContainer() == getContainer()) {
          flag=true;
          break;
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
  }
}
Program: 73518
Project: 73518
Buggy source:
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If not, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sinkports, or if any of the outside sink ports is not a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  boolean flag=false;
  for (  IOPort output : (List<IOPort>)outputPortList()) {
    for (    IOPort sinkPort : (List<IOPort>)output.sinkPortList()) {
      if (sinkPort.getContainer() == getContainer()) {
        flag=true;
        if (!PtidesBasicDirector.isNetworkPort(sinkPort)) {
          throw new IllegalActionException(this,sinkPort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
  if (!flag) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If not, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sinkports, or if any of the outside sink ports is not a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  boolean flag=false;
  for (  IOPort output : (List<IOPort>)outputPortList()) {
    for (    IOPort sinkPort : (List<IOPort>)output.sinkPortList()) {
      if (sinkPort.getContainer() == getContainer()) {
        flag=true;
        break;
      }
    }
  }
  if (!flag) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
}
Program: 73519
Project: 73519
Buggy source:
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort input : (List<IOPort>)inputPortList()) {
      for (      IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
        if (sourcePort.getContainer() == getContainer()) {
          flag=true;
          if (PtidesBasicDirector.isNetworkPort(sourcePort)) {
            throw new IllegalActionException(this,sourcePort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort input : (List<IOPort>)inputPortList()) {
      for (      IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
        if (sourcePort.getContainer() == getContainer()) {
          flag=true;
          if (PtidesBasicDirector.isNetworkPort(sourcePort)) {
            throw new IllegalActionException(this,sourcePort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
}
Program: 73520
Project: 73520
Buggy source:
/** 
 * Placeholder for book keeping procedures after actor firing. This method does nothing in this class, instead it's a placeholder for subclasses to override.
 */
protected void _actorFired(){
}

Fixed version (ground truth):
/** 
 * Placeholder for book keeping procedures after actor firing. This method does nothing in this class, instead it's a placeholder for subclasses to override.
 * @throws IllegalActionException If false.
 */
protected void _actorFired() throws IllegalActionException {
}
Program: 73521
Project: 73521
Buggy source:
/** 
 * Place holder that gets the next actuation event. This method does nothing here. It's used for the Ptides subclass.
 */
protected void _getNextActuationEvent(){
}

Fixed version (ground truth):
/** 
 * Place holder that gets the next actuation event. This method does nothing here. It's used for the Ptides subclass.
 * @throws IllegalActionException If false.
 */
protected void _getNextActuationEvent() throws IllegalActionException {
}
Program: 73522
Project: 73522
Buggy source:
/** 
 * Perform book keeping after actor firing. This procedure consist of two actions: <ol> <li>An actor has just been fired. A token destined to the outside of the Ptides platform could have been produced. If so, the corresponding  event is taken out of event queue, and the token is placed at the actuator/network port, ready to be transferred to the outside.</li> <li> Bookkeeping structures that keeps track of which actor has just fired are cleared.</li> </ol>
 */
protected void _actorFired(){
  _getNextActuationEvent();
  if (_lastActorFired != null) {
    _pureEventDeadlines.remove(_lastActorFired);
    _pureEventDelays.remove(_lastActorFired);
    _pureEventSourcePorts.remove(_lastActorFired);
  }
}

Fixed version (ground truth):
/** 
 * Perform book keeping after actor firing. This procedure consist of two actions: <ol> <li>An actor has just been fired. A token destined to the outside of the Ptides platform could have been produced. If so, the corresponding  event is taken out of event queue, and the token is placed at the actuator/network port, ready to be transferred to the outside.</li> <li> Bookkeeping structures that keeps track of which actor has just fired are cleared.</li> </ol>
 * @throws IllegalActionException If unable to get next actuation event.
 */
protected void _actorFired() throws IllegalActionException {
  _getNextActuationEvent();
  if (_lastActorFired != null) {
    _pureEventDeadlines.remove(_lastActorFired);
    _pureEventDelays.remove(_lastActorFired);
    _pureEventSourcePorts.remove(_lastActorFired);
  }
}
Program: 73525
Project: 73525
Buggy source:
/** 
 * Among all events in the event queue, find the first event that is destined to an output port of the containing composite actor. This event is taken from the event queue, and the token is sent to the actuator/network output port.
 */
protected void _getNextActuationEvent(){
  int eventIndex=0;
synchronized (_eventQueue) {
    while (eventIndex < _eventQueue.size()) {
      PtidesEvent nextEvent=((PtidesListEventQueue)_eventQueue).get(eventIndex);
      if (nextEvent.ioPort() != null && nextEvent.ioPort().isOutput()) {
        ((PtidesListEventQueue)_eventQueue).take(eventIndex);
        continue;
      }
      eventIndex++;
    }
  }
}

Fixed version (ground truth):
/** 
 * Among all events in the event queue, find the first event that is destined to an output port of the containing composite actor. This event is taken from the event queue, and the token is sent to the actuator/network output port.
 * @throws IllegalActionException If cannot set the current tag ofthe director.
 */
protected void _getNextActuationEvent() throws IllegalActionException {
  int eventIndex=0;
synchronized (_eventQueue) {
    while (eventIndex < _eventQueue.size()) {
      PtidesEvent nextEvent=((PtidesListEventQueue)_eventQueue).get(eventIndex);
      if (nextEvent.ioPort() != null && nextEvent.ioPort().isOutput()) {
        PtidesEvent ptidesEvent=((PtidesListEventQueue)_eventQueue).take(eventIndex);
        setTag(ptidesEvent.timeStamp(),ptidesEvent.microstep());
      }
      eventIndex++;
    }
  }
}
Program: 73530
Project: 73530
Buggy source:
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If not, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is not a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  boolean flag=false;
  for (  IOPort input : (List<IOPort>)inputPortList()) {
    for (    IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
      if (sourcePort.getContainer() == getContainer()) {
        flag=true;
        if (!PtidesBasicDirector.isNetworkPort(sourcePort)) {
          throw new IllegalActionException(this,sourcePort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
  if (!flag) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If not, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is not a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  boolean flag=false;
  for (  IOPort input : (List<IOPort>)inputPortList()) {
    for (    IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
      if (sourcePort.getContainer() == getContainer()) {
        flag=true;
      }
    }
  }
  if (!flag) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
}
Program: 73531
Project: 73531
Buggy source:
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort input : (List<IOPort>)inputPortList()) {
      for (      IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
        if (sourcePort.getContainer() == getContainer()) {
          flag=true;
          if (PtidesBasicDirector.isNetworkPort(sourcePort)) {
            throw new IllegalActionException(this,sourcePort,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Perform a check to see if this device is connected to a network port on the outside. If so, throw an exception. Also call preinitialize of the super class.
 * @exception IllegalActionException If there are no outside sourceports, or if any of the outside source ports is a network port.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  Parameter parameter=(Parameter)getDirector().getAttribute("String_Node_Str");
  if ((parameter != null) && (((DoubleToken)parameter.getToken()).doubleValue() != 0.0)) {
    boolean flag=false;
    for (    IOPort input : (List<IOPort>)inputPortList()) {
      for (      IOPort sourcePort : (List<IOPort>)input.sourcePortList()) {
        if (sourcePort.getContainer() == getContainer()) {
          flag=true;
        }
      }
    }
    if (!flag) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
}
Program: 73532
Project: 73532
Buggy source:
/** 
 * Construct an instance with the specified container and name.
 * @param container The container.
 * @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 GiottoTimingManager(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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  SingletonParameter hideName=new SingletonParameter(this,"String_Node_Str");
  hideName.setToken(BooleanToken.TRUE);
  hideName.setVisibility(Settable.EXPERT);
  seed=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  seed.setTypeEquals(BaseType.LONG);
  resetOnEachRun=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  resetOnEachRun.setTypeEquals(BaseType.BOOLEAN);
  probabilityDistribution=new StringParameter(this,"String_Node_Str");
  probabilityDistribution.setExpression("String_Node_Str");
  probabilityDistribution.addChoice("String_Node_Str");
  _overRunThusFar=0.0;
}

Fixed version (ground truth):
/** 
 * Construct an instance with the specified container and name.
 * @param container The container.
 * @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 GiottoTimingManager(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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  SingletonParameter hideName=new SingletonParameter(this,"String_Node_Str");
  hideName.setToken(BooleanToken.TRUE);
  hideName.setVisibility(Settable.EXPERT);
  seed=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  seed.setTypeEquals(BaseType.LONG);
  resetOnEachRun=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  resetOnEachRun.setTypeEquals(BaseType.BOOLEAN);
  probabilityDistribution=new StringParameter(this,"String_Node_Str");
  probabilityDistribution.setExpression("String_Node_Str");
  probabilityDistribution.addChoice("String_Node_Str");
  _overRunThusFar=0.0;
  _totalExpectedExecutionTime=_getDirectorPeriod(container);
  _totalObservedExecutionTime=0;
  NamedObj parentContainer=getContainer().getContainer();
  if (parentContainer != null) {
    if (parentContainer.getFullName().contains("String_Node_Str")) {
      if (_debugging) {
        _debug("String_Node_Str" + parentContainer.getFullName());
      }
      setModelErrorHandler(parentContainer);
    }
  }
}
Program: 73534
Project: 73534
Buggy source:
public void preinitialize() throws IllegalActionException {
  double wcet=0;
  double _periodValue=0;
  wcet=_getDirectorWCET(container);
  _periodValue=_getDirectorPeriod(container);
  if (_debugging) {
    _debug("String_Node_Str" + wcet + "String_Node_Str"+ _periodValue);
  }
  if (wcet > _periodValue) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    throw new IllegalActionException(container,"String_Node_Str" + wcet + "String_Node_Str"+ _periodValue+ "String_Node_Str"+ ((CompositeActor)(getContainer())).getDisplayName());
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
}

Fixed version (ground truth):
public void preinitialize() throws IllegalActionException {
  double wcet=0;
  double _periodValue=0;
  wcet=_getDirectorWCET(container);
  _periodValue=_getDirectorPeriod(container);
  GiottoScheduler scheduler=(GiottoScheduler)((GiottoDirector)((CompositeActor)container).getDirector()).getScheduler();
  _schedule=scheduler.getSchedule();
  if (_debugging) {
    _debug("String_Node_Str" + wcet + "String_Node_Str"+ _periodValue);
  }
  if (wcet > _periodValue) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    throw new IllegalActionException(container,"String_Node_Str" + wcet + "String_Node_Str"+ _periodValue+ "String_Node_Str"+ ((CompositeActor)(getContainer())).getDisplayName());
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
}
Program: 73535
Project: 73535
Buggy source:
public boolean postfire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  _needNew=true;
  double actorExecutionTimes=0;
  double actorWorstCaseExecutionTimes=0;
  List<Actor> entities=((CompositeActor)container).deepEntityList();
  for (  Actor actor : entities) {
    Attribute executionTime=((Entity)actor).getAttribute("String_Node_Str");
    Attribute WCET=((Entity)actor).getAttribute("String_Node_Str");
    try {
      actorWorstCaseExecutionTimes+=((DoubleToken)((Variable)WCET).getToken()).doubleValue();
      actorExecutionTimes+=((DoubleToken)((Variable)executionTime).getToken()).doubleValue();
    }
 catch (    IllegalActionException ex) {
      ex.printStackTrace();
    }
  }
  if (_debugging) {
    _debug("String_Node_Str" + actorExecutionTimes + "String_Node_Str"+ actorWorstCaseExecutionTimes);
  }
  if (actorExecutionTimes > actorWorstCaseExecutionTimes) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    System.out.println("String_Node_Str");
    handleModelError(container,new IllegalActionException(container,"String_Node_Str" + actorExecutionTimes + "String_Node_Str"+ actorWorstCaseExecutionTimes+ "String_Node_Str"+ container.getDisplayName()));
  }
  ChangeRequest request=new ChangeRequest(this,"String_Node_Str",true){
    protected void _execute() throws IllegalActionException {
    }
  }
;
  request.setPersistent(false);
  requestChange(request);
  if (_debugging) {
    _debug("String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
public boolean postfire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  _needNew=true;
  if (_debugging) {
    _debug("String_Node_Str" + _totalObservedExecutionTime + "String_Node_Str"+ _totalExpectedExecutionTime);
  }
  if (_totalObservedExecutionTime > _totalExpectedExecutionTime) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    if (_debugging) {
      _debug("String_Node_Str");
    }
    handleModelError(container,new IllegalActionException(container,"String_Node_Str" + _totalObservedExecutionTime + "String_Node_Str"+ _totalExpectedExecutionTime+ "String_Node_Str"+ container.getDisplayName()));
  }
  _totalObservedExecutionTime=0;
  ChangeRequest request=new ChangeRequest(this,"String_Node_Str",true){
    protected void _execute() throws IllegalActionException {
    }
  }
;
  request.setPersistent(false);
  requestChange(request);
  if (_debugging) {
    _debug("String_Node_Str");
  }
  return true;
}
Program: 73536
Project: 73536
Buggy source:
/** 
 * Generate the next random number.
 * @exception IllegalActionException If a call to nextDouble() throws an IllegalActionException
 */
protected void _generateRandomNumber() throws IllegalActionException {
  _current=_random.nextDouble();
}

Fixed version (ground truth):
/** 
 * Generate the next random number.
 * @exception IllegalActionException Not thrown in this base class.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  _current=_random.nextDouble();
}
Program: 73538
Project: 73538
Buggy source:
/** 
 * Construct a server on the port specified by <tt>portNo</tt>.
 * @param portNo Port number for BSD socket.
 * @param timOut Socket time out in milliseconds.
 * @exception IOException If the server socket cannot be opened.
 */
public Server(int portNo,int timOut) throws IOException {
  serSoc=new ServerSocket(portNo);
  flaFroCli=0;
  if (!serSoc.isBound()) {
    String em="String_Node_Str";
    throw new IOException(em);
  }
  serSoc.setSoTimeout(timOut);
}

Fixed version (ground truth):
/** 
 * Construct a server on the port specified by <tt>portNo</tt>.
 * @param portNo Port number for BSD socket.
 * @param timOut Socket time out in milliseconds.
 * @exception IOException If the server socket cannot be opened.
 */
public Server(int portNo,int timOut) throws IOException {
  serSoc=new ServerSocket();
  serSoc.bind(new java.net.InetSocketAddress(portNo));
  flaFroCli=0;
  if (!serSoc.isBound()) {
    String em="String_Node_Str";
    throw new IOException(em);
  }
  serSoc.setSoTimeout(timOut);
}
Program: 73539
Project: 73539
Buggy source:
/** 
 * Write data to the socket.
 * @param flagToClient The communication flag.
 * @param curTim The current simulation time.
 * @param dblVal The array with double values.
 * @exception IOException If a communication problems occur.
 */
public void write(int flagToClient,double curTim,double[] dblVal) throws IOException {
  simTimWri=curTim;
  final int nDbl=(dblVal != null) ? dblVal.length : 0;
  StringBuffer strBuf=new StringBuffer(Integer.toString(verNo));
  strBuf.append("String_Node_Str" + Integer.toString(flagToClient));
  strBuf.append("String_Node_Str" + Integer.toString(nDbl));
  strBuf.append("String_Node_Str");
  strBuf.append(curTim);
  strBuf.append("String_Node_Str");
  for (int i=0; i < nDbl; i++) {
    strBuf.append(String.valueOf(dblVal[i]));
    strBuf.append("String_Node_Str");
  }
  strBuf.append(System.getProperty("String_Node_Str"));
  _write(strBuf);
}

Fixed version (ground truth):
/** 
 * Write data to the socket.
 * @param flagToClient The communication flag.
 * @param curTim The current simulation time.
 * @param dblVal The array with double values.
 * @exception IOException If a communication problems occur.
 */
public void write(int flagToClient,double curTim,double[] dblVal) throws IOException {
  simTimWri=curTim;
  final int nDbl=(dblVal != null) ? dblVal.length : 0;
  StringBuffer strBuf=new StringBuffer(Integer.toString(verNo));
  strBuf.append("String_Node_Str" + Integer.toString(flagToClient));
  strBuf.append("String_Node_Str" + Integer.toString(nDbl));
  strBuf.append("String_Node_Str");
  strBuf.append(curTim);
  strBuf.append("String_Node_Str");
  for (int i=0; i < nDbl; i++) {
    strBuf.append(String.valueOf(dblVal[i]));
    strBuf.append("String_Node_Str");
  }
  strBuf.append("String_Node_Str");
  _write(strBuf);
}
Program: 73540
Project: 73540
Buggy source:
/** 
 * Write the data to the socket.
 * @param strBuf The string buffer to be sent to the socket.
 * @exception IOException If communication problems occur.
 */
private void _write(StringBuffer strBuf) throws IOException {
  BufferedWriter wr=new BufferedWriter(new OutputStreamWriter(cliSoc.getOutputStream()));
  wr.write(new String(strBuf));
  wr.flush();
}

Fixed version (ground truth):
/** 
 * Write the data to the socket.
 * @param strBuf The string buffer to be sent to the socket.
 * @exception IOException If communication problems occur.
 */
private void _write(StringBuffer strBuf) throws IOException {
  BufferedWriter wr=new BufferedWriter(new OutputStreamWriter(cliSoc.getOutputStream()));
  final String str=new String(strBuf);
  final int maxCha=8192;
  final int strLen=str.length();
  final int nWri=strLen / maxCha + 1;
  for (int i=0; i < nWri; i++) {
    wr.write(str.substring(i * maxCha,java.lang.Math.min(strLen,(i + 1) * maxCha)));
    wr.flush();
  }
}
Program: 73541
Project: 73541
Buggy source:
/** 
 * Construct an instance with the specified container and name.
 * @param container The container.
 * @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 GiottoTimingManager(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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  SingletonParameter hideName=new SingletonParameter(this,"String_Node_Str");
  hideName.setToken(BooleanToken.TRUE);
  hideName.setVisibility(Settable.EXPERT);
  seed=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  seed.setTypeEquals(BaseType.LONG);
  resetOnEachRun=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  resetOnEachRun.setTypeEquals(BaseType.BOOLEAN);
  probabilityDistribution=new StringParameter(this,"String_Node_Str");
  probabilityDistribution.setExpression("String_Node_Str");
  probabilityDistribution.addChoice("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an instance with the specified container and name.
 * @param container The container.
 * @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 GiottoTimingManager(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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  SingletonParameter hideName=new SingletonParameter(this,"String_Node_Str");
  hideName.setToken(BooleanToken.TRUE);
  hideName.setVisibility(Settable.EXPERT);
  seed=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  seed.setTypeEquals(BaseType.LONG);
  resetOnEachRun=new SharedParameter(this,"String_Node_Str",GiottoTimingManager.class,"String_Node_Str");
  resetOnEachRun.setTypeEquals(BaseType.BOOLEAN);
  probabilityDistribution=new StringParameter(this,"String_Node_Str");
  probabilityDistribution.setExpression("String_Node_Str");
  probabilityDistribution.addChoice("String_Node_Str");
  _overRunThusFar=0.0;
}
Program: 73542
Project: 73542
Buggy source:
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (_needNewGenerator) {
    _createGenerator();
  }
  if (_needNew) {
    _generateRandomNumber();
    _needNew=false;
  }
  List<Actor> entities=((CompositeActor)container).deepEntityList();
  for (  Actor actor : entities) {
    if (_debugging) {
      _debug("String_Node_Str" + actor.getName());
    }
    double actorWCET;
    Attribute executionTime=((Entity)actor).getAttribute("String_Node_Str");
    Attribute WCET=((Entity)actor).getAttribute("String_Node_Str");
    actorWCET=((DoubleToken)((Variable)WCET).getToken()).doubleValue();
    double t=_random.nextDouble() * 2 * actorWCET;
    Parameter dummyP=(Parameter)executionTime;
    dummyP.setExpression(Double.toString(t));
  }
  if (_debugging) {
    _debug("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (_needNewGenerator) {
    _createGenerator();
  }
  if (_needNew) {
    _generateRandomNumber();
    _needNew=false;
  }
  List<Actor> entities=((CompositeActor)container).deepEntityList();
  for (  Actor actor : entities) {
    _myPhysicalTime=actor.getDirector().getModelTime().getDoubleValue() + _overRunThusFar;
    if (_debugging) {
      _debug("String_Node_Str" + actor.getName());
    }
    double actorWCET;
    Attribute executionTime=((Entity)actor).getAttribute("String_Node_Str");
    Attribute WCET=((Entity)actor).getAttribute("String_Node_Str");
    actorWCET=((DoubleToken)((Variable)WCET).getToken()).doubleValue();
    double t=_random.nextDouble() * 2 * actorWCET;
    if (t > actorWCET) {
      _overRunThusFar+=(t - actorWCET);
      _myPhysicalTime+=t;
      System.out.println("String_Node_Str" + actorWCET + "String_Node_Str"+ t);
      System.out.println("String_Node_Str" + (actor.getDirector().getModelTime().getDoubleValue() + actorWCET) + "String_Node_Str"+ _myPhysicalTime);
    }
    Parameter dummyP=(Parameter)executionTime;
    dummyP.setExpression(Double.toString(t));
  }
  if (_debugging) {
    _debug("String_Node_Str" + "String_Node_Str");
  }
}
Program: 73543
Project: 73543
Buggy source:
/** 
 * Generate the next random number.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  _current=_random.nextDouble();
}

Fixed version (ground truth):
/** 
 * Generate the next random number.
 * @exception IllegalActionException If a call to nextDouble() throws an IllegalActionException
 */
protected void _generateRandomNumber() throws IllegalActionException {
  _current=_random.nextDouble();
}
Program: 73545
Project: 73545
Buggy source:
/** 
 * Return the string representation of this monotonicity concept. Note that the syntax here is similar to that used for records (e.g. { x:Monotonic, y:Anitmonotonic }).
 * @return The string representation of this concept.
 */
public String toString(){
  StringBuffer result=new StringBuffer("String_Node_Str");
  for (  String key : _variableToMonotonicity.keySet()) {
    result.append(' ');
    result.append(key);
    result.append(':');
    result.append(getMonotonicity(key));
    result.append(',');
  }
  result.deleteCharAt(result.length() - 1);
  result.append("String_Node_Str");
  return result.toString();
}

Fixed version (ground truth):
/** 
 * Return the string representation of this monotonicity concept. Note that the syntax here is similar to that used for records (e.g. { x:Monotonic, y:Anitmonotonic }).
 * @return The string representation of this concept.
 */
public String toString(){
  StringBuffer result=new StringBuffer("String_Node_Str");
  for (  String key : _variableToMonotonicity.keySet()) {
    result.append(' ');
    result.append(key);
    result.append(':');
    result.append(getMonotonicity(key));
    result.append(',');
  }
  if (result.charAt(result.length() - 1) == ',') {
    result.deleteCharAt(result.length() - 1);
  }
  result.append("String_Node_Str");
  return result.toString();
}
Program: 73546
Project: 73546
Buggy source:
/** 
 * Initialize the variables of this relation. 
 */
private void _init() throws IllegalActionException, NameDuplicationException {
  annotation=new StringParameter(this,"String_Node_Str");
  annotation.setExpression("String_Node_Str");
  Variable variable=new Variable(annotation,"String_Node_Str");
  variable.setExpression("String_Node_Str");
  variable.setPersistent(false);
  exitAngle=new Parameter(this,"String_Node_Str");
  exitAngle.setVisibility(Settable.NONE);
  exitAngle.setExpression("String_Node_Str");
  exitAngle.setTypeEquals(BaseType.DOUBLE);
}

Fixed version (ground truth):
/** 
 * Initialize the variables of this relation.
 * @throws IllegalActionException Thrown if the relation's variablescannot be initialized.
 * @throws NameDuplicationException Thrown if any of the names of attributescreated for this relation conflict with existing attributes in this relation.
 */
private void _init() throws IllegalActionException, NameDuplicationException {
  annotation=new StringParameter(this,"String_Node_Str");
  annotation.setExpression("String_Node_Str");
  Variable variable=new Variable(annotation,"String_Node_Str");
  variable.setExpression("String_Node_Str");
  variable.setPersistent(false);
  exitAngle=new Parameter(this,"String_Node_Str");
  exitAngle.setVisibility(Settable.NONE);
  exitAngle.setExpression("String_Node_Str");
  exitAngle.setTypeEquals(BaseType.DOUBLE);
}
Program: 73547
Project: 73547
Buggy source:
/** 
 * Set the property of specified object equal to the specified property.
 * @param object The specified object.
 * @param property The specified property.
 */
public void setEquals(Object object,Concept property){
  _solver.setResolvedConcept(object,property);
  _solver.markAsNonSettable(object);
}

Fixed version (ground truth):
/** 
 * Set the property of specified object equal to the specified property.
 * @param object The specified object.
 * @param property The specified property.
 */
public void setEquals(Object object,Concept property){
  _solver.setConcept(object,property);
  _solver.markAsNonSettable(object);
}
Program: 73548
Project: 73548
Buggy source:
/** 
 * Show all concept values as text annotations on each model element.
 * @throws IllegalActionException If getting the resolved concept fails.
 */
public void showConceptAnnotations() throws IllegalActionException {
  OntologySolver solver=(OntologySolver)getContainer();
  for (  Object propertyable : solver.getAllPropertyables()) {
    if (propertyable instanceof NamedObj) {
      Concept concept=solver.getResolvedConcept(propertyable,false);
      if (concept != null) {
        String request="String_Node_Str" + concept.toString() + "String_Node_Str";
        MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)propertyable,request,false);
        ((NamedObj)propertyable).requestChange(change);
      }
    }
  }
  solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Show all concept values as text annotations on each model element.
 * @throws IllegalActionException If getting the resolved concept fails.
 */
public void showConceptAnnotations() throws IllegalActionException {
  OntologySolver solver=(OntologySolver)getContainer();
  for (  Object propertyable : solver.getAllPropertyables()) {
    if (propertyable instanceof NamedObj) {
      Concept concept=solver.getConcept(propertyable);
      if (concept != null) {
        String request="String_Node_Str" + concept.toString() + "String_Node_Str";
        MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)propertyable,request,false);
        ((NamedObj)propertyable).requestChange(change);
      }
    }
  }
  solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
}
Program: 73549
Project: 73549
Buggy source:
/** 
 * Remove the highlighting and visible annotations for all property-able objects.
 * @param colors True if the highlight colors should be cleared.
 * @param text True if the ontology concept annotation text should be cleared.
 * @throws IllegalActionException If getting the resolved concept fails.
 */
public void clearDisplay(boolean colors,boolean text) throws IllegalActionException {
  if (colors || text) {
    OntologySolver solver=(OntologySolver)getContainer();
    for (    Object propertyable : solver.getAllPropertyables()) {
      if (propertyable instanceof NamedObj) {
        Concept concept=solver.getResolvedConcept(propertyable,false);
        if (concept != null || ((((NamedObj)propertyable).getAttribute("String_Node_Str") != null) && colors || (((NamedObj)propertyable).getAttribute("String_Node_Str") != null) && text)) {
          String request="String_Node_Str";
          if (((NamedObj)propertyable).getAttribute("String_Node_Str") != null && text) {
            request+="String_Node_Str";
          }
          if (((NamedObj)propertyable).getAttribute("String_Node_Str") != null && colors) {
            request+="String_Node_Str";
          }
          request+="String_Node_Str";
          MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)propertyable,request,false);
          ((NamedObj)propertyable).requestChange(change);
        }
      }
    }
    solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Remove the highlighting and visible annotations for all property-able objects.
 * @param colors True if the highlight colors should be cleared.
 * @param text True if the ontology concept annotation text should be cleared.
 * @throws IllegalActionException If getting the resolved concept fails.
 */
public void clearDisplay(boolean colors,boolean text) throws IllegalActionException {
  if (colors || text) {
    OntologySolver solver=(OntologySolver)getContainer();
    for (    Object propertyable : solver.getAllPropertyables()) {
      if (propertyable instanceof NamedObj) {
        Concept concept=solver.getConcept(propertyable);
        if (concept != null || ((((NamedObj)propertyable).getAttribute("String_Node_Str") != null) && colors || (((NamedObj)propertyable).getAttribute("String_Node_Str") != null) && text)) {
          String request="String_Node_Str";
          if (((NamedObj)propertyable).getAttribute("String_Node_Str") != null && text) {
            request+="String_Node_Str";
          }
          if (((NamedObj)propertyable).getAttribute("String_Node_Str") != null && colors) {
            request+="String_Node_Str";
          }
          request+="String_Node_Str";
          MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)propertyable,request,false);
          ((NamedObj)propertyable).requestChange(change);
        }
      }
    }
    solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
  }
}
Program: 73550
Project: 73550
Buggy source:
/** 
 * Highlight concepts that have already been resolved, but do not run solver. Otherwise, do nothing.
 * @param objects The set of objects to highlight.
 */
public void highlightConcepts(Set<Object> objects){
  if (objects != null) {
    OntologySolver solver=(OntologySolver)getContainer();
    for (    Object object : objects) {
      if (object instanceof NamedObj) {
        Concept concept=solver.getResolvedConcept(object,false);
        if (concept != null) {
          List<ColorAttribute> colors=concept.attributeList(ColorAttribute.class);
          if (colors != null && colors.size() > 0) {
            ColorAttribute conceptColor=colors.get(0);
            String request="String_Node_Str" + "String_Node_Str" + conceptColor.getExpression() + "String_Node_Str";
            MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)object,request,false);
            ((NamedObj)object).requestChange(change);
          }
        }
      }
    }
    solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Highlight concepts that have already been resolved, but do not run solver. Otherwise, do nothing.
 * @param objects The set of objects to highlight.
 */
public void highlightConcepts(Set<Object> objects){
  if (objects != null) {
    OntologySolver solver=(OntologySolver)getContainer();
    for (    Object object : objects) {
      if (object instanceof NamedObj) {
        Concept concept=solver.getConcept(object);
        if (concept != null) {
          List<ColorAttribute> colors=concept.attributeList(ColorAttribute.class);
          if (colors != null && colors.size() > 0) {
            ColorAttribute conceptColor=colors.get(0);
            String request="String_Node_Str" + "String_Node_Str" + conceptColor.getExpression() + "String_Node_Str";
            MoMLChangeRequest change=new MoMLChangeRequest(this,(NamedObj)object,request,false);
            ((NamedObj)object).requestChange(change);
          }
        }
      }
    }
    solver.requestChange(new MoMLChangeRequest(this,solver,"String_Node_Str"));
  }
}
Program: 73551
Project: 73551
Buggy source:
/** 
 * Invoke the solver directly, with a choice as to whether or not this  solver should display its resolved concepts.
 * @param displayProperties  True if the solver should display its properties; false otherwise (for example, if it is called from another solver)
 * @return True if the invocation succeeds; otherwise false which means anerror has occurred during the process.
 */
public boolean invokeSolver(boolean displayProperties){
  boolean success=false;
  try {
    initialize();
    resolveConcepts();
    updateConcepts();
    checkErrors();
    if (displayProperties) {
      displayConcepts();
    }
  }
 catch (  KernelException e) {
    resetAll();
    throw new InternalErrorException(e);
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Invoke the solver directly, with a choice as to whether or not this  solver should display its resolved concepts.
 * @param displayProperties  True if the solver should display its properties; false otherwise (for example, if it is called from another solver)
 * @return True if the invocation succeeds; otherwise false which means anerror has occurred during the process.
 */
public boolean invokeSolver(boolean displayProperties){
  boolean success=false;
  try {
    initialize();
    resolveConcepts();
    checkErrors();
    if (displayProperties) {
      displayConcepts();
    }
  }
 catch (  KernelException e) {
    reset();
    throw new InternalErrorException(e);
  }
  return success;
}
Program: 73552
Project: 73552
Buggy source:
/** 
 * Reset the solver. This removes the internal states of the solver (e.g. previously recorded properties, statistics, etc.).  It also removes this solver from the list of ran solvers.
 */
public void reset(){
  super.reset();
  _ontologySolverUtilities.removeRanSolver(this);
}

Fixed version (ground truth):
/** 
 * Reset the solver. This removes the internal states of the solver (e.g. previously recorded properties, statistics, etc.).  It also removes this solver from the list of ran solvers.
 */
public void reset(){
  super.reset();
}
Program: 73553
Project: 73553
Buggy source:
/** 
 * Return the concept value associated with the specified object.
 * @param object The specified object.
 * @return The property of the specified object.
 */
public Concept getConcept(Object object){
  return getResolvedConcept(object,false);
}

Fixed version (ground truth):
/** 
 * Return the concept value associated with the specified object.
 * @param object The specified object.
 * @return The property of the specified object.
 */
public Concept getConcept(Object object){
  return _resolvedProperties.get(object);
}
Program: 73554
Project: 73554
Buggy source:
/** 
 * Perform property resolution.
 * @exception KernelException Thrown if sub-class throws it.
 */
public abstract void resolveConcepts() throws KernelException ;

Fixed version (ground truth):
/** 
 * Execute the OntologySolver's algorithm to resolve which Concepts in the Ontology are assigned to each object in the model.
 * @throws KernelException If the ontology resolution fails.
 */
public abstract void resolveConcepts() throws KernelException ;
Program: 73555
Project: 73555
Buggy source:
/** 
 * Reset the solver.  
 */
public void reset(){
  _resolvedProperties=new HashMap<Object,Concept>();
  _nonSettables=new HashSet<Object>();
  _adapterStore=new HashMap<Object,OntologyAdapter>();
}

Fixed version (ground truth):
/** 
 * Reset the solver.  
 */
public void reset(){
  _resolvedProperties=new HashMap<Object,Concept>();
  _nonSettables=new HashSet<Object>();
  _adapterStore=new HashMap<Object,OntologyAdapter>();
  _resetParser();
  getOntologySolverUtilities().resetAll();
}
Program: 73556
Project: 73556
Buggy source:
/** 
 * Return true if the product lattice ontology is a lattice. If all the component onotlogies are lattices, then the product lattice ontology will also be a lattice. This is determined by the complete partial order for this lattice.
 * @return true if the product lattice ontology is a lattice, falseotherwise.
 * @see #getGraph()
 * @see ProductLatticeCPO
 */
public boolean isLattice(){
  CPO ontologyCPO=getGraph();
  if (ontologyCPO != null) {
    return ontologyCPO.isLattice();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Return true if the product lattice ontology is a lattice. If all the component onotlogies are lattices, then the product lattice ontology will also be a lattice. This is determined by the complete partial order for this lattice.
 * @return true if the product lattice ontology is a lattice, falseotherwise.
 * @see #getGraph()
 * @see ProductLatticeCPO
 */
public boolean isLattice(){
  CPO ontologyCPO=getConceptGraph();
  if (ontologyCPO != null) {
    return ontologyCPO.isLattice();
  }
 else {
    return false;
  }
}