nus-yam/ex-repair huggingface dataset:
Program: 73078
Project: 73078
Buggy source:
/** 
 * Add a type constraint for backward type inference that forces the input to be an array of which the elements have a type greater than or equal to the output port. If the <i>enforceArrayLength</i> parameter is set to true, the input is also forced to have a length equal to the <i>arrayLength</i> parameter. If backward type inference is disabled, this method returns an empty set.
 * @see ArrayOfTypesFunction
 * @return A set of inequalities.
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  if (isBackwardTypeInferenceEnabled()) {
    boolean enforceLength=false;
    int length=1;
    try {
      enforceLength=((BooleanToken)enforceArrayLength.getToken()).booleanValue();
      length=((IntToken)arrayLength.getToken()).intValue();
    }
 catch (    IllegalActionException e) {
      e.printStackTrace();
    }
    if (enforceLength) {
      result.add(new Inequality(new ArrayOfTypesFunction(output,length),input.getTypeTerm()));
    }
 else {
      result.add(new Inequality(new ArrayOfTypesFunction(output),input.getTypeTerm()));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Add a type constraint for backward type inference that forces the input to be an array of which the elements have a type greater than or equal to the output port. If the <i>enforceArrayLength</i> parameter is set to true, the input is also forced to have a length equal to the <i>arrayLength</i> parameter. If backward type inference is disabled, this method returns an empty set.
 * @see ArrayOfTypesFunction
 * @return A set of inequalities.
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  if (isBackwardTypeInferenceEnabled()) {
    boolean enforceLength=false;
    int length=1;
    try {
      if (((BooleanToken)enforceArrayLength.getToken()).booleanValue()) {
        result.add(new Inequality(new ArrayOfTypesFunction(output,((IntToken)arrayLength.getToken()).intValue()),input.getTypeTerm()));
      }
 else {
        result.add(new Inequality(new ArrayOfTypesFunction(output),input.getTypeTerm()));
      }
    }
 catch (    IllegalActionException e) {
      e.printStackTrace();
    }
  }
  return result;
}
Program: 73079
Project: 73079
Buggy source:
/** 
 * Construct a RecordAssembler with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If this actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public RecordAssembler(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct a RecordAssembler with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If this actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public RecordAssembler(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  _inputs=new LinkedList<TypedIOPort>();
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}
Program: 73080
Project: 73080
Buggy source:
/** 
 * Generate a list of all connected input ports. 
 */
@Override public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  _inputs=new LinkedList<TypedIOPort>();
  for (  TypedIOPort port : inputPortList()) {
    if (port.numberOfSources() > 0) {
      _inputs.add(port);
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate a list of all connected input ports. 
 */
@Override public void preinitialize() throws IllegalActionException {
  _inputs=new LinkedList<TypedIOPort>();
  for (  TypedIOPort port : inputPortList()) {
    if (port.numberOfSources() > 0) {
      _inputs.add(port);
    }
  }
  super.preinitialize();
}
Program: 73081
Project: 73081
Buggy source:
@Override public boolean hasTheSameTagAs(DEEvent event){
  Actor actor=event.actor();
  if (actor == null) {
    actor=(Actor)event.ioPort().getContainer();
  }
  Double timePrecision=null;
  try {
    timePrecision=PtidesDirector._getDoubleParameterValue((NamedObj)actor,"String_Node_Str");
  }
 catch (  IllegalActionException e) {
  }
  if (timePrecision == null) {
    timePrecision=0.0;
  }
  return (_timestamp.subtract(timePrecision).compareTo(event.timeStamp()) <= 0 && _timestamp.add(timePrecision).compareTo(event.timeStamp()) >= 0 && (_microstep == event.microstep()));
}

Fixed version (ground truth):
@Override public boolean hasTheSameTagAs(DEEvent event){
  Actor actor=event.actor();
  if (actor == null) {
    actor=(Actor)event.ioPort().getContainer();
  }
  Double timePrecision=null;
  try {
    timePrecision=PtidesDirector._getDoubleParameterValue((NamedObj)actor,"String_Node_Str");
  }
 catch (  IllegalActionException e) {
  }
  if (timePrecision == null) {
    timePrecision=0.0;
  }
  return ((_timestamp.compareTo(event.timeStamp()) == 0 && _microstep == event.microstep()) || _timestamp.compareTo(event.timeStamp()) <= 0 || (_timestamp.subtract(timePrecision).compareTo(event.timeStamp()) <= 0 && _timestamp.add(timePrecision).compareTo(event.timeStamp()) >= 0));
}
Program: 73082
Project: 73082
Buggy source:
/** 
 * Add a type constraint for backward type inference that forces the input to be an array of which the elements have a type greater than or equal to the output port. If the <i>enforceArrayLength</i> parameter is set to true, the input is also forced to have a length equal to the <i>arrayLength</i> parameter. If backward type inference is disabled, this method returns an empty set.
 * @see ArrayOfTypesFunction
 * @return A set of inequalities.
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  if (isBackwardTypeInferenceEnabled()) {
    boolean enforceLength=false;
    int length=1;
    try {
      enforceLength=((BooleanToken)enforceArrayLength.getToken()).booleanValue();
      length=((IntToken)arrayLength.getToken()).intValue();
    }
 catch (    IllegalActionException e) {
      e.printStackTrace();
    }
    if (enforceLength) {
      result.add(new Inequality(input.getTypeTerm(),new ArrayOfTypesFunction(output,length)));
    }
 else {
      result.add(new Inequality(input.getTypeTerm(),new ArrayOfTypesFunction(output)));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Add a type constraint for backward type inference that forces the input to be an array of which the elements have a type greater than or equal to the output port. If the <i>enforceArrayLength</i> parameter is set to true, the input is also forced to have a length equal to the <i>arrayLength</i> parameter. If backward type inference is disabled, this method returns an empty set.
 * @see ArrayOfTypesFunction
 * @return A set of inequalities.
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  if (isBackwardTypeInferenceEnabled()) {
    boolean enforceLength=false;
    int length=1;
    try {
      enforceLength=((BooleanToken)enforceArrayLength.getToken()).booleanValue();
      length=((IntToken)arrayLength.getToken()).intValue();
    }
 catch (    IllegalActionException e) {
      e.printStackTrace();
    }
    if (enforceLength) {
      result.add(new Inequality(new ArrayOfTypesFunction(output,length),input.getTypeTerm()));
    }
 else {
      result.add(new Inequality(new ArrayOfTypesFunction(output),input.getTypeTerm()));
    }
  }
  return result;
}
Program: 73083
Project: 73083
Buggy source:
/** 
 * Return the hash code for the XMLToken object. If two XMLToken objects contains the same timestamp and index, then they have the same hashcode.
 * @return The hash code for this XMLToken object.
 */
public int hashCode(){
  int hashCode=31;
  if (_isNew) {
    hashCode=31 * hashCode + 1;
  }
  if (_listParents != null) {
    hashCode=31 * hashCode + _listParents.hashCode();
  }
  if (_parentsMap != null) {
    hashCode=31 * hashCode + _parentsMap.hashCode();
  }
  if (_listReferencedChildren != null) {
    hashCode=31 * hashCode + _listReferencedChildren.hashCode();
  }
  if (_modelContent != null) {
    hashCode=31 * hashCode + _modelContent.hashCode();
  }
  if (_modelName != null) {
    hashCode=31 * hashCode + _modelName.hashCode();
  }
  if (_modelId != null) {
    hashCode=31 * hashCode + _modelId.hashCode();
  }
  return hashCode;
}

Fixed version (ground truth):
/** 
 * Return the hash code for the XMLDBModel object.
 * @return The hash code for this XMLDBModel object.
 */
public int hashCode(){
  int hashCode=31;
  if (_isNew) {
    hashCode=31 * hashCode + 1;
  }
  if (_listParents != null) {
    hashCode=31 * hashCode + _listParents.hashCode();
  }
  if (_parentsMap != null) {
    hashCode=31 * hashCode + _parentsMap.hashCode();
  }
  if (_listReferencedChildren != null) {
    hashCode=31 * hashCode + _listReferencedChildren.hashCode();
  }
  if (_modelContent != null) {
    hashCode=31 * hashCode + _modelContent.hashCode();
  }
  if (_modelName != null) {
    hashCode=31 * hashCode + _modelName.hashCode();
  }
  if (_modelId != null) {
    hashCode=31 * hashCode + _modelId.hashCode();
  }
  return hashCode;
}
Program: 73084
Project: 73084
Buggy source:
/** 
 * Implementations of this method should return the suggested refined step size for restarting the current integration. If any actor returns false when isStepSizeAccurate() is called, then this method will be called on all actors that implement this interface. The minimum of their returned value will be the new step size. If the actor does not need a smaller step size, then this method should return the current step size.
 * @return The suggested refined step size.
 * @exception IllegalActionException If the step size cannot be further refined.
 */
public double refinedStepSize() throws IllegalActionException {
  if (_refinedStepSize >= 0.0) {
    return _refinedStepSize;
  }
  Director director=getDirector();
  if (director instanceof ContinuousDirector) {
    return ((ContinuousDirector)director).getCurrentStepSize() * 0.5;
  }
  return Double.MAX_VALUE;
}

Fixed version (ground truth):
/** 
 * Implementations of this method should return the suggested refined step size for restarting the current integration. If any actor returns false when isStepSizeAccurate() is called, then this method will be called on all actors that implement this interface. The minimum of their returned value will be the new step size. If the actor does not need a smaller step size, then this method should return the current step size.
 * @return The suggested refined step size.
 * @exception IllegalActionException If the step size cannot be further refined.
 */
public double refinedStepSize() throws IllegalActionException {
  if (_refinedStepSize >= 0.0) {
    if (_debugging) {
      _debug("String_Node_Str" + _refinedStepSize);
    }
    return _refinedStepSize;
  }
  Director director=getDirector();
  if (director instanceof ContinuousDirector) {
    double half=((ContinuousDirector)director).getCurrentStepSize() * 0.5;
    if (_debugging) {
      _debug("String_Node_Str" + half);
    }
    return half;
  }
  return Double.MAX_VALUE;
}
Program: 73085
Project: 73085
Buggy source:
/** 
 * Instantiate the slave FMU component.
 * @exception IllegalActionException if it cannot be instantiated.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  if (_debugging) {
    _debug("String_Node_Str");
  }
  _checkFmi();
  String modelIdentifier=_fmiModelDescription.modelIdentifier;
  String fmuLocation=null;
  try {
    String fmuFileName=fmuFile.asFile().getCanonicalPath();
    fmuLocation=new File(fmuFileName).toURI().toURL().toString();
  }
 catch (  Exception ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str" + fmuFile + "String_Node_Str");
  }
  String mimeType="String_Node_Str";
  double timeout=1000;
  byte visible=0;
  byte interactive=0;
  FMICallbackFunctions.ByValue callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
  byte loggingOn=_debugging ? (byte)1 : (byte)0;
  loggingOn=1;
  if (_debugging) {
    _debug("String_Node_Str" + modelIdentifier + "String_Node_Str");
  }
  _fmiComponent=(Pointer)_fmiInstantiateSlave.invoke(Pointer.class,new Object[]{modelIdentifier,_fmiModelDescription.guid,fmuLocation,mimeType,timeout,visible,interactive,callbacks,loggingOn});
  if (_fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Instantiate the slave FMU component.
 * @exception IllegalActionException if it cannot be instantiated.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  if (_debugging) {
    _debug("String_Node_Str");
  }
  _checkFmi();
  String modelIdentifier=_fmiModelDescription.modelIdentifier;
  String fmuLocation=null;
  try {
    String fmuFileName=fmuFile.asFile().getCanonicalPath();
    fmuLocation=new File(fmuFileName).toURI().toURL().toString();
  }
 catch (  Exception ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str" + fmuFile + "String_Node_Str");
  }
  String mimeType="String_Node_Str";
  double timeout=1000;
  byte visible=0;
  byte interactive=0;
  FMICallbackFunctions.ByValue callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
  byte loggingOn=_debugging ? (byte)1 : (byte)0;
  loggingOn=1;
  if (_debugging) {
    _debug("String_Node_Str" + modelIdentifier + "String_Node_Str");
  }
  _fmiComponent=(Pointer)_fmiInstantiateSlave.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,fmuLocation,mimeType,timeout,visible,interactive,callbacks,loggingOn});
  if (_fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 73088
Project: 73088
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 FMUImport(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  fmuFile=new FileParameter(this,"String_Node_Str");
  fmuFile.setExpression("String_Node_Str");
  fmuFile.setVisibility(Settable.NOT_EDITABLE);
  suppressWarnings=new Parameter(this,"String_Node_Str");
  suppressWarnings.setTypeEquals(BaseType.BOOLEAN);
  suppressWarnings.setExpression("String_Node_Str");
}

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 FMUImport(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  fmuFile=new FileParameter(this,"String_Node_Str");
  fmuFile.setExpression("String_Node_Str");
  fmuFile.setVisibility(Settable.NOT_EDITABLE);
  fmiVersion=new StringParameter(this,"String_Node_Str");
  fmiVersion.setExpression("String_Node_Str");
  fmiVersion.setVisibility(Settable.NOT_EDITABLE);
  suppressWarnings=new Parameter(this,"String_Node_Str");
  suppressWarnings.setTypeEquals(BaseType.BOOLEAN);
  suppressWarnings.setExpression("String_Node_Str");
}
Program: 73089
Project: 73089
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArcAttribute newObject=(ArcAttribute)super.clone(workspace);
  newObject._icon.setShape(newObject._newShape());
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArcAttribute newObject=(ArcAttribute)super.clone(workspace);
  newObject._icon.setShape(_newShape());
  return newObject;
}
Program: 73090
Project: 73090
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  EllipseAttribute newObject=(EllipseAttribute)super.clone(workspace);
  newObject._icon.setShape(newObject._newShape());
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  EllipseAttribute newObject=(EllipseAttribute)super.clone(workspace);
  newObject._icon.setShape(_newShape());
  return newObject;
}
Program: 73091
Project: 73091
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  RectangleAttribute newObject=(RectangleAttribute)super.clone(workspace);
  newObject._icon.setShape(newObject._newShape());
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  RectangleAttribute newObject=(RectangleAttribute)super.clone(workspace);
  newObject._icon.setShape(_newShape());
  return newObject;
}
Program: 73092
Project: 73092
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ResizablePolygonAttribute newObject=(ResizablePolygonAttribute)super.clone(workspace);
  newObject._icon.setShape(newObject._newShape());
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ResizablePolygonAttribute newObject=(ResizablePolygonAttribute)super.clone(workspace);
  newObject._icon.setShape(_newShape());
  return newObject;
}
Program: 73093
Project: 73093
Buggy source:
/** 
 * Open the file and read the first line, putting its value into the _currentLine variable. Also, read the second line, putting its value in the _nextLine variable.
 * @exception IllegalActionException If the file cannot be read.
 */
protected void _openAndReadFirstTwoLines() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + ((StringToken)fileOrURL.getToken()).stringValue());
  }
  _reader=fileOrURL.openForReading();
  if (_reader == null) {
    throw new IllegalActionException(this,"String_Node_Str" + fileOrURL.getDisplayName());
  }
  try {
    int numberOfLines=((IntToken)numberOfLinesToSkip.getToken()).intValue();
    for (int i=0; i <= numberOfLines; i++) {
      _currentLine=_reader.readLine();
      if (_debugging) {
        _debug("String_Node_Str" + _currentLine);
      }
      if (_currentLine == null) {
        throw new IllegalActionException(this,"String_Node_Str" + fileOrURL.stringValue() + "String_Node_Str"+ "String_Node_Str");
      }
    }
    _nextLine=_reader.readLine();
    if (_debugging) {
      _debug("String_Node_Str" + _nextLine);
    }
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Open the file and read the first line, putting its value into the _currentLine variable. Also, read the second line, putting its value in the _nextLine variable.
 * @exception IllegalActionException If the file cannot be read.
 */
protected void _openAndReadFirstTwoLines() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + ((StringToken)fileOrURL.getToken()).stringValue());
  }
  _reader=fileOrURL.openForReading();
  if (_reader == null) {
    throw new IllegalActionException(this,"String_Node_Str" + fileOrURL.getDisplayName());
  }
  try {
    int numberOfLines=((IntToken)numberOfLinesToSkip.getToken()).intValue();
    for (int i=0; i <= numberOfLines; i++) {
      _currentLine=_reader.readLine();
      if (_debugging && i < numberOfLines) {
        _debug("String_Node_Str" + _currentLine);
      }
      if (_currentLine == null) {
        throw new IllegalActionException(this,"String_Node_Str" + fileOrURL.stringValue() + "String_Node_Str"+ "String_Node_Str");
      }
    }
    _nextLine=_reader.readLine();
    if (_debugging) {
      _debug("String_Node_Str" + _nextLine);
    }
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
}
Program: 73094
Project: 73094
Buggy source:
private void readMapping(String finename){
}

Fixed version (ground truth):
/** 
 * Read constraints from the mapping file.
 * @param finename mapping file
 */
private void readMapping(String finename){
}
Program: 73095
Project: 73095
Buggy source:
private void _initializeParameters(){
  _verbose=true;
  try {
    _mapping_file_name=new Parameter(this,"String_Node_Str");
    _mapping_file_name.setTypeEquals(BaseType.STRING);
  }
 catch (  IllegalActionException e1) {
    e1.printStackTrace();
  }
catch (  NameDuplicationException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
private void _initializeParameters(){
  _verbose=true;
  try {
    _mappingFileName=new Parameter(this,"String_Node_Str");
    _mappingFileName.setTypeEquals(BaseType.STRING);
  }
 catch (  IllegalActionException e1) {
    e1.printStackTrace();
  }
catch (  NameDuplicationException e1) {
    e1.printStackTrace();
  }
}
Program: 73096
Project: 73096
Buggy source:
void _init(){
  try {
    _mapping_file_name.moveToLast();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void _init(){
  try {
    _mappingFileName.moveToLast();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}
Program: 73097
Project: 73097
Buggy source:
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == _mapping_file_name) {
    StringToken str_token=(StringToken)_mapping_file_name.getToken();
    if (str_token == null) {
      _mapping_file_name=null;
    }
 else {
      readMapping(str_token.stringValue());
      System.out.println(_mapping_constraint_solver);
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == _mappingFileName) {
    StringToken str_token=(StringToken)_mappingFileName.getToken();
    if (str_token == null) {
      _mappingFileName=null;
    }
 else {
      readMapping(str_token.stringValue());
      System.out.println(_mappingConstraintSolver);
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 73098
Project: 73098
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there).
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  MetroIIDirector newObject=(MetroIIDirector)super.clone(workspace);
  newObject._mapping_constraint_solver=new MappingConstraintSolver(100);
  newObject.eventname2id=new Hashtable<String,Integer>();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there).
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  MetroIIDirector newObject=(MetroIIDirector)super.clone(workspace);
  newObject._mappingConstraintSolver=new MappingConstraintSolver(100);
  newObject._eventName2ID=new Hashtable<String,Integer>();
  return newObject;
}
Program: 73100
Project: 73100
Buggy source:
/** 
 * Update the local variable associated with the changed attribute and disconnect from the server. 
 * @param attribute The changed attribute.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == port) {
    _portNumber=((IntToken)port.getToken()).intValue();
    _disconnect();
  }
 else   if (attribute == server) {
    _serverName=((StringToken)server.getToken()).stringValue();
    _disconnect();
  }
 else   if (attribute == username) {
    _userName=((StringToken)username.getToken()).stringValue();
    _disconnect();
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Update the local variable associated with the changed attribute and disconnect from the server. 
 * @param attribute The changed attribute.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == port) {
    _portNumber=((IntToken)port.getToken()).intValue();
    _disconnect();
  }
 else   if (attribute == server) {
    _serverName=((StringToken)server.getToken()).stringValue();
    _disconnect();
  }
 else   if (attribute == username) {
    _userName=((StringToken)username.getToken()).stringValue();
    _disconnect();
  }
 else   if (attribute == password) {
    _password=((StringToken)password.getToken()).stringValue();
    _disconnect();
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 73101
Project: 73101
Buggy source:
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  _currentSourceTimestamp=null;
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time);
  }
  return time;
}

Fixed version (ground truth):
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  _currentSourceTimestamp=null;
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time,1);
  }
  return time;
}
Program: 73102
Project: 73102
Buggy source:
/** 
 * Set up and return two type constraints. <ul> <li><tt>output >= {x = typeOf(inputPortX), y = typeOf(inputPortY), ..} </tt>, which requires the types of the input ports to be compatible with the corresponding types in the output record. </li> <li><tt>each input <= the type of the corresponding field inside the output record</tt>, which is similar to the usual default constraints, however this constraint establishes a dependency between the inputs of this actor and the fields inside the output record, instead of just between its inputs and outputs. </li> </ul> Note that the output record is not required to contain a corresponding field for every input, as downstream actors might require fewer fields in the record they accept for input.
 * @return A set of type constraints
 * @see ConstructAssociativeType
 * @see ExtractFieldType
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  for (  TypedIOPort input : inputPortList()) {
    result.add(new Inequality(new ExtractFieldType(output,input.getName()),input.getTypeTerm()));
  }
  result.add(new Inequality(new ConstructAssociativeType(inputPortList(),RecordType.class),output.getTypeTerm()));
  return result;
}

Fixed version (ground truth):
/** 
 * Set up and return two type constraints. <ul> <li><tt>output >= {x = typeOf(inputPortX), y = typeOf(inputPortY), ..} </tt>, which requires the types of the input ports to be compatible with the corresponding types in the output record. </li> <li><tt>each input >= the type of the corresponding field inside the output record</tt>, which together with the first constraint forces the input types to be exactly equal to the types of the corresponding fields in the output record. This constraint is intended to back- propagate type information upstream, not to assure type compatibility. Therefore, this constraint is only set up for input ports that do not already have a type declared.</li> </ul> Note that the output record is not required to contain a corresponding field for every input, as downstream actors might require fewer fields in the record they accept for input.
 * @return A set of type constraints
 * @see ConstructAssociativeType
 * @see ExtractFieldType
 */
@Override protected Set<Inequality> _customTypeConstraints(){
  Set<Inequality> result=new HashSet<Inequality>();
  for (  TypedIOPort input : inputPortList()) {
    if (input.getTypeTerm().isSettable()) {
      result.add(new Inequality(new ExtractFieldType(output,input.getName()),input.getTypeTerm()));
    }
  }
  result.add(new Inequality(new ConstructAssociativeType(inputPortList(),RecordType.class),output.getTypeTerm()));
  return result;
}
Program: 73103
Project: 73103
Buggy source:
/** 
 * If the attribute for the input, switch fabric or output delay is changed, then ensure that the value is non-negative.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the buffer delays are negative.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == inputBufferDelay) {
    double value=((DoubleToken)inputBufferDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _inputBufferDelay=value;
  }
 else   if (attribute == outputBufferDelay) {
    double value=((DoubleToken)outputBufferDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _outputBufferDelay=value;
  }
 else   if (attribute == switchFabricDelay) {
    double value=((DoubleToken)switchFabricDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _switchFabricDelay=value;
  }
 else   if (attribute == numberOfPorts) {
    int ports=((IntToken)numberOfPorts.getToken()).intValue();
    for (int i=0; i < ports; i++) {
      _inputTokens.put(i,new TreeSet());
      _outputTokens.put(i,new TreeSet());
    }
  }
  super.attributeChanged(attribute);
}

Fixed version (ground truth):
/** 
 * If the attribute for the input, switch fabric or output delay is changed, then ensure that the value is non-negative.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the buffer delays are negative.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == inputBufferDelay) {
    double value=((DoubleToken)inputBufferDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _inputBufferDelay=value;
  }
 else   if (attribute == outputBufferDelay) {
    double value=((DoubleToken)outputBufferDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _outputBufferDelay=value;
  }
 else   if (attribute == switchFabricDelay) {
    double value=((DoubleToken)switchFabricDelay.getToken()).doubleValue();
    if (value <= 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + value);
    }
    _switchFabricDelay=value;
  }
 else   if (attribute == numberOfPorts) {
    int ports=((IntToken)numberOfPorts.getToken()).intValue();
    _numberOfPorts=ports;
    for (int i=0; i < ports; i++) {
      _inputTokens.put(i,new TreeSet());
      _outputTokens.put(i,new TreeSet());
    }
  }
  super.attributeChanged(attribute);
}
Program: 73104
Project: 73104
Buggy source:
/** 
 * If the shell has not already been created, create it. Then wait for user input and produce it on the output.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (shell == null) {
    Effigy containerEffigy=Configuration.findEffigy(toplevel());
    if (containerEffigy == null) {
      throw new IllegalActionException(this,"String_Node_Str" + toplevel().getFullName());
    }
    try {
      ExpressionShellEffigy shellEffigy=new ExpressionShellEffigy(containerEffigy,containerEffigy.uniqueName("String_Node_Str"));
      shellEffigy.identifier.setExpression(getFullName());
      _tableau=new ShellTableau(shellEffigy,"String_Node_Str");
      _frame=_tableau.frame;
      shell=_tableau.shell;
      shell.setInterpreter(this);
      shell.setEditable(false);
    }
 catch (    Exception ex) {
      throw new IllegalActionException(this,null,ex,"String_Node_Str");
    }
    _windowProperties.setProperties(_frame);
    _frame.pack();
  }
 else {
    shell.clearJTextArea();
  }
  if (_frame != null) {
    _frame.show();
    _frame.toFront();
  }
  _firstTime=true;
  _returnFalseInPostfire=false;
}

Fixed version (ground truth):
/** 
 * If the shell has not already been created, create it. Then wait for user input and produce it on the output.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  Runnable doInitialize=new Runnable(){
    public void run(){
      if (shell == null) {
        Effigy containerEffigy=Configuration.findEffigy(toplevel());
        if (containerEffigy == null) {
          MessageHandler.error("String_Node_Str" + toplevel().getFullName());
          return;
        }
        try {
          ExpressionShellEffigy shellEffigy=new ExpressionShellEffigy(containerEffigy,containerEffigy.uniqueName("String_Node_Str"));
          shellEffigy.identifier.setExpression(getFullName());
          _tableau=new ShellTableau(shellEffigy,"String_Node_Str");
          _frame=_tableau.frame;
          shell=_tableau.shell;
          shell.setInterpreter(InteractiveShell.this);
          shell.setEditable(false);
        }
 catch (        Exception ex) {
          MessageHandler.error("String_Node_Str" + InteractiveShell.this.getFullName(),ex);
          return;
        }
        _windowProperties.setProperties(_frame);
        _frame.pack();
      }
 else {
        shell.clearJTextArea();
      }
      if (_frame != null) {
        _frame.show();
        _frame.toFront();
      }
    }
  }
;
  try {
    SwingUtilities.invokeAndWait(doInitialize);
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
  _firstTime=true;
  _returnFalseInPostfire=false;
}
Program: 73105
Project: 73105
Buggy source:
/** 
 * Initialize to the default, which is to use channel zero. 
 */
public void initialize(){
  _selectChannel=null;
}

Fixed version (ground truth):
/** 
 * Initialize to the default, which is to use channel zero. 
 */
public void initialize(){
  _selectChannel=new IntToken(0);
}
Program: 73106
Project: 73106
Buggy source:
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  _currentSourceTimestamp=null;
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time);
  }
  if (_isInitializing) {
  }
  return time;
}

Fixed version (ground truth):
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time);
  }
  if (_isInitializing) {
  }
  return time;
}
Program: 73107
Project: 73107
Buggy source:
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time);
  }
  if (_isInitializing) {
  }
  return time;
}

Fixed version (ground truth):
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (index <= getIndex()) {
    newIndex=Math.max(getIndex(),index) + 1;
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,0,_zeroTime,_currentSourceTimestamp));
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time);
  }
  return time;
}
Program: 73108
Project: 73108
Buggy source:
/** 
 * Get the number of tokens that are produced on the given port during initialization.  If the port is not an output port, then return zero.  Otherwise, return the value of the port's <i>tokenInitProduction</i> parameter.   If the parameter does not exist, then assume the actor is zero-delay and return a value of zero.
 * @param port The given port.
 * @return The number of tokens the scheduler believes will be producedfrom the given output port during initialization.
 * @exception IllegalActionException If the tokenInitProductionparameter has an invalid expression.
 * @see #setTokenInitProduction
 */
public static int getTokenInitProduction(IOPort port) throws IllegalActionException {
  if (!port.isOutput()) {
    return 0;
  }
 else {
    return getRateVariableValue(port,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
/** 
 * Get the number of tokens that are produced on the given port during initialization.  If the port is not an output port, then the number of tokens is presumably the number of initial tokens produced on the inside of the port. The number of tokens returned is the value of the port's <i>tokenInitProduction</i> parameter.   If the parameter does not exist, then assume the actor is zero-delay and return a value of zero.
 * @param port The given port.
 * @return The number of tokens the scheduler believes will be producedfrom the given output port during initialization.
 * @exception IllegalActionException If the tokenInitProductionparameter has an invalid expression.
 * @see #setTokenInitProduction
 */
public static int getTokenInitProduction(IOPort port) throws IllegalActionException {
  return getRateVariableValue(port,"String_Node_Str",0);
}
Program: 73114
Project: 73114
Buggy source:
/** 
 * Provide a title for this object to the specified web exporter.
 * @param exporter The WebExporter to add content to
 * @exception IllegalActionException If something is wrong with thespecification of the content.
 */
protected void _provideAttributes(WebExporter exporter) throws IllegalActionException {
  WebAttribute webAttribute=WebAttribute.createWebAttribute(getContainer(),"String_Node_Str","String_Node_Str");
  webAttribute.setExpression(stringValue());
  exporter.defineAttribute(webAttribute,true);
}

Fixed version (ground truth):
/** 
 * Provide a title for this object to the specified web exporter.
 * @param exporter The WebExporter to add content to
 * @exception IllegalActionException If something is wrong with thespecification of the content.
 */
protected void _provideAttributes(WebExporter exporter) throws IllegalActionException {
  exporter.setTitle(stringValue(),((BooleanToken)showTitleInHTML.getToken()).booleanValue());
  WebAttribute webAttribute=WebAttribute.createWebAttribute(getContainer(),"String_Node_Str","String_Node_Str");
  webAttribute.setExpression(stringValue());
  exporter.defineAttribute(webAttribute,true);
}
Program: 73115
Project: 73115
Buggy source:
/** 
 * Construct an actor in the default workspace with an empty string as its name.  The object is added to the workspace directory. Increment the version number of the workspace.
 */
public ErrorHandlingAction(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  action=new Parameter(this,"String_Node_Str");
  action.setTypeEquals(BaseType.STRING);
  action.addChoice("String_Node_Str" + DropEvent + "String_Node_Str");
  action.addChoice("String_Node_Str" + ExecuteEvent + "String_Node_Str");
  action.addChoice("String_Node_Str" + FixTimestamp + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearAllEvents + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearEarlierEvents + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearCorruptEvents + "String_Node_Str");
  action.setExpression("String_Node_Str" + DropEvent + "String_Node_Str");
  delayed.setExpression("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an ErrorHandlingAction in the container with  a specified name.
 * @param container The container for this actor.
 * @param name The name of this actor.
 * @exception NameDuplicationException Thrown if the name is already used.
 * @exception IllegalActionException Thrown if parameters cannot be created.
 */
public ErrorHandlingAction(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  action=new Parameter(this,"String_Node_Str");
  action.setTypeEquals(BaseType.STRING);
  action.addChoice("String_Node_Str" + DropEvent + "String_Node_Str");
  action.addChoice("String_Node_Str" + ExecuteEvent + "String_Node_Str");
  action.addChoice("String_Node_Str" + FixTimestamp + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearAllEvents + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearEarlierEvents + "String_Node_Str");
  action.addChoice("String_Node_Str" + ClearCorruptEvents + "String_Node_Str");
  action.setExpression("String_Node_Str" + DropEvent + "String_Node_Str");
  delayed.setExpression("String_Node_Str");
}