nus-yam/ex-repair huggingface dataset:
Program: 72448
Project: 72448
Buggy source:
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  if (input.hasToken(0)) {
    Token observationArray=input.get(0);
    _classificationLength=((ArrayToken)observationArray).length();
    if (((ArrayToken)observationArray).getElementType().isCompatible(BaseType.DOUBLE)) {
      _observations=new double[_classificationLength][1];
      for (int i=0; i < _classificationLength; i++) {
        _observations[i][0]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
      }
    }
 else {
      int obsDim=((ArrayToken)((ArrayToken)observationArray).getElement(0)).length();
      _observations=new double[_classificationLength][obsDim];
      for (int i=0; i < _classificationLength; i++) {
        for (int j=0; j < obsDim; j++) {
          _observations[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)observationArray).getElement(i)).getElement(j)).doubleValue();
        }
      }
    }
  }
 else {
    _observations=null;
  }
}

Fixed version (ground truth):
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  if (input.hasToken(0)) {
    Token observationArray=input.get(0);
    _classificationLength=((ArrayToken)observationArray).length();
    if (((ArrayToken)observationArray).getElementType().isCompatible(BaseType.DOUBLE)) {
      _observations=new double[_classificationLength][1];
      for (int i=0; i < _classificationLength; i++) {
        _observations[i][0]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
      }
    }
 else     if (((ArrayToken)observationArray).getElementType().isCompatible(BaseType.INT)) {
      _observations=new double[_classificationLength][1];
      for (int i=0; i < _classificationLength; i++) {
        _observations[i][0]=((IntToken)((ArrayToken)observationArray).getElement(i)).intValue();
      }
    }
 else {
      int obsDim=((ArrayToken)((ArrayToken)observationArray).getElement(0)).length();
      _observations=new double[_classificationLength][obsDim];
      for (int i=0; i < _classificationLength; i++) {
        for (int j=0; j < obsDim; j++) {
          _observations[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)observationArray).getElement(i)).getElement(j)).doubleValue();
        }
      }
    }
  }
 else {
    _observations=null;
  }
}
Program: 72449
Project: 72449
Buggy source:
@Override public void fire() throws IllegalActionException {
  super.fire();
  if (input.hasToken(0)) {
    Token observationArray=input.get(0);
    int _observationLength=((ArrayToken)observationArray).length();
    if (_observationLength <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _observationLength + "String_Node_Str");
    }
    if (((ArrayToken)observationArray).getElementType().equals(BaseType.DOUBLE)) {
      _observations=new double[_observationLength][1];
      for (int i=0; i < _observationLength; i++) {
        _observations[i][0]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
      }
    }
 else {
      int observationDimension=((ArrayToken)((ArrayToken)observationArray).getElement(0)).length();
      _observations=new double[_observationLength][observationDimension];
      for (int i=0; i < _observationLength; i++) {
        for (int j=0; j < observationDimension; j++) {
          _observations[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)observationArray).getElement(i)).getElement(j)).doubleValue();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void fire() throws IllegalActionException {
  super.fire();
  if (input.hasToken(0)) {
    Token observationArray=input.get(0);
    int _observationLength=((ArrayToken)observationArray).length();
    _obsDimension=1;
    if (_observationLength <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _observationLength + "String_Node_Str");
    }
    if (((ArrayToken)observationArray).getElementType().equals(BaseType.DOUBLE)) {
      _observations=new double[_observationLength][1];
      for (int i=0; i < _observationLength; i++) {
        _observations[i][0]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
      }
    }
 else     if (((ArrayToken)observationArray).getElementType().equals(BaseType.INT)) {
      _observations=new double[_observationLength][1];
      for (int i=0; i < _observationLength; i++) {
        _observations[i][0]=((IntToken)((ArrayToken)observationArray).getElement(i)).intValue();
      }
    }
 else {
      int observationDimension=((ArrayToken)((ArrayToken)observationArray).getElement(0)).length();
      _obsDimension=observationDimension;
      _observations=new double[_observationLength][_obsDimension];
      for (int i=0; i < _observationLength; i++) {
        for (int j=0; j < observationDimension; j++) {
          _observations[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)observationArray).getElement(i)).getElement(j)).doubleValue();
        }
      }
    }
  }
}
Program: 72451
Project: 72451
Buggy source:
/** 
 * Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace.
 * @param container Container of this director.
 * @param name Name of this director.
 * @exception IllegalActionException If the name has a period in it, orthe director is not compatible with the specified container.
 * @exception NameDuplicationException If the container is not aCompositeActor and the name collides with an entity in the container.
 */
public FMIMADirector(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
}

Fixed version (ground truth):
public FMIMADirector(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  _isFirstFire=true;
}
Program: 72452
Project: 72452
Buggy source:
/** 
 * Fire actors according to events in the event queue. The actual selecting which events to process is done in _fire(). _fire() will return whether the previous firing was successful. According to this information, it is decided whether _fire() should be called again in order to keep processing events. After each actor firing, book keeping procedures are called, to keep track of the current state of the scheduler. The model time of the next events are also checked to see if we have produced an event of smaller timestamp.
 * @see #_fire
 * @exception IllegalActionException If we couldn't process an eventor if an event of smaller timestamp is found within the event queue.
 */
@Override public void fire() throws IllegalActionException {
}

Fixed version (ground truth):
@Override public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (getModelTime().getDoubleValue() > getStopTime()) {
    stop();
  }
  super.fire();
  if (_debugging) {
    _debug("String_Node_Str");
  }
  Time proposedFmiTime=getModelTime().add(1E-8);
  Nameable container=getContainer();
  Iterator<?> actors=((CompositeActor)container).deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof TimeRegulator) {
      Time modifiedTime=((TimeRegulator)actor).proposeTime(proposedFmiTime);
      if (proposedFmiTime.compareTo(modifiedTime) > 0) {
        proposedFmiTime=modifiedTime;
      }
      if (_debugging) {
        _debug("String_Node_Str" + actor.getFullName() + "String_Node_Str"+ modifiedTime.getLongValue()+ "String_Node_Str"+ getModelTime());
      }
    }
  }
  if (_debugging) {
    _debug("String_Node_Str" + proposedFmiTime);
  }
}
Program: 72453
Project: 72453
Buggy source:
/** 
 * Close the UDP socket with a given port number.
 * @param port The port number.
 */
public void bind(int port){
  _socket.listen("String_Node_Str",port,new AsyncResultHandler<DatagramSocket>(){
    public void handle(    AsyncResult<DatagramSocket> asyncResult){
      if (asyncResult.succeeded()) {
        _socket.dataHandler(new Handler<DatagramPacket>(){
          public void handle(          DatagramPacket packet){
            _currentObj.callMember("String_Node_Str",packet.data().toString());
          }
        }
);
      }
 else {
        System.out.println("String_Node_Str" + asyncResult.cause());
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Close the UDP socket with a given port number.
 * @param port The port number.
 */
public void bind(int port){
  _socket.listen(port,"String_Node_Str",new AsyncResultHandler<DatagramSocket>(){
    public void handle(    AsyncResult<DatagramSocket> asyncResult){
      if (asyncResult.succeeded()) {
        _socket.handler(new Handler<DatagramPacket>(){
          public void handle(          DatagramPacket packet){
            _currentObj.callMember("String_Node_Str",packet.data().toString());
          }
        }
);
      }
 else {
        System.out.println("String_Node_Str" + asyncResult.cause());
      }
    }
  }
);
}
Program: 72454
Project: 72454
Buggy source:
private UDPSocketHelper(ScriptObjectMirror currentObj){
  super(currentObj);
  _currentObj=currentObj;
  _socket=_vertx.createDatagramSocket(InternetProtocolFamily.IPv4);
}

Fixed version (ground truth):
private UDPSocketHelper(ScriptObjectMirror currentObj){
  super(currentObj);
  _currentObj=currentObj;
  _socket=_vertx.createDatagramSocket();
}
Program: 72455
Project: 72455
Buggy source:
/** 
 * Send a UDP message.
 * @param data An array of bytes to be sent.  Currently Ignored.
 * @param offset The offset. Current Ignored.
 * @param length The length of the message. Currently Ignored.
 * @param port The port.  Currently Ignored.
 * @param hostname The hostname.  Currently Ignored.
 */
public void send(byte[] data,int offset,int length,int port,String hostname){
  Buffer buffer=new Buffer("String_Node_Str");
  _socket.send(buffer,"String_Node_Str",1234,new AsyncResultHandler<DatagramSocket>(){
    public void handle(    AsyncResult<DatagramSocket> asyncResult){
      System.out.println("String_Node_Str" + asyncResult.succeeded());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Send a UDP message.
 * @param data An array of bytes to be sent.  Currently Ignored.
 * @param offset The offset. Current Ignored.
 * @param length The length of the message. Currently Ignored.
 * @param port The port.  Currently Ignored.
 * @param hostname The hostname.  Currently Ignored.
 */
public void send(byte[] data,int offset,int length,int port,String hostname){
  Buffer buffer=Buffer.buffer("String_Node_Str");
  _socket.send(buffer,1234,"String_Node_Str",new Handler<AsyncResult<DatagramSocket>>(){
    public void handle(    AsyncResult<DatagramSocket> asyncResult){
      System.out.println("String_Node_Str" + asyncResult.succeeded());
    }
  }
);
}
Program: 72456
Project: 72456
Buggy source:
/** 
 * Register subscriber handler at vertx bus.
 * @param address The address on the bus that should be suscribed to.
 */
public void registerHandler(String address){
  JsonObject message=new JsonObject().put("String_Node_Str","String_Node_Str").put("String_Node_Str",address);
  _webSocket.writeTextFrame(message.encode());
}

Fixed version (ground truth):
/** 
 * Register subscriber handler at vertx bus.
 * @param address The address on the bus that should be suscribed to.
 */
public void registerHandler(String address){
  JsonObject message=new JsonObject().put("String_Node_Str","String_Node_Str").put("String_Node_Str",address);
  _webSocket.writeFinalTextFrame(message.encode());
}
Program: 72457
Project: 72457
Buggy source:
/** 
 * Establish a connection to the event bus, if not already connected.
 */
public void connect(){
  if (!_wsIsOpen) {
    try {
      _httpClient.connectWebsocket("String_Node_Str",new Handler<WebSocket>(){
        @Override public void handle(        WebSocket websocket){
          _wsIsOpen=true;
          _webSocket=websocket;
          _currentObj.callMember("String_Node_Str","String_Node_Str");
          _webSocket.dataHandler(new DataHandler());
          _webSocket.endHandler(new EndHandler());
          _webSocket.exceptionHandler(new ExceptionHandler());
          _periodicPing=_vertx.setPeriodic(5000,new Handler<Long>(){
            @Override public void handle(            Long timerID){
              JsonObject json=new JsonObject().put("String_Node_Str","String_Node_Str");
              try {
                _sendTextFrame(json);
              }
 catch (              IllegalActionException e) {
                _currentObj.callMember("String_Node_Str","String_Node_Str");
              }
            }
          }
);
        }
      }
);
    }
 catch (    Exception e) {
      _currentObj.callMember("String_Node_Str","String_Node_Str","String_Node_Str");
      System.out.println(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Establish a connection to the event bus, if not already connected.
 */
public void connect(){
  if (!_wsIsOpen) {
    try {
      _httpClient.websocket("String_Node_Str",new Handler<WebSocket>(){
        @Override public void handle(        WebSocket websocket){
          _wsIsOpen=true;
          _webSocket=websocket;
          _currentObj.callMember("String_Node_Str","String_Node_Str");
          _webSocket.handler(new DataHandler());
          _webSocket.endHandler(new EndHandler());
          _webSocket.exceptionHandler(new ExceptionHandler());
          _periodicPing=_vertx.setPeriodic(5000,new Handler<Long>(){
            @Override public void handle(            Long timerID){
              JsonObject json=new JsonObject().put("String_Node_Str","String_Node_Str");
              try {
                _sendTextFrame(json);
              }
 catch (              IllegalActionException e) {
                _currentObj.callMember("String_Node_Str","String_Node_Str");
              }
            }
          }
);
        }
      }
);
    }
 catch (    Exception e) {
      _currentObj.callMember("String_Node_Str","String_Node_Str","String_Node_Str");
      System.out.println(e);
    }
  }
}
Program: 72458
Project: 72458
Buggy source:
/** 
 * Private constructor for WebSocketHelper for a server-side web socket.
 * @param currentObj The JavaScript instance of Socket that this helps.
 * @param serverWebSocket The server-side web socket, provided by the web socket server.
 * @param receiveType The type to assume for incoming messages.
 * @param sendType The type for outgoing messages.
 * @param maxFrameSize The maximum frame size for a received message.
 */
private WebSocketHelper(ScriptObjectMirror currentObj,WebSocketBase serverWebSocket,String receiveType,String sendType,int maxFrameSize){
  super(currentObj);
  _webSocket=serverWebSocket;
  _wsIsOpen=true;
  _maxFrameSize=maxFrameSize;
  _webSocket.dataHandler(new DataHandler());
  _webSocket.endHandler(new EndHandler());
  _webSocket.exceptionHandler(new WebSocketExceptionHandler());
  _webSocket.closeHandler(new WebSocketCloseHandler());
  _receiveType=receiveType;
  _sendType=sendType;
}

Fixed version (ground truth):
/** 
 * Private constructor for WebSocketHelper for a server-side web socket.
 * @param currentObj The JavaScript instance of Socket that this helps.
 * @param serverWebSocket The server-side web socket, provided by the web socket server.
 * @param receiveType The type to assume for incoming messages.
 * @param sendType The type for outgoing messages.
 * @param maxFrameSize The maximum frame size for a received message.
 */
private WebSocketHelper(ScriptObjectMirror currentObj,WebSocketBase serverWebSocket,String receiveType,String sendType,int maxFrameSize){
  super(currentObj);
  _webSocket=serverWebSocket;
  _wsIsOpen=true;
  _maxFrameSize=maxFrameSize;
  _webSocket.handler(new DataHandler());
  _webSocket.endHandler(new EndHandler());
  _webSocket.exceptionHandler(new WebSocketExceptionHandler());
  _webSocket.closeHandler(new WebSocketCloseHandler());
  _receiveType=receiveType;
  _sendType=sendType;
}
Program: 72459
Project: 72459
Buggy source:
/** 
 * Send the specified message over the websocket.
 * @param message The message.
 */
protected void _sendMessageOverSocket(Object message){
  if (message instanceof String) {
    message=new Buffer((String)message);
  }
  if (!(message instanceof Buffer)) {
    _currentObj.callMember("String_Node_Str","String_Node_Str","String_Node_Str" + message.getClass() + "String_Node_Str");
    return;
  }
  _webSocket.write((Buffer)message);
  if (_webSocket.writeQueueFull()) {
    _webSocket.pause();
    _webSocket.drainHandler(new VoidHandler(){
      public void handle(){
        _webSocket.resume();
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Send the specified message over the websocket.
 * @param message The message.
 */
protected void _sendMessageOverSocket(Object message){
  if (message instanceof String) {
    message=Buffer.buffer((String)message);
  }
  if (!(message instanceof Buffer)) {
    _currentObj.callMember("String_Node_Str","String_Node_Str","String_Node_Str" + message.getClass() + "String_Node_Str");
    return;
  }
  _webSocket.write((Buffer)message);
  if (_webSocket.writeQueueFull()) {
    _webSocket.pause();
    _webSocket.drainHandler(new VoidHandler(){
      public void handle(){
        _webSocket.resume();
      }
    }
);
  }
}
Program: 72460
Project: 72460
Buggy source:
/** 
 * Connect to a web socket on the specified host.
 * @param host The host IP or name.
 * @param port The port.
 * @param client The HttpClient object.
 */
private void _connectWebsocket(String host,int port,HttpClient client){
  String address="String_Node_Str" + host + "String_Node_Str"+ port;
  client.connectWebsocket(address,new Handler<WebSocket>(){
    @Override public void handle(    WebSocket websocket){
synchronized (_actor) {
        if (_numberOfTries < 0) {
          websocket.close();
          return;
        }
        if (!_actor.isExecuting()) {
          websocket.close();
          return;
        }
        _wsIsOpen=true;
        _webSocket=websocket;
        _webSocket.dataHandler(new DataHandler());
        _webSocket.endHandler(new EndHandler());
        _webSocket.exceptionHandler(new WebSocketExceptionHandler());
        _webSocket.closeHandler(new WebSocketCloseHandler());
        _currentObj.callMember("String_Node_Str","String_Node_Str");
        _currentObj.callMember("String_Node_Str","String_Node_Str");
        if (_pendingOutputs != null && _pendingOutputs.size() > 0) {
          for (          Object message : _pendingOutputs) {
            _sendMessageOverSocket(message);
          }
          _pendingOutputs.clear();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Connect to a web socket on the specified host.
 * @param host The host IP or name.
 * @param port The port.
 * @param client The HttpClient object.
 */
private void _connectWebsocket(String host,int port,HttpClient client){
  client.websocket(port,host,"String_Node_Str",new Handler<WebSocket>(){
    @Override public void handle(    WebSocket websocket){
synchronized (_actor) {
        if (_numberOfTries < 0) {
          websocket.close();
          return;
        }
        if (!_actor.isExecuting()) {
          websocket.close();
          return;
        }
        _wsIsOpen=true;
        _webSocket=websocket;
        _webSocket.handler(new DataHandler());
        _webSocket.endHandler(new EndHandler());
        _webSocket.exceptionHandler(new WebSocketExceptionHandler());
        _webSocket.closeHandler(new WebSocketCloseHandler());
        _currentObj.callMember("String_Node_Str","String_Node_Str");
        _currentObj.callMember("String_Node_Str","String_Node_Str");
        if (_pendingOutputs != null && _pendingOutputs.size() > 0) {
          for (          Object message : _pendingOutputs) {
            _sendMessageOverSocket(message);
          }
          _pendingOutputs.clear();
        }
      }
    }
  }
);
}
Program: 72464
Project: 72464
Buggy source:
/** 
 * Recusively applies   {@link #_applyLayout(KNode)} to any {@link KNode} that has further children.
 * @param parentNode The KIELER graph object containing all layout informationto apply to the Ptolemy model
 * @exception IllegalActionException if routing of edges fails.
 */
private void _recursivelyApplyLayout(KNode parentNode) throws IllegalActionException {
  if (!parentNode.getChildren().isEmpty()) {
    _applyLayout(parentNode);
    for (    KNode child : parentNode.getChildren()) {
      if (!child.getChildren().isEmpty()) {
        _recursivelyApplyLayout(child);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Recusively applies   {@link #_applyLayout(KNode)} to any {@link KNode} that has further children.
 * @param parentNode The KIELER graph object containing all layout informationto apply to the Ptolemy model
 * @param layoutRequest the common layout request for the current layout run
 * @exception IllegalActionException if routing of edges fails.
 */
private void _recursivelyApplyLayout(KNode parentNode,ApplyLayoutRequest layoutRequest) throws IllegalActionException {
  if (!parentNode.getChildren().isEmpty()) {
    _applyLayout(parentNode,layoutRequest);
    for (    KNode child : parentNode.getChildren()) {
      if (!child.getChildren().isEmpty()) {
        _recursivelyApplyLayout(child,layoutRequest);
      }
    }
  }
}
Program: 72467
Project: 72467
Buggy source:
/** 
 * If the argument is any parameter other than <i>stateVariableNames</i> <i>t</i>, or any parameter matching an input port, then request reinitialization.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the numerator and thedenominator matrix is not a row vector.
 */
@Override public void attributeChanged(Attribute attribute) throws IllegalActionException {
  _upToDate=false;
  if (attribute instanceof Parameter && attribute != t) {
    TypedIOPort port=(TypedIOPort)getPort(attribute.getName());
    if (port == null || !port.isInput()) {
      _requestInitialization();
    }
  }
}

Fixed version (ground truth):
/** 
 * If the argument is any parameter other than <i>stateVariableNames</i> <i>t</i>, or any parameter matching an input port, then request reinitialization.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the numerator and thedenominator matrix is not a row vector.
 */
@Override public void attributeChanged(Attribute attribute) throws IllegalActionException {
  super.attributeChanged(attribute);
  _upToDate=false;
  if (attribute instanceof Parameter && attribute != t) {
    TypedIOPort port=(TypedIOPort)getPort(attribute.getName());
    if (port == null || !port.isInput()) {
      _requestInitialization();
    }
  }
}
Program: 72468
Project: 72468
Buggy source:
private void _setSigmaPoints(SigmaPoint[] points,double[] mean_state,double[][] covariance_matrix) throws IllegalActionException {
  double[][] sqrt_covariance_matrix=new double[covariance_matrix.length][covariance_matrix[0].length];
  choleskyDecomposition(covariance_matrix,sqrt_covariance_matrix);
  points[0].setValue(mean_state);
  double weight=Math.sqrt(_kai + _stateSpaceSize);
  for (int i=1; i < points.length; i++) {
    int col_id=(i - 1) / 2;
    double weight_sign=weight;
    if ((i - 1) % 2 == 1)     weight_sign=-weight;
    for (int p_it=0; p_it < _stateSpaceSize; p_it++) {
      points[i]._x_hat[p_it]=points[0]._x_hat[p_it] + weight_sign * sqrt_covariance_matrix[p_it][col_id];
    }
  }
}

Fixed version (ground truth):
private void _setSigmaPoints(SigmaPoint[] points,double[] mean_state,double[][] covariance_matrix) throws IllegalActionException {
  double[][] sqrt_covariance_matrix=new double[covariance_matrix.length][covariance_matrix[0].length];
  choleskyDecomposition(covariance_matrix,sqrt_covariance_matrix);
  points[0].setValue(mean_state);
  double weight=Math.sqrt(_kai + _stateSpaceSize);
  for (int i=1; i < points.length; i+=2) {
    int col_id=(i - 1) / 2;
    for (int p_it=0; p_it < _stateSpaceSize; p_it++) {
      points[i]._x_hat[p_it]=points[0]._x_hat[p_it] + weight * sqrt_covariance_matrix[p_it][col_id];
      points[i + 1]._x_hat[p_it]=points[0]._x_hat[p_it] - weight * sqrt_covariance_matrix[p_it][col_id];
    }
  }
}
Program: 72469
Project: 72469
Buggy source:
/** 
 * Return the origin of the figure in the enclosing transform context.  This overrides the base class to return the center of the shape, if the figure is centered, or the origin of the shape if the figure is not centered.
 * @return The origin of the figure.
 */
@Override public Point2D getOrigin(){
  if (_centered) {
    return super.getOrigin();
  }
 else {
    Point2D point=new Point2D.Double(0,0);
    _transform.transform(point,point);
    return point;
  }
}

Fixed version (ground truth):
/** 
 * Return the origin of the figure in the enclosing transform context.  This overrides the base class to return the center of the shape, if the figure is centered, or the origin of the shape if the figure is not centered.
 * @return The origin of the figure.
 */
@Override public Point2D getOrigin(){
  if (_centered) {
    Point2D point=super.getOrigin();
    _transform.transform(point,point);
    return point;
  }
 else {
    Point2D point=new Point2D.Double(0,0);
    _transform.transform(point,point);
    return point;
  }
}
Program: 72470
Project: 72470
Buggy source:
/** 
 * Specify whether the figure should be centered on its origin. By default, it is.
 * @param centered False to make the origin of the figure, asreturned by getOrigin(), be the upper left corner.
 * @see #getOrigin()
 */
public void setCentered(boolean centered){
  if (_centered=centered) {
    return;
  }
  repaint();
  Point2D point=getOrigin();
  _centered=centered;
  CanvasUtilities.translateTo(this,point.getX(),point.getY());
}

Fixed version (ground truth):
/** 
 * Specify whether the figure should be centered on its origin. By default, it is.
 * @param centered False to make the origin of the figure, asreturned by getOrigin(), be the upper left corner.
 * @see #getOrigin()
 */
public void setCentered(boolean centered){
  if (_centered == centered) {
    return;
  }
  repaint();
  Point2D point=getOrigin();
  _centered=centered;
  CanvasUtilities.translateTo(this,point.getX(),point.getY());
  repaint();
}
Program: 72473
Project: 72473
Buggy source:
/** 
 * Create an edit menu.
 */
protected void _addMenus(){
  _editMenu=new JMenu("String_Node_Str");
  _editMenu.setMnemonic(KeyEvent.VK_E);
  _menubar.add(_editMenu);
  GUIUtilities.addMenuItem(_editMenu,new UndoAction());
  GUIUtilities.addMenuItem(_editMenu,new RedoAction());
  _editMenu.addSeparator();
  GUIUtilities.addMenuItem(_editMenu,new CutAction());
  GUIUtilities.addMenuItem(_editMenu,new CopyAction());
  GUIUtilities.addMenuItem(_editMenu,new PasteAction());
  _editMenu.addSeparator();
  GUIUtilities.addMenuItem(_editMenu,_findAction);
}

Fixed version (ground truth):
/** 
 * Create an edit menu.
 */
protected void _addMenus(){
  super._addMenus();
  _editMenu=new JMenu("String_Node_Str");
  _editMenu.setMnemonic(KeyEvent.VK_E);
  _menubar.add(_editMenu);
  GUIUtilities.addMenuItem(_editMenu,new UndoAction());
  GUIUtilities.addMenuItem(_editMenu,new RedoAction());
  _editMenu.addSeparator();
  GUIUtilities.addMenuItem(_editMenu,new CutAction());
  GUIUtilities.addMenuItem(_editMenu,new CopyAction());
  GUIUtilities.addMenuItem(_editMenu,new PasteAction());
  _editMenu.addSeparator();
  GUIUtilities.addMenuItem(_editMenu,_findAction);
}
Program: 72474
Project: 72474
Buggy source:
/** 
 * Create a simple one-line text display, a non-editable value that is set externally using the setDisplay() method.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param theValue Default string to display.
 * @param background The background color, or null to use defaults.
 * @param foreground The foreground color, or null to use defaults.
 * @return The text area that displays the value.
 */
public JTextArea addDisplay(String name,String label,String theValue,Color background,Color foreground){
  JLabel lbl=_constructLabel(label);
  lbl.setBackground(_background);
  JTextArea displayField=new JTextArea(theValue,1,10);
  displayField.setEditable(false);
  if (background == null) {
    background=_background;
  }
  if (foreground == null) {
    foreground=Color.BLACK;
  }
  displayField.setBackground(background);
  _addPair(name,lbl,displayField,displayField);
  return displayField;
}

Fixed version (ground truth):
/** 
 * Create a simple one-line text display, a non-editable value that is set externally using the setDisplay() method.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param theValue Default string to display.
 * @param background The background color, or null to use defaults.
 * @param foreground The foreground color, or null to use defaults.
 * @return The text area that displays the value.
 */
public JTextArea addDisplay(String name,String label,String theValue,Color background,Color foreground){
  JLabel lbl=_constructLabel(label);
  lbl.setBackground(_background);
  JTextArea displayField=new JTextArea(theValue,1,10);
  displayField.setEditable(false);
  if (background == null) {
    background=_background;
  }
  displayField.setBackground(background);
  _addPair(name,lbl,displayField,displayField);
  return displayField;
}
Program: 72475
Project: 72475
Buggy source:
/** 
 * Remember the edit and update the action state.
 * @param event The event that occurred.
 */
@Override public void undoableEditHappened(UndoableEditEvent event){
  if (_compoundEdit == null) {
    _undo.addEdit(event.getEdit());
    _undoAction._updateUndoState();
    _redoAction._updateRedoState();
  }
 else {
    _compoundEdit.addEdit(event.getEdit());
  }
}

Fixed version (ground truth):
/** 
 * Remember the edit and update the action state.
 * @param event The event that occurred.
 */
@Override public synchronized void undoableEditHappened(UndoableEditEvent event){
  if (_compoundEdit == null) {
    _undo.addEdit(event.getEdit());
    _undoAction._updateUndoState();
    _redoAction._updateRedoState();
  }
 else {
    _compoundEdit.addEdit(event.getEdit());
  }
}
Program: 72476
Project: 72476
Buggy source:
/** 
 * Invoke the specified function, then schedule another call to this same method after the specified number of milliseconds, using the specified id for the timeout function.
 * @param function The function to repeatedly invoke.
 * @param milliseconds The number of milliseconds in a period.
 * @param id The id to use for the timeout function.
 */
private void _runThenReschedule(final Runnable function,final int milliseconds,final Integer id){
  function.run();
  if (_pendingTimeoutFunctions.get(id) == null) {
    return;
  }
  final Runnable reschedulingFunction=new Runnable(){
    @Override public void run(){
      _runThenReschedule(function,milliseconds,id);
    }
  }
;
  try {
    _setTimeout(reschedulingFunction,milliseconds,id);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(this,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Invoke the specified function, then schedule another call to this same method after the specified number of milliseconds, using the specified id for the timeout function.
 * @param function The function to repeatedly invoke.
 * @param milliseconds The number of milliseconds in a period.
 * @param id The id to use for the timeout function.
 */
private synchronized void _runThenReschedule(final Runnable function,final int milliseconds,final Integer id){
  function.run();
  if (_pendingTimeoutFunctions.get(id) == null) {
    return;
  }
  final Runnable reschedulingFunction=new Runnable(){
    @Override public void run(){
      _runThenReschedule(function,milliseconds,id);
    }
  }
;
  try {
    _setTimeout(reschedulingFunction,milliseconds,id);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(this,e,"String_Node_Str");
  }
}
Program: 72477
Project: 72477
Buggy source:
/** 
 * Invoke any input handlers that have been added if there are new inputs.
 * @see #addInputHandler(Runnable)
 */
public void invokeHandlers(){
  if (_inputHandlers != null && _hasNewInput) {
    for (    Runnable function : _inputHandlers) {
      if (function != null) {
        function.run();
        if (_debugging) {
          _debug("String_Node_Str" + _port.getName());
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Invoke any input handlers that have been added if there are new inputs.
 * @see #addInputHandler(Runnable)
 */
public void invokeHandlers(){
synchronized (JavaScript.this) {
    if (_inputHandlers != null && _hasNewInput) {
      for (      Runnable function : _inputHandlers) {
        if (function != null) {
          function.run();
          if (_debugging) {
            _debug("String_Node_Str" + _port.getName());
          }
        }
      }
    }
  }
}
Program: 72479
Project: 72479
Buggy source:
/** 
 * Invoke the specified function, then schedule another call to this same method after the specified number of milliseconds, using the specified id for the timeout function.
 * @param function The function to repeatedly invoke.
 * @param milliseconds The number of milliseconds in a period.
 * @param id The id to use for the timeout function.
 */
private void _runThenReschedule(final Runnable function,final int milliseconds,final Integer id){
  function.run();
  final Runnable reschedulingFunction=new Runnable(){
    @Override public void run(){
      _runThenReschedule(function,milliseconds,id);
    }
  }
;
  try {
    _setTimeout(reschedulingFunction,milliseconds,id);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(this,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Invoke the specified function, then schedule another call to this same method after the specified number of milliseconds, using the specified id for the timeout function.
 * @param function The function to repeatedly invoke.
 * @param milliseconds The number of milliseconds in a period.
 * @param id The id to use for the timeout function.
 */
private void _runThenReschedule(final Runnable function,final int milliseconds,final Integer id){
  function.run();
  if (_pendingTimeoutFunctions.get(id) == null) {
    return;
  }
  final Runnable reschedulingFunction=new Runnable(){
    @Override public void run(){
      _runThenReschedule(function,milliseconds,id);
    }
  }
;
  try {
    _setTimeout(reschedulingFunction,milliseconds,id);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(this,e,"String_Node_Str");
  }
}
Program: 72484
Project: 72484
Buggy source:
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public HMMGaussianClassifier(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  mean=new PortParameter(this,"String_Node_Str");
  mean.setExpression("String_Node_Str");
  StringAttribute cardinality=new StringAttribute(mean.getPort(),"String_Node_Str");
  cardinality.setExpression("String_Node_Str");
  standardDeviation=new PortParameter(this,"String_Node_Str");
  standardDeviation.setExpression("String_Node_Str");
  cardinality=new StringAttribute(standardDeviation.getPort(),"String_Node_Str");
  cardinality.setExpression("String_Node_Str");
  _nStates=((ArrayToken)mean.getToken()).length();
}

Fixed version (ground truth):
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public HMMGaussianClassifier(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  mean=new PortParameter(this,"String_Node_Str");
  mean.setExpression("String_Node_Str");
  StringAttribute cardinality=new StringAttribute(mean.getPort(),"String_Node_Str");
  cardinality.setExpression("String_Node_Str");
  covariance=new PortParameter(this,"String_Node_Str");
  covariance.setExpression("String_Node_Str");
  cardinality=new StringAttribute(covariance.getPort(),"String_Node_Str");
  cardinality.setExpression("String_Node_Str");
  _nStates=((ArrayToken)mean.getToken()).length();
}
Program: 72485
Project: 72485
Buggy source:
/** 
 * This method is called when a time advancement phase is performed. Every updated HLA attributes received by callbacks (from the RTI) during the time advancement phase is saved as   {@link TimedEvent} and stored in aqueue. Then, every  {@link TimedEvent}s are moved from this queue to the output port of their corresponding   {@link HLASubscriber} actors
 * @throws IllegalActionException If the parent class throws it.
 */
private void _putReflectedAttributesOnHlaSubscribers() throws IllegalActionException {
  TimedEvent event;
  Iterator<Entry<String,LinkedList<TimedEvent>>> it=_fromFederationEvents.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry<String,LinkedList<TimedEvent>> elt=it.next();
    LinkedList<TimedEvent> events=elt.getValue();
    while (events.size() > 0) {
      event=events.get(0);
      String identity=elt.getKey();
      TypedIOPort tiop=_getPortFromTab(_hlaAttributesSubscribedTo.get(identity));
      HlaSubscriber hs=(HlaSubscriber)tiop.getContainer();
      hs.putReflectedHlaAttribute(event);
      if (_debugging) {
        _debug(this.getDisplayName() + "String_Node_Str" + "String_Node_Str"+ event.toString()+ "String_Node_Str"+ hs.getDisplayName());
      }
      events.removeFirst();
    }
  }
}

Fixed version (ground truth):
/** 
 * This method is called when a time advancement phase is performed. Every updated HLA attributes received by callbacks (from the RTI) during the time advancement phase is saved as   {@link TimedEvent} and stored in aqueue. Then, every  {@link TimedEvent}s are moved from this queue to the output port of their corresponding   {@link HLASubscriber} actors
 * @exception IllegalActionException If the parent class throws it.
 */
private void _putReflectedAttributesOnHlaSubscribers() throws IllegalActionException {
  TimedEvent event;
  Iterator<Entry<String,LinkedList<TimedEvent>>> it=_fromFederationEvents.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry<String,LinkedList<TimedEvent>> elt=it.next();
    LinkedList<TimedEvent> events=elt.getValue();
    while (events.size() > 0) {
      event=events.get(0);
      String identity=elt.getKey();
      TypedIOPort tiop=_getPortFromTab(_hlaAttributesSubscribedTo.get(identity));
      HlaSubscriber hs=(HlaSubscriber)tiop.getContainer();
      hs.putReflectedHlaAttribute(event);
      if (_debugging) {
        _debug(this.getDisplayName() + "String_Node_Str" + "String_Node_Str"+ event.toString()+ "String_Node_Str"+ hs.getDisplayName());
      }
      events.removeFirst();
    }
  }
}
Program: 72486
Project: 72486
Buggy source:
/** 
 * The method   {@link #_populatedHlaValueTables()} populates the tablescontaining information of HLA attributes required to publish and to subscribe value attributes in a HLA Federation.
 * @throws IllegalActionException If a HLA attribute is declared twice.
 */
private void _populateHlaAttributeTables() throws IllegalActionException {
  CompositeActor ca=(CompositeActor)this.getContainer();
  _hlaAttributesToPublish.clear();
  List<HlaPublisher> _hlaPublishers=ca.entityList(HlaPublisher.class);
  for (  HlaPublisher hp : _hlaPublishers) {
    if (_hlaAttributesToPublish.get(hp.getName()) != null) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    TypedIOPort tiop=hp.inputPortList().get(0);
    _hlaAttributesToPublish.put(hp.getName(),new Object[]{tiop,tiop.getType(),((StringToken)((Parameter)hp.getAttribute("String_Node_Str")).getToken()).stringValue()});
  }
  _hlaAttributesSubscribedTo.clear();
}

Fixed version (ground truth):
/** 
 * The method   {@link #_populatedHlaValueTables()} populates the tablescontaining information of HLA attributes required to publish and to subscribe value attributes in a HLA Federation.
 * @exception IllegalActionException If a HLA attribute is declared twice.
 */
private void _populateHlaAttributeTables() throws IllegalActionException {
  CompositeActor ca=(CompositeActor)this.getContainer();
  _hlaAttributesToPublish.clear();
  List<HlaPublisher> _hlaPublishers=ca.entityList(HlaPublisher.class);
  for (  HlaPublisher hp : _hlaPublishers) {
    if (_hlaAttributesToPublish.get(hp.getName()) != null) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    TypedIOPort tiop=hp.inputPortList().get(0);
    _hlaAttributesToPublish.put(hp.getName(),new Object[]{tiop,tiop.getType(),((StringToken)((Parameter)hp.getAttribute("String_Node_Str")).getToken()).stringValue()});
  }
  _hlaAttributesSubscribedTo.clear();
}
Program: 72489
Project: 72489
Buggy source:
/** 
 * Initialize the   {@link PtolemyFederateAmbassadorInner} which handlesthe communication from RTI -> to RTIA -> to FEDERATE. The <i>rtia</i> manages the interaction with the external communicant process RTIA. This method called the Declaration Management services provide by HLA/CERTI to publish/subscribe to HLA attributes in a HLA Federation.
 * @param rtia
 * @throws NameNotFound
 * @throws ObjectClassNotDefined
 * @throws FederateNotExecutionMember
 * @throws RTIinternalError
 * @throws AttributeNotDefined
 * @throws SaveInProgress
 * @throws RestoreInProgress
 * @throws ConcurrentAccessAttempted All those exceptions are from the HLA/CERTI implementation.
 */
public void initialize(RTIambassador rtia) throws NameNotFound, ObjectClassNotDefined, FederateNotExecutionMember, RTIinternalError, AttributeNotDefined, SaveInProgress, RestoreInProgress, ConcurrentAccessAttempted {
  this.timeAdvanceGrant=false;
  this.timeConstrained=false;
  this.timeRegulator=false;
  this.synchronizationSuccess=false;
  this.synchronizationFailed=false;
  this.inPause=false;
  setUpHlaPublisher(rtia);
  setUpSubscription(rtia);
}

Fixed version (ground truth):
/** 
 * Initialize the   {@link PtolemyFederateAmbassadorInner} which handlesthe communication from RTI -> to RTIA -> to FEDERATE. The <i>rtia</i> manages the interaction with the external communicant process RTIA. This method called the Declaration Management services provide by HLA/CERTI to publish/subscribe to HLA attributes in a HLA Federation.
 * @param rtia
 * @exception NameNotFound
 * @exception ObjectClassNotDefined
 * @exception FederateNotExecutionMember
 * @exception RTIinternalError
 * @exception AttributeNotDefined
 * @exception SaveInProgress
 * @exception RestoreInProgress
 * @exception ConcurrentAccessAttempted All those exceptions are from the HLA/CERTI implementation.
 */
public void initialize(RTIambassador rtia) throws NameNotFound, ObjectClassNotDefined, FederateNotExecutionMember, RTIinternalError, AttributeNotDefined, SaveInProgress, RestoreInProgress, ConcurrentAccessAttempted {
  this.timeAdvanceGrant=false;
  this.timeConstrained=false;
  this.timeRegulator=false;
  this.synchronizationSuccess=false;
  this.synchronizationFailed=false;
  this.inPause=false;
  setUpHlaPublisher(rtia);
  setUpSubscription(rtia);
}
Program: 72493
Project: 72493
Buggy source:
/** 
 * Abstract class defining the emission probability computation of the latent variable.
 * @throws IllegalActionException
 */
protected abstract double emissionProbability(double[] y,int hiddenState) throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * Abstract class defining the emission probability computation of the latent variable.
 * @exception IllegalActionException
 */
protected abstract double emissionProbability(double[] y,int hiddenState) throws IllegalActionException ;
Program: 72494
Project: 72494
Buggy source:
/** 
 * One step EM iteration
 * @throws IllegalActionException
 */
protected abstract void _iterateEM() throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * One step EM iteration
 * @exception IllegalActionException
 */
protected abstract void _iterateEM() throws IllegalActionException ;
Program: 72496
Project: 72496
Buggy source:
/** 
 * Computes the emission probability. Implemented by the child class.
 * @param y input observation
 * @param hiddenState index of hidden state
 * @return P(Y=y | X=hiddenState)
 * @throws IllegalActionException
 */
protected abstract double emissionProbability(double[] y,int hiddenState) throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * Computes the emission probability. Implemented by the child class.
 * @param y input observation
 * @param hiddenState index of hidden state
 * @return P(Y=y | X=hiddenState)
 * @exception IllegalActionException
 */
protected abstract double emissionProbability(double[] y,int hiddenState) throws IllegalActionException ;
Program: 72497
Project: 72497
Buggy source:
/** 
 * Sample next state given current state.
 * @return Next state index.
 * @throws IllegalActionException
 */
protected abstract int _propagateState() throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * Sample next state given current state.
 * @return Next state index.
 * @exception IllegalActionException
 */
protected abstract int _propagateState() throws IllegalActionException ;
Program: 72498
Project: 72498
Buggy source:
/** 
 * Constructs a HSMMTimeAwareGenerator object.
 * @param container  a CompositeEntity object
 * @param name       a String ...
 * @throws NameDuplicationException ...
 * @throws IllegalActionException ...
 */
public HSMMTimeAwareGenerator(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  At=new PortParameter(this,"String_Node_Str");
  At.setExpression("String_Node_Str");
  samplingPeriod=new Parameter(this,"String_Node_Str");
  samplingPeriod.setExpression("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructs a HSMMTimeAwareGenerator object.
 * @param container  a CompositeEntity object
 * @param name       a String ...
 * @exception NameDuplicationException ...
 * @exception IllegalActionException ...
 */
public HSMMTimeAwareGenerator(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  At=new PortParameter(this,"String_Node_Str");
  At.setExpression("String_Node_Str");
  samplingPeriod=new Parameter(this,"String_Node_Str");
  samplingPeriod.setExpression("String_Node_Str");
}
Program: 72499
Project: 72499
Buggy source:
/** 
 * Send the learned matrix to the output.
 * @throws NoRoomException
 * @throws IllegalActionException
 */
public void _sendEmpiricalMatrix() throws NoRoomException, IllegalActionException {
  Token[] Atokens=new Token[NUM_CATEGORIES];
  for (int i=0; i < NUM_CATEGORIES; i++) {
    Atokens[i]=new DoubleMatrixToken(At[i]);
  }
  empiricalStartTimes.send(0,new ArrayToken(Atokens));
}

Fixed version (ground truth):
/** 
 * Send the learned matrix to the output.
 * @exception NoRoomException
 * @exception IllegalActionException
 */
public void _sendEmpiricalMatrix() throws NoRoomException, IllegalActionException {
  Token[] Atokens=new Token[NUM_CATEGORIES];
  for (int i=0; i < NUM_CATEGORIES; i++) {
    Atokens[i]=new DoubleMatrixToken(At[i]);
  }
  empiricalStartTimes.send(0,new ArrayToken(Atokens));
}