nus-yam/ex-repair huggingface dataset:
Program: 73202
Project: 73202
Buggy source:
/** 
 * Clone the director into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (It must be added by the user if he wants it to be there). The result is a new director with no container, no pending mutations, and no topology listeners. The count of active processes is zero.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException If one of the attributescannot be cloned.
 * @return The new PNDirector.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PNDirector newObject=(PNDirector)super.clone(workspace);
  newObject._readBlockedQueues=new HashMap();
  newObject._receivers=new LinkedList();
  newObject._writeBlockedQueues=new HashMap();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (It must be added by the user if he wants it to be there). The result is a new director with no container, no pending mutations, and no topology listeners. The count of active processes is zero.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException If one of the attributescannot be cloned.
 * @return The new PNDirector.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PNDirector newObject=(PNDirector)super.clone(workspace);
  newObject._processListeners=new LinkedList();
  newObject._readBlockedQueues=new HashMap();
  newObject._receivers=new LinkedList();
  newObject._writeBlockedQueues=new HashMap();
  return newObject;
}
Program: 73204
Project: 73204
Buggy source:
private static String printMemory(Pointer pointer,int size){
  final int BYTES_PER_ROW=4;
  String LS=System.getProperty("String_Node_Str");
  byte[] buf=pointer.getByteArray(0,size);
  StringBuffer contents=new StringBuffer(LS);
  for (int i=0; i < buf.length; i++) {
    if ((i % BYTES_PER_ROW) == 0) {
      contents.append("String_Node_Str");
    }
    if (buf[i] >= 0 && buf[i] < 16) {
      contents.append("String_Node_Str");
    }
    contents.append(Integer.toHexString(buf[i] & 0xFF));
    if ((i % BYTES_PER_ROW) == BYTES_PER_ROW - 1 && i < buf.length - 1) {
      contents.append("String_Node_Str" + LS);
    }
  }
  contents.append("String_Node_Str");
  for (int i=0; i < buf.length; i++) {
    if ((i % BYTES_PER_ROW) == 0) {
      contents.append("String_Node_Str");
    }
    contents.append(new Character((char)(buf[i] & 0xff)));
    if ((i % BYTES_PER_ROW) == BYTES_PER_ROW - 1 && i < buf.length - 1) {
      contents.append("String_Node_Str" + LS);
    }
  }
  contents.append("String_Node_Str");
  return contents.toString();
}

Fixed version (ground truth):
private static String printMemory(Pointer pointer,int size){
  final int BYTES_PER_ROW=4;
  String LS=System.getProperty("String_Node_Str");
  byte[] buf=pointer.getByteArray(0,size);
  StringBuffer contents=new StringBuffer(LS);
  for (int i=0; i < buf.length; i++) {
    if ((i % BYTES_PER_ROW) == 0) {
      contents.append("String_Node_Str");
    }
    if (buf[i] >= 0 && buf[i] < 16) {
      contents.append("String_Node_Str");
    }
    contents.append(Integer.toHexString(buf[i] & 0xFF));
    if ((i % BYTES_PER_ROW) == BYTES_PER_ROW - 1 && i < buf.length - 1) {
      contents.append("String_Node_Str" + LS);
    }
  }
  contents.append("String_Node_Str");
  for (int i=0; i < buf.length; i++) {
    if ((i % BYTES_PER_ROW) == 0) {
      contents.append("String_Node_Str");
    }
    contents.append(Character.valueOf((char)(buf[i] & 0xff)));
    if ((i % BYTES_PER_ROW) == BYTES_PER_ROW - 1 && i < buf.length - 1) {
      contents.append("String_Node_Str" + LS);
    }
  }
  contents.append("String_Node_Str");
  return contents.toString();
}
Program: 73209
Project: 73209
Buggy source:
/** 
 * Send Token inside. Tokens received on this port are recordTokens. Only the payload of the RecordToken should be sent inside. 
 * @param channelIndex Channel token is sent to.
 * @param token Token to be sent.
 * @throws IllegalActionException If received token is not a record token with the fields timestamp, microstep and payload.
 */
public void sendInside(int channelIndex,Token token) throws IllegalActionException, NoRoomException {
  PtidesDirector director=(PtidesDirector)((CompositeActor)getContainer()).getDirector();
  if (!(token instanceof RecordToken) || ((RecordToken)token).labelSet().size() != 3) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
  RecordToken record=(RecordToken)token;
  Time recordTimeStamp=new Time(director,((DoubleToken)(record.get(timestamp))).doubleValue());
  int recordMicrostep=((IntToken)(record.get(microstep))).intValue();
  Receiver[][] farReceivers=deepGetReceivers();
  for (int i=0; i < farReceivers[channelIndex].length; i++) {
    director.addInputEvent(new PtidesEvent(this,channelIndex,recordTimeStamp,recordMicrostep,-1,(Token)record.get(payload),farReceivers[channelIndex][i]));
  }
}

Fixed version (ground truth):
/** 
 * Send Token inside. Tokens received on this port are recordTokens. Only the payload of the RecordToken should be sent inside. 
 * @param channelIndex Channel token is sent to.
 * @param token Token to be sent.
 * @throws IllegalActionException If received token is not a record token with the fields timestamp, microstep and payload.
 */
public void sendInside(int channelIndex,Token token) throws IllegalActionException, NoRoomException {
  PtidesDirector director=(PtidesDirector)((CompositeActor)getContainer()).getDirector();
  if (!(token instanceof RecordToken) || ((RecordToken)token).labelSet().size() != 3) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
  RecordToken record=(RecordToken)token;
  Time recordTimeStamp=new Time(director,((DoubleToken)(record.get(timestamp))).doubleValue());
  int recordMicrostep=((IntToken)(record.get(microstep))).intValue();
  Receiver[][] farReceivers=deepGetReceivers();
  for (int i=0; i < farReceivers[channelIndex].length; i++) {
    director.addInputEvent(new PtidesEvent(this,channelIndex,recordTimeStamp,recordMicrostep,-1,(Token)record.get(payload),farReceivers[channelIndex][i]),0);
  }
}
Program: 73211
Project: 73211
Buggy source:
/** 
 * If the attribute is <i>seed</i> or <i>useThisSeed</i>  then create the base random number generator.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container (not thrown in this base class).
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == seed) {
    long seedValue=((LongToken)(seed.getToken())).longValue();
    if (seedValue != _generatorSeed) {
      _needNewGenerator=true;
    }
  }
 else   if (attribute == privateSeed) {
    Token token=privateSeed.getToken();
    if (token != null) {
      long seedValue=((LongToken)token).longValue();
      if (seedValue != _generatorSeed) {
        _needNewGenerator=true;
      }
    }
 else {
      long seedValue=((LongToken)(seed.getToken())).longValue();
      if (seedValue != _generatorSeed) {
        _needNewGenerator=true;
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the attribute is <i>seed</i> or <i>useThisSeed</i>  then create the base random number generator.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container (not thrown in this base class).
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == seed || attribute == privateSeed) {
    long seedValue;
    Token privateSeedToken=privateSeed.getToken();
    if (privateSeedToken != null) {
      seedValue=((LongToken)privateSeedToken).longValue();
    }
 else {
      seedValue=((LongToken)seed.getToken()).longValue();
    }
    if (seedValue != _generatorSeed) {
      _needNewGenerator=true;
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 73212
Project: 73212
Buggy source:
/** 
 * Create the random number generator using current parameter values.
 * @exception IllegalActionException If thrown while reading theseed Token.
 */
protected void _createGenerator() throws IllegalActionException {
  long seedValue=((LongToken)(seed.getToken())).longValue();
  Token token=privateSeed.getToken();
  if (token != null) {
    seedValue=((LongToken)token).longValue();
    _generatorSeed=seedValue;
  }
 else {
    _generatorSeed=seedValue;
    if (seedValue == 0L) {
      seedValue=System.currentTimeMillis() + hashCode();
    }
 else {
      seedValue=seedValue + getFullName().hashCode();
    }
  }
  _random=new Random(seedValue);
  _needNewGenerator=false;
  _needNew=true;
}

Fixed version (ground truth):
/** 
 * Create the random number generator using current parameter values.
 * @exception IllegalActionException If thrown while reading theseed Token.
 */
protected void _createGenerator() throws IllegalActionException {
  long seedValue;
  Token privateSeedToken=privateSeed.getToken();
  if (privateSeedToken != null) {
    seedValue=((LongToken)privateSeedToken).longValue();
    _generatorSeed=seedValue;
  }
 else {
    seedValue=((LongToken)seed.getToken()).longValue();
    _generatorSeed=seedValue;
    if (seedValue == 0L) {
      seedValue=System.currentTimeMillis() + hashCode();
    }
 else {
      seedValue=seedValue + getFullName().hashCode();
    }
  }
  _random=new Random(seedValue);
  _needNewGenerator=false;
  _needNew=true;
}
Program: 73213
Project: 73213
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class has anattribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PlotterBase newObject=(PlotterBase)super.clone(workspace);
  newObject.plot=null;
  newObject._implementation=null;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class has anattribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PlotterBase newObject=(PlotterBase)super.clone(workspace);
  newObject.plot=null;
  newObject._implementation=null;
  try {
    newObject._getImplementation().initWindowAndSizeProperties();
  }
 catch (  KernelException e) {
    throw new CloneNotSupportedException("String_Node_Str" + e);
  }
  return newObject;
}
Program: 73214
Project: 73214
Buggy source:
/** 
 * Initialize the effigy of the plotter.
 * @exception IllegalActionException If there is a problem initializing the effigy
 */
public void initWindowAndSizeProperties() throws IllegalActionException, NameDuplicationException {
  _windowProperties=new WindowPropertiesAttribute(_plotterBase,"String_Node_Str");
  _windowProperties.setPersistent(true);
  _plotSize=new SizeAttribute(_plotterBase,"String_Node_Str");
  _plotSize.setPersistent(true);
}

Fixed version (ground truth):
/** 
 * Initialize the effigy of the plotter.
 * @exception IllegalActionException If there is a problem initializing the effigy
 */
public void initWindowAndSizeProperties() throws IllegalActionException, NameDuplicationException {
  _windowProperties=(WindowPropertiesAttribute)_plotterBase.getAttribute("String_Node_Str",WindowPropertiesAttribute.class);
  if (_windowProperties == null) {
    _windowProperties=new WindowPropertiesAttribute(_plotterBase,"String_Node_Str");
    _windowProperties.setPersistent(true);
  }
  _plotSize=(SizeAttribute)_plotterBase.getAttribute("String_Node_Str",SizeAttribute.class);
  if (_plotSize == null) {
    _plotSize=new SizeAttribute(_plotterBase,"String_Node_Str");
    _plotSize.setPersistent(true);
  }
}
Program: 73215
Project: 73215
Buggy source:
private void _requestFiringAt(Time time) throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str",getContainer().getName(),"String_Node_Str" + time);
  }
  fireContainerAt(time);
}

Fixed version (ground truth):
private void _requestFiringAt(Time time) throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str",getContainer().getName(),"String_Node_Str" + time);
  }
  fireContainerAt(time,1);
}
Program: 73216
Project: 73216
Buggy source:
/** 
 * Get the location in some cartesian coordinate system. This method returns the absolute location of the object. If the relative location was previously attached to an object referenced in the   {@link #relativeTo} property and that objectis gone, then the internally stored location is updated so it contains the correct absolute location.
 * @return The location.
 * @see #setLocation(double[])
 */
@Override public double[] getLocation(){
  double[] offset=super.getLocation();
  String relativeToValue=relativeTo.getExpression();
  if (relativeToValue.equals("String_Node_Str") || offset == null) {
    return offset;
  }
  double[] relativeToLocation=_getRelativeToLocation(relativeToValue);
  if (relativeToLocation != null) {
    double[] result=new double[offset.length];
    for (int i=0; i < offset.length; i++) {
      result[i]=offset[i] + relativeToLocation[i];
    }
    return result;
  }
  if (_cachedReltoLoc != null) {
    for (int i=0; i < offset.length; i++) {
      offset[i]+=_cachedReltoLoc[i];
    }
    _cachedReltoLoc=null;
  }
  return offset;
}

Fixed version (ground truth):
/** 
 * Get the location in some cartesian coordinate system. This method returns the absolute location of the object. If the relative location was previously attached to an object referenced in the   {@link #relativeTo} property and that objectis gone, then the internally stored location is updated so it contains the correct absolute location.
 * @return The location.
 * @see #setLocation(double[])
 */
@Override public double[] getLocation(){
  double[] offset=super.getLocation();
  NamedObj relativeToObject=getRelativeToNamedObj();
  if (relativeToObject == null || offset == null) {
    return offset;
  }
  double[] relativeToLocation=_getRelativeToLocation(relativeToObject);
  if (relativeToLocation != null) {
    double[] result=new double[offset.length];
    for (int i=0; i < offset.length; i++) {
      result[i]=offset[i] + relativeToLocation[i];
    }
    return result;
  }
  if (_cachedReltoLoc != null) {
    for (int i=0; i < offset.length; i++) {
      offset[i]+=_cachedReltoLoc[i];
    }
    _cachedReltoLoc=null;
  }
  return offset;
}
Program: 73217
Project: 73217
Buggy source:
/** 
 * Set the location in some cartesian coordinate system, and notify the container and any value listeners of the new location. Setting the location involves maintaining a local copy of the passed parameter. No notification is done if the location is the same as before. This method propagates the value to any derived objects. If the relative location is attached to an object referenced in the  {@link #relativeTo} property, then only the relative location isstored internally.
 * @param location The location.
 * @exception IllegalActionException Thrown when attributeChanged() is called.
 * @see #getLocation()
 */
@Override public void setLocation(double[] location) throws IllegalActionException {
  String relativeToValue=relativeTo.getExpression();
  if (relativeToValue.equals("String_Node_Str")) {
    super.setLocation(location);
  }
  double[] relativeToLocation=_getRelativeToLocation(relativeToValue);
  if (relativeToLocation != null) {
    double[] result=new double[location.length];
    for (int i=0; i < location.length; i++) {
      result[i]=location[i] - relativeToLocation[i];
    }
    super.setLocation(result);
    return;
  }
  _cachedReltoLoc=null;
  super.setLocation(location);
}

Fixed version (ground truth):
/** 
 * Set the location in some cartesian coordinate system, and notify the container and any value listeners of the new location. Setting the location involves maintaining a local copy of the passed parameter. No notification is done if the location is the same as before. This method propagates the value to any derived objects. If the relative location is attached to an object referenced in the  {@link #relativeTo} property, then only the relative location isstored internally.
 * @param location The location.
 * @exception IllegalActionException Thrown when attributeChanged() is called.
 * @see #getLocation()
 */
@Override public void setLocation(double[] location) throws IllegalActionException {
  NamedObj relativeToObject=getRelativeToNamedObj();
  if (relativeToObject == null) {
    super.setLocation(location);
    return;
  }
  double[] relativeToLocation=_getRelativeToLocation(relativeToObject);
  if (relativeToLocation != null) {
    double[] result=new double[location.length];
    for (int i=0; i < location.length; i++) {
      result[i]=location[i] - relativeToLocation[i];
    }
    super.setLocation(result);
    return;
  }
  _cachedReltoLoc=null;
  super.setLocation(location);
}
Program: 73218
Project: 73218
Buggy source:
/** 
 * If the <i>relativeTo</i> object exists, return its location. Otherwise, return null.
 * @param relativeToName The name of the relativeTo object.
 * @return The location of the relativeTo object, or null if itdoes not exist.
 */
private double[] _getRelativeToLocation(String relativeToName){
  NamedObj container=getContainer();
  if (container != null) {
    NamedObj containersContainer=container.getContainer();
    if (containersContainer instanceof CompositeEntity) {
      CompositeEntity composite=(CompositeEntity)containersContainer;
      String elementName=relativeToElementName.getExpression();
      NamedObj relativeToNamedObj;
      if (elementName.equals("String_Node_Str")) {
        relativeToNamedObj=composite.getAttribute(relativeToName);
      }
 else       if (elementName.equals("String_Node_Str")) {
        relativeToNamedObj=composite.getPort(relativeToName);
      }
 else       if (elementName.equals("String_Node_Str")) {
        relativeToNamedObj=composite.getRelation(relativeToName);
      }
 else {
        relativeToNamedObj=composite.getEntity(relativeToName);
      }
      if (relativeToNamedObj != null) {
        List<Locatable> locatables=relativeToNamedObj.attributeList(Locatable.class);
        if (locatables.size() > 0) {
          _cachedReltoLoc=locatables.get(0).getLocation();
          return _cachedReltoLoc;
        }
      }
    }
  }
  try {
    relativeTo.setExpression("String_Node_Str");
    relativeToElementName.setExpression("String_Node_Str");
  }
 catch (  IllegalActionException exception) {
    throw new InternalErrorException(exception);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * If the <i>relativeTo</i> object exists, return its location. Otherwise, return null.
 * @param relativeToObject The relativeTo object.
 * @return The location of the relativeTo object, or null if itdoes not exist.
 */
private double[] _getRelativeToLocation(NamedObj relativeToObject){
  List<Locatable> locatables=relativeToObject.attributeList(Locatable.class);
  if (locatables.size() > 0) {
    _cachedReltoLoc=locatables.get(0).getLocation();
    return _cachedReltoLoc;
  }
  return null;
}
Program: 73220
Project: 73220
Buggy source:
/** 
 * Create a text area with the specified height and width (in characters).
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param theValue The value of this text area.
 * @param background The background color.
 * @param foreground The foreground color.
 * @param height The height.
 * @param width The width.
 * @return The text area.
 */
public JTextArea addTextArea(String name,String label,String theValue,Color background,Color foreground,int height,int width){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JTextArea textArea=new JTextArea(theValue,height,width);
  textArea.setRows(Math.min(5,textArea.getLineCount()));
  textArea.setEditable(true);
  textArea.setBackground(background);
  textArea.setForeground(foreground);
  QueryScrollPane textPane=new QueryScrollPane(textArea);
  _addPair(name,lbl,textPane,textPane);
  textArea.addFocusListener(new QueryFocusListener(this,name));
  return textArea;
}

Fixed version (ground truth):
/** 
 * Create a text area with the specified height and width (in characters).
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param theValue The value of this text area.
 * @param background The background color.
 * @param foreground The foreground color.
 * @param height The height.
 * @param width The width.
 * @return The text area.
 */
public JTextArea addTextArea(String name,String label,String theValue,Color background,Color foreground,int height,int width){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JTextArea textArea=new JTextArea(theValue,height,width);
  textArea.setEditable(true);
  textArea.setBackground(background);
  textArea.setForeground(foreground);
  QueryScrollPane textPane=new QueryScrollPane(textArea);
  _addPair(name,lbl,textPane,textPane);
  textArea.addFocusListener(new QueryFocusListener(this,name));
  return textArea;
}
Program: 73221
Project: 73221
Buggy source:
/** 
 * Create a receiver to mediate a communication via the specified receiver. This receiver is linked to a specific port of the quantity manager.
 * @param receiver Receiver whose communication is to be mediated.
 * @param port Port of the quantity manager.
 * @return A new receiver.
 * @exception IllegalActionException If the receiver cannot be created.
 */
public IntermediateReceiver getReceiver(Receiver receiver,IOPort port) throws IllegalActionException {
  IntermediateReceiver intermediateReceiver=new IntermediateReceiver(this,receiver,port);
  if (((IOPort)receiver.getContainer()).isOutput()) {
    Receiver[][] result=new Receiver[1][1];
    List<Receiver[][]> occurrences=new LinkedList<Receiver[][]>();
    occurrences.add(result);
    HashMap<IORelation,List<Receiver[][]>> map=new HashMap<IORelation,List<Receiver[][]>>();
    map.put(new IORelation(),occurrences);
    ((IOPort)receiver.getContainer()).setLocalReceiversTable(map);
  }
 else {
    List<Receiver> list=_outputMappings.get(port);
    if (list == null) {
      list=new ArrayList();
    }
    if (!list.contains(receiver)) {
      list.add(receiver);
    }
    _outputMappings.put(port,list);
  }
  return intermediateReceiver;
}

Fixed version (ground truth):
/** 
 * Create a receiver to mediate a communication via the specified receiver. This receiver is linked to a specific port of the quantity manager.
 * @param receiver Receiver whose communication is to be mediated.
 * @param port Port of the quantity manager.
 * @return A new receiver.
 * @exception IllegalActionException If the receiver cannot be created.
 */
public IntermediateReceiver getReceiver(Receiver receiver,IOPort port) throws IllegalActionException {
  System.out.println(receiver + "String_Node_Str" + port+ "String_Node_Str"+ _outputMappings);
  if (_receiversInvalid) {
    _outputMappings.clear();
    _receiversInvalid=false;
  }
  IntermediateReceiver intermediateReceiver=new IntermediateReceiver(this,receiver,port);
  if (((IOPort)receiver.getContainer()).isOutput()) {
    Receiver[][] result=new Receiver[1][1];
    List<Receiver[][]> occurrences=new LinkedList<Receiver[][]>();
    occurrences.add(result);
    HashMap<IORelation,List<Receiver[][]>> map=new HashMap<IORelation,List<Receiver[][]>>();
    map.put(new IORelation(),occurrences);
    ((IOPort)receiver.getContainer()).setLocalReceiversTable(map);
  }
 else {
    List<Receiver> list=_outputMappings.get(port);
    if (list == null) {
      list=new ArrayList();
    }
 else {
      List<Receiver> copy=new ArrayList<Receiver>(list);
      for (      Receiver listReceiver : copy) {
        if (listReceiver.getContainer() == null) {
          list.remove(listReceiver);
        }
      }
    }
    if (!list.contains(receiver)) {
      list.add(receiver);
    }
    _outputMappings.put(port,list);
  }
  return intermediateReceiver;
}
Program: 73222
Project: 73222
Buggy source:
/** 
 * Close any open displays by calling place(null).
 */
private void _closeDisplays(){
  if (_model != null) {
    Iterator atomicEntities=_model.allAtomicEntityList().iterator();
    while (atomicEntities.hasNext()) {
      Object object=atomicEntities.next();
      if (object instanceof Placeable) {
        ((Placeable)object).place(null);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Close any open displays by calling place(null).
 */
private void _closeDisplays(){
  if (_model != null) {
    Iterator atomicEntities=_model.allAtomicEntityList().iterator();
    while (atomicEntities.hasNext()) {
      Object object=atomicEntities.next();
      if (object instanceof Placeable) {
        ((Placeable)object).place(null);
      }
 else       if (object instanceof PortablePlaceable) {
        ((PortablePlaceable)object).place(null);
      }
    }
  }
}
Program: 73223
Project: 73223
Buggy source:
/** 
 * Place the visual representation of the actor into the specified container.
 * @param container The container in which to place the object
 */
public void place(PortableContainer container){
  _textfield=new JTextField();
  _textfield.setText("String_Node_Str");
  container.add(_textfield);
  _textfield.setEditable(false);
}

Fixed version (ground truth):
/** 
 * Place the visual representation of the actor into the specified container.
 * @param container The container in which to place the object
 */
public void place(PortableContainer container){
  _textfield=new JTextField();
  _textfield.setText("String_Node_Str");
  if (container != null) {
    container.add(_textfield);
  }
  _textfield.setEditable(false);
}
Program: 73224
Project: 73224
Buggy source:
/** 
 * Set default constraints between the given object and a list of objects based on the given constraintType.  The given object is the sink and the list of objects are the sources.
 * @see ConstraintType
 * @param constraintType The given ConstraintType to be used for the default constraints
 * @param source The given object that represents the sink for the default constraints
 * @param sinkList The list of objects passed in as a {@linkplain List} thatrepresents the sources for the default constraints
 * @exception IllegalActionException If an exception is thrown
 */
protected void _constrainObject(ConstraintType constraintType,Object source,List sinkList) throws IllegalActionException {
  if (constraintType == null)   constraintType=ConstraintType.SOURCE_GE_SINK;
  for (  Object sink : sinkList) {
switch (constraintType) {
case NONE:
      break;
case EQUALS:
    setSameAs(source,sink);
  break;
case SINK_GE_SOURCE:
case SOURCE_GE_SINK:
setAtLeast(source,sink);
break;
}
}
}

Fixed version (ground truth):
/** 
 * Set default constraints between the given object and a list of objects based on the given constraintType.  The given object is the sink and the list of objects are the sources.
 * @see ConstraintType
 * @param constraintType The given ConstraintType to be used for the default constraints
 * @param sink The given object that represents the sink for the default constraints
 * @param sourceList The list of objects passed in as a {@linkplain List} thatrepresents the sources for the default constraints
 * @exception IllegalActionException If an exception is thrown
 */
protected void _constrainObject(ConstraintType constraintType,Object sink,List sourceList) throws IllegalActionException {
  if (constraintType == null)   constraintType=ConstraintType.SOURCE_GE_SINK;
  for (  Object source : sourceList) {
switch (constraintType) {
case NONE:
      break;
case EQUALS:
    setSameAs(source,sink);
  break;
case SINK_GE_SOURCE:
case SOURCE_GE_SINK:
setAtLeast(sink,source);
break;
}
}
}
Program: 73225
Project: 73225
Buggy source:
/** 
 * Add default constraints for the actor referred to by this OntologyAdapter based on the given ConstraintType.
 * @see ConstraintType
 * @param actorConstraintType The given ConstraintType for the default constraintsfor the actor referred to by this OntologyAdapter
 * @exception IllegalActionException If an exception is thrown
 */
protected void _addDefaultConstraints(ConstraintType actorConstraintType) throws IllegalActionException {
  if (!_useDefaultConstraints || !AtomicActor.class.isInstance(getComponent())) {
    return;
  }
  boolean constraintSource=actorConstraintType == ConstraintType.SOURCE_GE_SINK;
  List<IOPort> portList1=constraintSource ? ((AtomicActor)getComponent()).inputPortList() : ((AtomicActor)getComponent()).outputPortList();
  List<IOPort> portList2=constraintSource ? ((AtomicActor)getComponent()).outputPortList() : ((AtomicActor)getComponent()).inputPortList();
  Iterator<IOPort> ports=portList1.iterator();
  while (ports.hasNext()) {
    IOPort port=(IOPort)ports.next();
    _constrainObject(actorConstraintType,port,portList2);
  }
  boolean constrainPortConnectionSources=isConstraintSource();
  for (  TypedIOPort port : (List<TypedIOPort>)_getConstrainedPorts(constrainPortConnectionSources)) {
    if ((port).isMultiport() && (port).getWidth() > 1) {
      _constrainObject(interconnectConstraintType,port,_getConstraintingPorts(constrainPortConnectionSources,port));
    }
  }
}

Fixed version (ground truth):
/** 
 * Add default constraints for the actor referred to by this OntologyAdapter based on the given ConstraintType.
 * @see ConstraintType
 * @param actorConstraintType The given ConstraintType for the default constraintsfor the actor referred to by this OntologyAdapter
 * @exception IllegalActionException If an exception is thrown
 */
protected void _addDefaultConstraints(ConstraintType actorConstraintType) throws IllegalActionException {
  if (!_useDefaultConstraints || !AtomicActor.class.isInstance(getComponent())) {
    return;
  }
  if (interconnectConstraintType == null) {
    interconnectConstraintType=actorConstraintType;
  }
  List<IOPort> inputPorts=((AtomicActor)getComponent()).inputPortList();
  List<IOPort> outputPorts=((AtomicActor)getComponent()).outputPortList();
  _constrainObjectLists(actorConstraintType,inputPorts,outputPorts);
  for (  IOPort inputSink : inputPorts) {
    List<IOPort> previousOutputs=_getSourcePortList(inputSink);
    for (    IOPort source : previousOutputs) {
      _constrainSingleObject(interconnectConstraintType,source,inputSink);
    }
  }
}
Program: 73226
Project: 73226
Buggy source:
/** 
 * Initialize the solver:  Reset the solver (superclass) and then collect all of the initial constraints from the model.
 * @exception IllegalActionException If an exception occurs whencollecting the constraints.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  NamedObj toplevel=_toplevel();
  LatticeOntologyAdapter toplevelAdapter=(LatticeOntologyAdapter)getAdapter(toplevel);
  toplevelAdapter.reinitialize();
  toplevelAdapter._addDefaultConstraints(_getConstraintType());
  toplevelAdapter._setConnectionConstraintType(_getConstraintType());
  _initialConstraintList=toplevelAdapter.constraintList();
}

Fixed version (ground truth):
/** 
 * Initialize the solver:  Reset the solver (superclass) and then collect all of the initial constraints from the model.
 * @exception IllegalActionException If an exception occurs whencollecting the constraints.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  NamedObj toplevel=_toplevel();
  LatticeOntologyAdapter toplevelAdapter=(LatticeOntologyAdapter)getAdapter(toplevel);
  toplevelAdapter.reinitialize();
  toplevelAdapter._setConnectionConstraintType(_getConstraintType());
  toplevelAdapter._addDefaultConstraints(_getConstraintType());
  _initialConstraintList=toplevelAdapter.constraintList();
}
Program: 73230
Project: 73230
Buggy source:
/** 
 * Initialize parameters to default values. 
 */
private void _initParameters(){
  try {
    coresForEventProcessing=new Parameter(this,"String_Node_Str");
    coresForEventProcessing.setExpression("String_Node_Str");
    coresForEventProcessing.setTypeEquals(BaseType.INT);
    considerTriggerPorts=new Parameter(this,"String_Node_Str");
    considerTriggerPorts.setExpression("String_Node_Str");
    considerTriggerPorts.setTypeEquals(BaseType.BOOLEAN);
  }
 catch (  KernelException e) {
    throw new InternalErrorException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Initialize parameters to default values. 
 */
private void _initParameters(){
  try {
    coresForEventProcessing=new Parameter(this,"String_Node_Str");
    coresForEventProcessing.setExpression("String_Node_Str");
    coresForEventProcessing.setTypeEquals(BaseType.INT);
    binaryDependencyCheck=new Parameter(this,"String_Node_Str");
    binaryDependencyCheck.setExpression("String_Node_Str");
    binaryDependencyCheck.setTypeEquals(BaseType.BOOLEAN);
    considerTriggerPorts=new Parameter(this,"String_Node_Str");
    considerTriggerPorts.setExpression("String_Node_Str");
    considerTriggerPorts.setTypeEquals(BaseType.BOOLEAN);
  }
 catch (  KernelException e) {
    throw new InternalErrorException("String_Node_Str" + e.getMessage());
  }
}
Program: 73233
Project: 73233
Buggy source:
/** 
 * Copy the required files.
 * @throws IllegalActionException If a subclass throws it.
 */
public void provideContent(WebExporter exporter) throws IllegalActionException {
  boolean usePtWebsite=Boolean.valueOf(StringUtilities.getProperty("String_Node_Str"));
  if (usePtWebsite == true) {
    return;
  }
  String jsDirectoryName="String_Node_Str";
  File jsDirectory=FileUtilities.nameToFile(jsDirectoryName,null);
  if (jsDirectory.isDirectory()) {
    File directory=exporter.getExportDirectory();
    File jsTargetDirectory=new File(directory,"String_Node_Str");
    if (jsTargetDirectory.exists() && !jsTargetDirectory.isDirectory()) {
      jsTargetDirectory.renameTo(new File(directory,"String_Node_Str"));
    }
    if (!jsTargetDirectory.exists() && !jsTargetDirectory.mkdir()) {
      MessageHandler.message("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
 else {
      for (      String filename : ExportHTMLAction.FILENAMES) {
        try {
          URL lightboxFile=FileUtilities.nameToURL(jsDirectoryName + filename,null,null);
          FileUtilities.binaryCopyURLToFile(lightboxFile,new File(jsTargetDirectory,filename));
        }
 catch (        IOException e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Copy the required files.
 * @throws IllegalActionException If a subclass throws it.
 */
public void provideContent(WebExporter exporter) throws IllegalActionException {
  boolean usePtWebsite=Boolean.valueOf(StringUtilities.getProperty("String_Node_Str"));
  if (usePtWebsite == true) {
    return;
  }
  String jsDirectoryName="String_Node_Str";
  File jsDirectory=FileUtilities.nameToFile(jsDirectoryName,null);
  if (jsDirectory.isDirectory()) {
    File directory=exporter.getExportDirectory();
    File jsTargetDirectory=new File(directory,"String_Node_Str");
    if (jsTargetDirectory.exists() && !jsTargetDirectory.isDirectory()) {
      File jsBackupDirectory=new File(directory,"String_Node_Str");
      if (!jsTargetDirectory.renameTo(jsBackupDirectory)) {
        System.out.println("String_Node_Str" + jsTargetDirectory + "String_Node_Str"+ jsBackupDirectory+ "String_Node_Str");
      }
    }
    if (!jsTargetDirectory.exists() && !jsTargetDirectory.mkdir()) {
      MessageHandler.message("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
 else {
      for (      String filename : ExportHTMLAction.FILENAMES) {
        try {
          URL lightboxFile=FileUtilities.nameToURL(jsDirectoryName + filename,null,null);
          FileUtilities.binaryCopyURLToFile(lightboxFile,new File(jsTargetDirectory,filename));
        }
 catch (        IOException e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
      }
    }
  }
}
Program: 73237
Project: 73237
Buggy source:
/** 
 * Provide default content to the specified web exporter to be included in a web page for the container of this object for objects that do not override onmouseover. This class provides an area attribute of type "onmouseover" that displays the parameter values of the object and one of type "onmouseout" that clears that display.
 * @param exporter The exporter to which to provide the content.
 * @param object The object which provides the content.
 * @throws IllegalActionException If evaluating the valueof this parameter fails.
 */
public static void provideDefaultOutsideContent(WebExporter exporter,NamedObj object) throws IllegalActionException {
  if (object == null) {
    return;
  }
  String command="String_Node_Str" + object.getName() + "String_Node_Str"+ getParameterTable(object).toString()+ "String_Node_Str";
  if (exporter.defineAreaAttribute(object,"String_Node_Str",command,false)) {
    String clear="String_Node_Str" + "String_Node_Str";
    exporter.defineAreaAttribute(object,"String_Node_Str",clear,false);
    exporter.addContent("String_Node_Str",true,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    exporter.addContent("String_Node_Str",true,"String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Provide default content to the specified web exporter to be included in a web page for the container of this object for objects that do not override onmouseover. This class provides an area attribute of type "onmouseover" that displays the parameter values of the object and one of type "onmouseout" that clears that display.
 * @param exporter The exporter to which to provide the content.
 * @param object The object which provides the content.
 * @throws IllegalActionException If evaluating the valueof this parameter fails.
 */
public static void provideDefaultOutsideContent(WebExporter exporter,NamedObj object) throws IllegalActionException {
  if (object == null) {
    return;
  }
  String command="String_Node_Str" + object.getName() + "String_Node_Str"+ getParameterTable(object)+ "String_Node_Str";
  if (exporter.defineAreaAttribute(object,"String_Node_Str",command,false)) {
    String clear="String_Node_Str" + "String_Node_Str";
    exporter.defineAreaAttribute(object,"String_Node_Str",clear,false);
    exporter.addContent("String_Node_Str",true,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    exporter.addContent("String_Node_Str",true,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 73238
Project: 73238
Buggy source:
/** 
 * Return an event which is safe-to-process and should be processed next. If no such event exists, null is returned. In this implementation, the event that should be processed next is the safe-to-process event that is earliest in <absolute deadline, tag, microstep, depth> lexical  ordering. Note that this method does not modify the event queue.
 * @return Safe event to process.
 * @exception IllegalActionException 
 */
protected PtidesEvent _getNextSafeEvent() throws IllegalActionException {
  _nextRunScheduler=null;
  List<PtidesEvent> EDF=new ArrayList<PtidesEvent>(_eventQueue.size());
  for (int i=0; i < _eventQueue.size(); i++) {
    EDF.add(((PtidesListEventQueue)_eventQueue).get(i));
  }
  Collections.sort(EDF,new EDFComparator());
  for (  PtidesEvent event : EDF) {
    if (_safeToProcess(event)) {
      for (int i=0; i < _eventQueue.size(); i++) {
        if (((PtidesListEventQueue)_eventQueue).get(i).equals(event)) {
          _peekingIndex=i;
        }
      }
      return event;
    }
  }
  if (_nextRunScheduler != null) {
    _debug("String_Node_Str" + _nextRunScheduler);
    _fireAtPlatformTime(_nextRunScheduler,platformTimeClock);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return an event which is safe-to-process and should be processed next. If no such event exists, null is returned. In this implementation, the event that should be processed next is the safe-to-process event that is earliest in <absolute deadline, tag, microstep, depth> lexical  ordering. Note that this method does not modify the event queue.
 * @return Safe event to process.
 * @exception IllegalActionException 
 */
protected PtidesEvent _getNextSafeEvent() throws IllegalActionException {
  _nextRunScheduler=null;
  List<PtidesEvent> EDF=new ArrayList<PtidesEvent>(_eventQueue.size());
  for (int i=0; i < _eventQueue.size(); i++) {
    EDF.add(((PtidesListEventQueue)_eventQueue).get(i));
  }
  Collections.sort(EDF,new EDFComparator());
  for (  PtidesEvent event : EDF) {
    if (_safeToProcess(event)) {
      for (int i=0; i < _eventQueue.size(); i++) {
        if (((PtidesListEventQueue)_eventQueue).get(i).equals(event)) {
          _peekingIndex=i;
          break;
        }
      }
      return event;
    }
  }
  if (_nextRunScheduler != null) {
    _debug("String_Node_Str" + _nextRunScheduler);
    _fireAtPlatformTime(_nextRunScheduler,platformTimeClock);
  }
  return null;
}
Program: 73245
Project: 73245
Buggy source:
/** 
 * Choose zero or more transitions enabled in the current state from the list of specified transitions. This method follows chains of immediate transitions, if there are any. As a side effect, the controller's _lastChosenTransitions protected variable will contain the chosen transitions.
 * @param transitionList The candidate transitions.
 * @param immediateOnly If true, look only at immediatetransitions from the current state.
 * @throws IllegalActionException If something goes wrong.
 */
protected void _chooseTransitions(List<Transition> transitionList,boolean immediateOnly) throws IllegalActionException {
  Transition chosenTransition=_chooseTransition(_currentState,transitionList,immediateOnly);
  if (chosenTransition != null && chosenTransition.isImmediate() && chosenTransition.destinationState() == _currentState) {
    throw new IllegalActionException(_currentState,this,"String_Node_Str");
  }
  HashSet<State> visitedStates=new HashSet<State>();
  while (chosenTransition != null) {
    State nextState=chosenTransition.destinationState();
    if (visitedStates.contains(nextState)) {
      throw new IllegalActionException(nextState,this,"String_Node_Str");
    }
    visitedStates.add(nextState);
    transitionList=nextState.outgoingPort.linkedRelationList();
    chosenTransition=_chooseTransition(nextState,transitionList,true);
  }
}

Fixed version (ground truth):
/** 
 * Choose zero or more transitions enabled in the current state from the list of specified transitions. This method follows chains of immediate transitions, if there are any. As a side effect, the controller's _lastChosenTransitions protected variable will contain the chosen transitions.
 * @param transitionList The candidate transitions.
 * @param immediateOnly If true, look only at immediatetransitions from the current state.
 * @throws IllegalActionException If something goes wrong.
 */
protected void _chooseTransitions(List<Transition> transitionList,boolean immediateOnly) throws IllegalActionException {
  Transition chosenTransition=_chooseTransition(_currentState,transitionList,immediateOnly);
  if (chosenTransition != null && chosenTransition.isImmediate() && chosenTransition.destinationState() == _currentState) {
    throw new IllegalActionException(_currentState,this,"String_Node_Str");
  }
  HashSet<State> visitedStates=new HashSet<State>();
  while (chosenTransition != null) {
    State nextState=chosenTransition.destinationState();
    if (visitedStates.contains(nextState)) {
      throw new IllegalActionException(nextState,this,"String_Node_Str");
    }
    visitedStates.add(nextState);
    transitionList=nextState.outgoingPort.linkedRelationList();
    if (_debugging) {
      _debug("String_Node_Str" + nextState.getName());
    }
    chosenTransition=_chooseTransition(nextState,transitionList,true);
  }
}
Program: 73247
Project: 73247
Buggy source:
/** 
 * Initialize this actor by setting the current state to the initial state.
 * @exception IllegalActionException If a derived class throws it.
 */
public void initialize() throws IllegalActionException {
  if (_initializables != null) {
    for (    Initializable initializable : _initializables) {
      initializable.initialize();
    }
  }
  _reachedFinalState=false;
  _newIteration=true;
  reset();
  _transitionsPreviouslyChosenInIteration.clear();
  _lastChosenTransitions.clear();
  _disabledRefinements.clear();
  if (_currentState != null) {
    List transitionList=_currentState.outgoingPort.linkedRelationList();
    _chooseTransitions(transitionList,true);
    _commitLastChosenTransition();
    _transitionsPreviouslyChosenInIteration.clear();
    List enabledTransitions=enabledTransitions(transitionList,false);
    if (enabledTransitions.size() > 0) {
      if (_debugging) {
        _debug("String_Node_Str" + getDirector().getModelTime());
      }
      getDirector().fireAtCurrentTime(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialize this actor by setting the current state to the initial state.
 * @exception IllegalActionException If a derived class throws it.
 */
public void initialize() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (_initializables != null) {
    for (    Initializable initializable : _initializables) {
      initializable.initialize();
    }
  }
  _reachedFinalState=false;
  _newIteration=true;
  reset();
  _transitionsPreviouslyChosenInIteration.clear();
  _lastChosenTransitions.clear();
  _disabledRefinements.clear();
  if (_currentState != null) {
    List transitionList=_currentState.outgoingPort.linkedRelationList();
    if (_debugging) {
      _debug("String_Node_Str");
    }
    _chooseTransitions(transitionList,true);
    _commitLastChosenTransition();
    _transitionsPreviouslyChosenInIteration.clear();
    if (_debugging) {
      _debug("String_Node_Str");
    }
    List enabledTransitions=enabledTransitions(transitionList,false);
    if (enabledTransitions.size() > 0) {
      if (_debugging) {
        _debug("String_Node_Str" + getDirector().getModelTime());
      }
      getDirector().fireAtCurrentTime(this);
    }
  }
}
Program: 73249
Project: 73249
Buggy source:
public void keyReleased(KeyEvent e){
  AttributeTreeModel treeModel=(AttributeTreeModel)_tree.getModel();
  if ((_search.getText() != null) && (_search.getText().length() > 0)) {
    treeModel.applyFilter(_search.getText());
    for (int i=0; i < _tree.getRowCount(); i++) {
      _tree.expandRow(i);
    }
  }
 else {
    for (int i=0; i < _tree.getRowCount(); i++) {
      _tree.collapseRow(i);
    }
  }
}

Fixed version (ground truth):
public void keyReleased(KeyEvent e){
  AttributeTreeModel treeModel=(AttributeTreeModel)_tree.getModel();
  if ((_search.getText() != null) && (_search.getText().length() > 0)) {
    treeModel.applyFilter(_search.getText());
    for (int i=0; i < _tree.getRowCount(); i++) {
      _tree.expandRow(i);
    }
  }
 else {
    for (int i=0; i < _tree.getRowCount(); i++) {
      treeModel.applyFilter("String_Node_Str");
      _tree.collapseRow(i);
    }
  }
}