nus-yam/ex-repair huggingface dataset:
Program: 72664
Project: 72664
Buggy source:
public void wrapup(){
  _allChords.clear();
  _currentBeat=0.0;
  _barProgress=0.0;
  _durations.clear();
  _triggersSinceLastOutput=0;
}

Fixed version (ground truth):
public void wrapup(){
  _allChords.clear();
  _currentBeatCursor=0.0;
  _barProgress=0.0;
  _durations.clear();
  _triggersSinceLastOutput=0;
}
Program: 72667
Project: 72667
Buggy source:
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor
 * @param trainingSequence The input string that the oracle is built from
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ChordParser(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  chordName=new TypedIOPort(this,"String_Node_Str",true,false);
  chordName.setTypeEquals(BaseType.STRING);
  chordDuration=new TypedIOPort(this,"String_Node_Str",true,false);
  chordDuration.setTypeEquals(BaseType.DOUBLE);
  chordIndex=new TypedIOPort(this,"String_Node_Str",true,false);
  chordIndex.setTypeEquals(BaseType.INT);
  chords=new TypedIOPort(this,"String_Node_Str",false,true);
  chords.setTypeEquals(BaseType.OBJECT);
  endChord=new TypedIOPort(this,"String_Node_Str",true,false);
  endChord.setTypeEquals(BaseType.INT);
  _durations=new LinkedList<Double>();
  _notes=new LinkedList<String>();
  _orderedChords=new HashMap<Integer,Chord>();
  _timestamps=new LinkedList<Integer>();
  _terminateChord=false;
  _terminateLength=0;
}

Fixed version (ground truth):
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor
 * @param trainingSequence The input string that the oracle is built from
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ChordParser(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  chordName=new TypedIOPort(this,"String_Node_Str",true,false);
  chordName.setTypeEquals(BaseType.STRING);
  chordDuration=new TypedIOPort(this,"String_Node_Str",true,false);
  chordDuration.setTypeEquals(BaseType.DOUBLE);
  chordIndex=new TypedIOPort(this,"String_Node_Str",true,false);
  chordIndex.setTypeEquals(BaseType.INT);
  chords=new TypedIOPort(this,"String_Node_Str",false,true);
  chords.setTypeEquals(BaseType.OBJECT);
  endChord=new TypedIOPort(this,"String_Node_Str",true,false);
  endChord.setTypeEquals(BaseType.INT);
  _durations=new LinkedList<Double>();
  _chordNames=new LinkedList<String>();
  _orderedChords=new HashMap<Integer,Chord>();
  _timestamps=new LinkedList<Integer>();
  _terminateChord=false;
  _chordLength=0;
}
Program: 72669
Project: 72669
Buggy source:
/** 
 * Subscribe or multiread from a GCL. "This routine handles calls that return multiple values via the event interface.  They might include subscriptions."
 * @param gclh The handle to the GCL
 * @param the record number of the first record.
 * @return the status.
 */
static EP_STAT do_subscribe(Pointer gclh,long firstrec,int numrecs,boolean subscribe){
  EP_STAT estat;
  if (numrecs < 0) {
    numrecs=0;
  }
  if (subscribe) {
    PointerByReference gclhByReference=new PointerByReference();
    estat=Gdp10Library.INSTANCE.gdp_gcl_subscribe(gclhByReference,firstrec,numrecs,null,null,null);
    gclh=gclhByReference.getValue();
  }
 else {
    PointerByReference gclhByReference=new PointerByReference();
    estat=Gdp10Library.INSTANCE.gdp_gcl_multiread(gclhByReference,firstrec,numrecs,null,null);
    gclh=gclhByReference.getValue();
  }
  if (!GdpUtilities.EP_STAT_ISOK(estat)) {
    System.err.println("String_Node_Str" + (subscribe ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ estat.code);
  }
  for (; ; ) {
    PointerByReference gev=Gdp10Library.INSTANCE.gdp_event_next(true ? (byte)1 : (byte)0);
switch (Gdp10Library.INSTANCE.gdp_event_gettype(gev)) {
case GdpUtilities.GDP_EVENT_DATA:
      System.out.print("String_Node_Str");
    GdpUtilities.gdp_datum_print(Gdp10Library.INSTANCE.gdp_event_getdatum(gev));
  break;
case GdpUtilities.GDP_EVENT_EOS:
System.err.println("String_Node_Str" + (subscribe ? "String_Node_Str" : "String_Node_Str"));
return estat;
default :
System.err.print("String_Node_Str" + Gdp10Library.INSTANCE.gdp_event_gettype(gev));
break;
}
Gdp10Library.INSTANCE.gdp_event_free(gev);
}
}

Fixed version (ground truth):
/** 
 * Subscribe or multiread from a GCL. "This routine handles calls that return multiple values via the event interface.  They might include subscriptions."
 * @param gclh The handle to the GCL
 * @param the record number of the first record.
 * @return the status.
 */
static EP_STAT do_subscribe(Pointer gclh,long firstrec,int numrecs,boolean subscribe){
  EP_STAT estat;
  if (numrecs < 0) {
    numrecs=0;
  }
  if (subscribe) {
    estat=Gdp10Library.INSTANCE.gdp_gcl_subscribe(gclh,firstrec,numrecs,null,null,null);
  }
 else {
    estat=Gdp10Library.INSTANCE.gdp_gcl_multiread(gclh,firstrec,numrecs,null,null);
  }
  if (!GdpUtilities.EP_STAT_ISOK(estat)) {
    System.err.println("String_Node_Str" + (subscribe ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ estat.code);
  }
  for (; ; ) {
    PointerByReference gev=Gdp10Library.INSTANCE.gdp_event_next(true ? (byte)1 : (byte)0);
switch (Gdp10Library.INSTANCE.gdp_event_gettype(gev)) {
case GdpUtilities.GDP_EVENT_DATA:
      System.out.print("String_Node_Str");
    GdpUtilities.gdp_datum_print(Gdp10Library.INSTANCE.gdp_event_getdatum(gev));
  break;
case GdpUtilities.GDP_EVENT_EOS:
System.err.println("String_Node_Str" + (subscribe ? "String_Node_Str" : "String_Node_Str"));
return estat;
default :
System.err.print("String_Node_Str" + Gdp10Library.INSTANCE.gdp_event_gettype(gev));
break;
}
Gdp10Library.INSTANCE.gdp_event_free(gev);
}
}
Program: 72670
Project: 72670
Buggy source:
/** 
 * Print the datum to standard out.  This is a port of gdp_datum_print from gdp/gdp_datum.c by Eric Allman.
 * @param datum The datum to be printed.
 */
public static void gdp_datum_print(PointerByReference datum){
  Pointer d=null;
  NativeSizeT length=new NativeSizeT();
  length.setValue(-1);
  if (datum == null) {
    System.out.print("String_Node_Str");
  }
  System.out.print("String_Node_Str" + Gdp10Library.INSTANCE.gdp_datum_getrecno(datum) + "String_Node_Str");
  PointerByReference dbuf=Gdp10Library.INSTANCE.gdp_datum_getbuf(datum);
  if (dbuf == null) {
    System.out.print("String_Node_Str");
  }
 else {
    length=Gdp10Library.INSTANCE.gdp_buf_getlength(dbuf);
    System.out.print("String_Node_Str" + length);
    d=Gdp10Library.INSTANCE.gdp_buf_getptr(dbuf,new NativeSizeT(length.longValue()));
  }
  EP_TIME_SPEC ts=new EP_TIME_SPEC();
  Gdp10Library.INSTANCE.gdp_datum_getts(datum,ts);
  if (ts.tv_sec != Long.MIN_VALUE) {
    System.out.println("String_Node_Str" + ts.tv_sec + "String_Node_Str"+ ts.tv_nsec+ "String_Node_Str"+ ts.tv_accuracy);
  }
 else {
    System.out.print("String_Node_Str");
  }
  if (length.longValue() > 0) {
    System.out.print("String_Node_Str" + d.getString(0) + "String_Node_Str");
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Print the datum to standard out.  This is a port of gdp_datum_print from gdp/gdp_datum.c by Eric Allman.
 * @param datum The datum to be printed.
 */
public static void gdp_datum_print(PointerByReference datum){
  Pointer d=null;
  NativeSizeT length=new NativeSizeT();
  length.setValue(-1);
  if (datum == null) {
    System.out.print("String_Node_Str");
  }
  System.out.print("String_Node_Str" + Gdp10Library.INSTANCE.gdp_datum_getrecno(datum) + "String_Node_Str");
  PointerByReference dbuf=Gdp10Library.INSTANCE.gdp_datum_getbuf(datum);
  if (dbuf == null) {
    System.out.print("String_Node_Str");
  }
 else {
    length=Gdp10Library.INSTANCE.gdp_buf_getlength(dbuf);
    System.out.print("String_Node_Str" + length);
    d=Gdp10Library.INSTANCE.gdp_buf_getptr(dbuf,new NativeSizeT(length.longValue()));
  }
  EP_TIME_SPEC ts=new EP_TIME_SPEC();
  Gdp10Library.INSTANCE.gdp_datum_getts(datum,ts);
  if (ts.tv_sec != Long.MIN_VALUE) {
    Date myDate=new Date(ts.tv_sec * 1000);
    SimpleDateFormat dateFormat=new SimpleDateFormat("String_Node_Str" + ts.tv_nsec + "String_Node_Str");
    dateFormat.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
    System.out.println("String_Node_Str" + dateFormat.format(myDate));
  }
 else {
    System.out.print("String_Node_Str");
  }
  if (length.longValue() > 0) {
    byte[] bytes=d.getByteArray(0,length.intValue());
    System.out.print("String_Node_Str" + new String(bytes) + "String_Node_Str");
    if (d.getString(0).length() != length.intValue()) {
      System.out.print("String_Node_Str" + d.getString(0) + "String_Node_Str"+ d.getString(0).length()+ "String_Node_Str"+ length);
    }
  }
  System.out.println("String_Node_Str");
}
Program: 72671
Project: 72671
Buggy source:
/** 
 * Return true if the status code is ok. Based on ep_stat.h, Copyright Eric Allman, See ep_license.htm
 * @param estat The status code.
 * @return true if the code is less than EP_STAT_SEV_WARN
 */
public static boolean EP_STAT_ISOK(EP_STAT estat){
  long code=estat.code.longValue();
  long EP_STAT_SEVERITY=(code >> Gdp10Library._EP_STAT_SEVSHIFT) & ((1l << Gdp10Library._EP_STAT_SEVBITS) - 1);
  return EP_STAT_SEVERITY < Gdp10Library.EP_STAT_SEV_WARN;
}

Fixed version (ground truth):
/** 
 * Return true if the status code is ok. Based on ep_stat.h, Copyright Eric Allman, See ep_license.htm
 * @param estat The status code.
 * @return true if the code is less than EP_STAT_SEV_WARN
 */
public static boolean EP_STAT_ISOK(EP_STAT estat){
  long code=estat.code.longValue();
  long EP_STAT_SEVERITY=(code >>> Gdp10Library._EP_STAT_SEVSHIFT) & ((1l << Gdp10Library._EP_STAT_SEVBITS) - 1);
  return EP_STAT_SEVERITY < Gdp10Library.EP_STAT_SEV_WARN;
}
Program: 72673
Project: 72673
Buggy source:
/** 
 * Print the datum to standard out.  This is a port of gdp_datum_print from gdp/gdp_api.c by Eric Allman.
 * @param datum The datum to be printed.
 */
private static void _gdp_datum_print(gdp_datum datum){
  int length=-1;
  if (datum == null) {
    System.out.println("String_Node_Str");
  }
  System.out.print("String_Node_Str" + datum.recno);
  if (datum.dbuf == null) {
    System.out.print("String_Node_Str");
  }
 else {
    System.out.print("String_Node_Str" + datum.dlen + "String_Node_Str"+ length);
  }
  if (datum.ts.tv_sec != Long.MIN_VALUE) {
    System.out.print("String_Node_Str");
    System.out.print("String_Node_Str");
  }
 else {
    System.out.print("String_Node_Str");
  }
  if (length > 0) {
    System.out.print("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Print the datum to standard out.  This is a port of gdp_datum_print from gdp/gdp_api.c by Eric Allman.
 * @param datum The datum to be printed.
 */
private static void _gdp_datum_print(gdp_datum datum){
  Pointer d;
  NativeSizeT length=new NativeSizeT();
  length.setValue(-1);
  if (datum == null) {
    System.out.println("String_Node_Str");
  }
  System.out.print("String_Node_Str" + datum.recno);
  if (datum.dbuf == null) {
    System.out.print("String_Node_Str");
  }
 else {
    length=Event2Library.INSTANCE.evbuffer_get_length(new evbuffer(datum.dbuf.getValue()));
    System.out.print("String_Node_Str" + datum.dlen + "String_Node_Str"+ length);
    d=Event2Library.INSTANCE.evbuffer_pullup(new evbuffer(datum.dbuf.getValue()),new NativeLong(length.longValue()));
  }
  if (datum.ts.tv_sec != Long.MIN_VALUE) {
    System.out.print("String_Node_Str");
    System.out.print("String_Node_Str");
  }
 else {
    System.out.print("String_Node_Str");
  }
  if (length.longValue() > 0) {
    System.out.print("String_Node_Str");
  }
}
Program: 72675
Project: 72675
Buggy source:
/** 
 * Construct a AFDXESs with a name and a container. The container argument must not be null, or a NullPointerException will be thrown.  This actor will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the container is incompatiblewith this actor.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AFDXESs(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  bitRate=new Parameter(this,"String_Node_Str");
  bitRate.setDisplayName("String_Node_Str");
  bitRate.setExpression("String_Node_Str");
  bitRate.setTypeEquals(BaseType.DOUBLE);
  _bitRate=100;
  _tokenCount=0;
  _virtualLinkTable=new HashMap<String,AFDXVlink>();
  _portToVirtualLinks=new HashMap<IOPort,AFDXVlink>();
  _lastEmissionTable=new HashMap<String,Time>();
  _afdxVLinksQueue=new HashMap<String,LinkedList<TimedEvent>>();
  _afdxSchedMuxsQueue=new HashMap<String,LinkedList<TimedEvent>>();
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct a AFDXESs with a name and a container. The container argument must not be null, or a NullPointerException will be thrown.  This actor will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the container is incompatiblewith this actor.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AFDXESs(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  bitRate=new Parameter(this,"String_Node_Str");
  bitRate.setDisplayName("String_Node_Str");
  bitRate.setExpression("String_Node_Str");
  bitRate.setTypeEquals(BaseType.DOUBLE);
  _bitRate=100;
  _tokenCount=0;
  _virtualLinkTable=new HashMap<String,AFDXVlink>();
  _portToVirtualLinks=new HashMap<IOPort,AFDXVlink>();
  _lastEmissionTable=new HashMap<String,Time>();
  _afdxVLinksQueue=new LinkedHashMap<String,LinkedList<TimedEvent>>();
  _afdxSchedMuxsQueue=new HashMap<String,LinkedList<TimedEvent>>();
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 72677
Project: 72677
Buggy source:
/** 
 * Clone this actor into the specified workspace. The new actor is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is a new actor with the same ports as the original, but no connections and no container.  A container must be set before much can be done with this actor.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException If cloned ports cannot haveas their container the cloned entity (this should not occur), or if one of the attributes cannot be cloned.
 * @return A new AFDXESs.
 */
@Override public Object clone(Workspace workspace) throws CloneNotSupportedException {
  AFDXESs newObject=(AFDXESs)super.clone(workspace);
  newObject._afdxVLinksQueue=new HashMap();
  newObject._afdxSchedMuxsQueue=new HashMap();
  newObject._virtualLinkTable=new HashMap();
  newObject._portToVirtualLinks=new HashMap();
  newObject._lastEmissionTable=new HashMap();
  newObject._nextFireTime=_nextFireTime;
  newObject._bitRate=_bitRate;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone this actor into the specified workspace. The new actor is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is a new actor with the same ports as the original, but no connections and no container.  A container must be set before much can be done with this actor.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException If cloned ports cannot haveas their container the cloned entity (this should not occur), or if one of the attributes cannot be cloned.
 * @return A new AFDXESs.
 */
@Override public Object clone(Workspace workspace) throws CloneNotSupportedException {
  AFDXESs newObject=(AFDXESs)super.clone(workspace);
  newObject._afdxVLinksQueue=new LinkedHashMap();
  newObject._afdxSchedMuxsQueue=new HashMap();
  newObject._virtualLinkTable=new HashMap();
  newObject._portToVirtualLinks=new HashMap();
  newObject._lastEmissionTable=new HashMap();
  newObject._nextFireTime=_nextFireTime;
  newObject._bitRate=_bitRate;
  return newObject;
}
Program: 72679
Project: 72679
Buggy source:
/** 
 * Initialize the actor.
 * @exception IllegalActionException If the superclass throws it.
 */
@Override public void initialize() throws IllegalActionException {
  super.initialize();
  _nextFireTime=null;
  _afdxVLinksQueue=new HashMap();
  _virtualLinkTable=new HashMap();
  _lastEmissionTable=new HashMap();
  _afdxSchedMuxsQueue=new HashMap();
  _afdxVLinksQueue.clear();
  _virtualLinkTable.clear();
  _afdxSchedMuxsQueue.clear();
  _lastEmissionTable.clear();
}

Fixed version (ground truth):
/** 
 * Initialize the actor.
 * @exception IllegalActionException If the superclass throws it.
 */
@Override public void initialize() throws IllegalActionException {
  super.initialize();
  _nextFireTime=null;
  _afdxVLinksQueue=new LinkedHashMap();
  _virtualLinkTable=new HashMap();
  _lastEmissionTable=new HashMap();
  _afdxSchedMuxsQueue=new HashMap();
  _afdxVLinksQueue.clear();
  _virtualLinkTable.clear();
  _afdxSchedMuxsQueue.clear();
  _lastEmissionTable.clear();
}
Program: 72680
Project: 72680
Buggy source:
/** 
 * Reset the communication aspect and the receiver that we delegate to.
 */
@Override public void clear() throws IllegalActionException {
  communicationAspect.reset();
  _receiver.clear();
}

Fixed version (ground truth):
/** 
 * Reset the communication aspect and the receiver that we delegate to.
 */
@Override public void clear() throws IllegalActionException {
  communicationAspect.reset();
}
Program: 72681
Project: 72681
Buggy source:
/** 
 * Return a String representation of the DateToken. The string is surrounded by double-quotes; without them, the Ptolemy expression parser fails to parse it. <p>Unfortunately, the Java Date class has a fatal flaw in that Date.toString() does not return the value of the number of ms., so we use a format that includes the number of ms.</p>
 * @return A String representation of the DateToken.
 */
@Override public String toString(){
  if (isNil()) {
    return _NIL;
  }
  Calendar c=getCalendarInstance();
  _simpleDateFormat.setTimeZone(_timeZone);
  String timeString=_simpleDateFormat.format(c.getTime());
  return "String_Node_Str" + timeString.substring(0,timeString.length() - 9) + String.format("String_Node_Str",getMicrosecond())+ String.format("String_Node_Str",getNanosecond())+ timeString.substring(timeString.length() - 9)+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return a String representation of the DateToken. The string is surrounded by double-quotes; without them, the Ptolemy expression parser fails to parse it. <p>Unfortunately, the Java Date class has a fatal flaw in that Date.toString() does not return the value of the number of ms., so we use a format that includes the number of ms.</p>
 * @return A String representation of the DateToken.
 */
@Override public String toString(){
  if (isNil()) {
    return _NIL;
  }
  Calendar c=getCalendarInstance();
  _simpleDateFormat.setTimeZone(_timeZone);
  String timeString=_simpleDateFormat.format(c.getTime());
  String beforeTimeZone=timeString.substring(0,timeString.lastIndexOf("String_Node_Str"));
  beforeTimeZone=beforeTimeZone.substring(0,beforeTimeZone.lastIndexOf("String_Node_Str"));
  String remainder=timeString.substring(beforeTimeZone.length());
  return "String_Node_Str" + beforeTimeZone + String.format("String_Node_Str",getMicrosecond())+ String.format("String_Node_Str",getNanosecond())+ remainder+ "String_Node_Str";
}
Program: 72682
Project: 72682
Buggy source:
/** 
 * Clone the object into the specified workspace.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 */
@Override public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ExceptionEmailer newObject=(ExceptionEmailer)super.clone(workspace);
  try {
    _newline=new Parameter(newObject,"String_Node_Str");
    _newline.setExpression("String_Node_Str");
  }
 catch (  NameDuplicationException e) {
  }
catch (  IllegalActionException e2) {
  }
  newObject._password=null;
  newObject._props=null;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 */
@Override public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ExceptionEmailer newObject=(ExceptionEmailer)super.clone(workspace);
  newObject._newline=(Parameter)newObject.getAttribute("String_Node_Str");
  newObject._newline.setExpression("String_Node_Str");
  newObject._password=null;
  newObject._props=null;
  return newObject;
}
Program: 72683
Project: 72683
Buggy source:
/** 
 * Return true if this receiver has status known, that is, this receiver either is either known to have a token or known to not to have a token.
 * @return True if this receiver has status known.
 */
@Override public boolean isKnown(){
  return _known;
}

Fixed version (ground truth):
/** 
 * Return true if this receiver has status known, that is, this receiver either is either known to have a token or known to not to have a token.
 * @return True if this receiver has status known.
 */
@Override public boolean isKnown(){
  IOPort container=getContainer();
  if (container != null && container.sourcePortList().size() == 0 && container.insideSourcePortList().size() == 0) {
    return true;
  }
  return _known;
}
Program: 72684
Project: 72684
Buggy source:
/** 
 * Reset the receiver by deleting any contained tokens and setting the status of this receiver to unknown.  This is called by the , normally in its initialize() and postfire() methods.
 */
@Override public void reset(){
  _token=null;
  _known=false;
}

Fixed version (ground truth):
/** 
 * Reset the receiver by deleting any contained tokens and setting the status of this receiver to unknown, unless the containing port has no sources, in which case set to known and absent.  This is called by the , normally in its initialize() and postfire() methods.
 */
@Override public void reset(){
  _token=null;
  _known=false;
}
Program: 72685
Project: 72685
Buggy source:
/** 
 * Construct an algebraic loop solver.
 * @param variableNames Names of each break variable.
 * @param tolerance Tolerance for each variable.
 * @param maxIterations Maximum number of iterations.
 */
public NewtonRaphson(String[] variableNames,double[] tolerance,int maxIterations) throws IllegalActionException {
  super(variableNames,tolerance,maxIterations);
  _g=new double[_nVars];
  _deltaX=new double[tolerance.length];
  for (int i=0; i < tolerance.length; i++) {
    _deltaX[i]=1E-5;
  }
}

Fixed version (ground truth):
/** 
 * Construct an algebraic loop solver.
 * @param variableNames Names of each break variable.
 * @param tolerance Tolerance for each variable.
 * @param maxIterations Maximum number of iterations.
 */
public NewtonRaphson(String[] variableNames,double[] tolerance,int maxIterations) throws IllegalActionException {
  super(variableNames,tolerance,maxIterations);
  _f=new double[_nVars];
  _deltaX=new double[tolerance.length];
  for (int i=0; i < tolerance.length; i++) {
    _deltaX[i]=1E-5;
  }
}
Program: 72686
Project: 72686
Buggy source:
/** 
 * Return the new iterate of a Newton step. 
 * @param x The best known iterate.
 * @param g The function value g(x).
 * @return The new guess for the solution.
 * @exception IllegalActionException If the solver fails to find a solution.
 */
protected double[] _newtonStep(final double[] x,final double[] g) throws IllegalActionException {
  final int n=x.length;
  double[] xNew=new double[n];
  double[] gNew=new double[n];
  System.arraycopy(x,0,xNew,0,n);
  double[][] J=new double[n][n];
  for (int i=0; i < n; i++) {
    final double xOri=xNew[i];
    xNew[i]+=_deltaX[i];
    _evaluateLoopFunction(xNew,gNew);
    for (int k=0; k < n; k++) {
      J[i][k]=(gNew[k] - g[k]) / _deltaX[i];
    }
    xNew[i]=xOri;
  }
  final double det=DoubleMatrixMath.determinant(J);
  if (Math.abs(det) < 1E-5) {
    StringBuffer message=new StringBuffer();
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    for (    String name : _variableNames) {
      message.append("String_Node_Str");
      message.append(name);
      message.append("String_Node_Str");
    }
    message.append("String_Node_Str");
    message.append(DoubleMatrixMath.toString(J));
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    message.append(det);
    throw new IllegalActionException(message.toString());
  }
  if (n == 1) {
    final double d=-g[0] / J[0][0];
    xNew[0]=x[0] + d;
  }
 else {
    final double[] d=_gaussElimination(J,g);
    for (int i=0; i < n; i++)     xNew[i]=x[i] - d[i];
  }
  return xNew;
}

Fixed version (ground truth):
/** 
 * Return the new iterate of a Newton step. 
 * @param x The best known iterate.
 * @param f The function value f(x)=g(x)-x.
 * @return The new guess for the solution f(x) = 0.
 * @exception IllegalActionException If the solver fails to find a solution.
 */
protected double[] _newtonStep(final double[] x,final double[] f) throws IllegalActionException {
  final int n=x.length;
  double[] xNew=new double[n];
  double[] fNew=new double[n];
  System.arraycopy(x,0,xNew,0,n);
  double[][] J=new double[n][n];
  for (int i=0; i < n; i++) {
    final double xOri=xNew[i];
    xNew[i]+=_deltaX[i];
    _residual(xNew,fNew);
    for (int k=0; k < n; k++) {
      J[i][k]=(fNew[k] - f[k]) / _deltaX[i];
    }
    xNew[i]=xOri;
  }
  final double det=DoubleMatrixMath.determinant(J);
  if (Math.abs(det) < 1E-5) {
    StringBuffer message=new StringBuffer();
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    for (    String name : _variableNames) {
      message.append("String_Node_Str");
      message.append(name);
      message.append("String_Node_Str");
    }
    message.append("String_Node_Str");
    message.append(DoubleMatrixMath.toString(J));
    message.append("String_Node_Str");
    message.append("String_Node_Str");
    message.append(det);
    throw new IllegalActionException(message.toString());
  }
  if (n == 1) {
    final double d=-f[0] / J[0][0];
    xNew[0]=x[0] + d;
  }
 else {
    final double[] d=_gaussElimination(J,f);
    for (int i=0; i < n; i++)     xNew[i]=x[i] - d[i];
  }
  return xNew;
}
Program: 72687
Project: 72687
Buggy source:
/** 
 * The objective and constraints function evaluation method used in COBYLA2 minimization.
 * @param n Number of variables.
 * @param m Number of constraints.
 * @param x Variable values to be employed in function and constraints calculation.
 * @param con Calculated function values of the constraints.
 * @param terminate A boolean array that provides the terminate state. Only the first element of the array is read
 * @return Calculated objective function value.
 * @throws IllegalActionException 
 */
double Compute(int n,int m,double[] x,double[] con,boolean[] terminate) throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * The objective and constraints function evaluation method used in COBYLA2 minimization.
 * @param n Number of variables.
 * @param m Number of constraints.
 * @param x Variable values to be employed in function and constraints calculation.
 * @param con Calculated function values of the constraints.
 * @param terminate A boolean array that provides the terminate state. Only the first element of the array is read
 * @return Calculated objective function value.
 * @exception IllegalActionException 
 */
double Compute(int n,int m,double[] x,double[] con,boolean[] terminate) throws IllegalActionException ;
Program: 72689
Project: 72689
Buggy source:
/** 
 * Perform the collection operation.
 * @param handler The processor object to return results to.
 * @exception CollectionAbortedException The collection operation was aborted part way through.
 * @throws IllegalActionException 
 */
void collect(ResultHandler<T> handler) throws CollectionAbortedException, IllegalActionException ;

Fixed version (ground truth):
/** 
 * Perform the collection operation.
 * @param handler The processor object to return results to.
 * @exception CollectionAbortedException The collection operation was aborted part way through.
 * @exception IllegalActionException 
 */
void collect(ResultHandler<T> handler) throws CollectionAbortedException, IllegalActionException ;
Program: 72690
Project: 72690
Buggy source:
/** 
 * Convert a method that implements the Collector<> class with a standard Iterable<>, by collecting the results in a list, and returning an iterator to that list.
 * @throws IllegalActionException 
 */
public YieldAdapterIterable<T> adapt(Collector<T> client) throws IllegalActionException {
  final ArrayList<T> results=new ArrayList<T>();
  try {
    client.collect(new ResultHandler<T>(){
      public void handleResult(      T value){
        results.add(value);
      }
    }
);
  }
 catch (  CollectionAbortedException e) {
  }
  return new YieldAdapterIterable<T>(){
    public YieldAdapterIterator<T> iterator(){
      final Iterator<T> iterator=results.iterator();
      return new YieldAdapterIterator<T>(){
        public boolean hasNext(){
          return iterator.hasNext();
        }
        public T next(){
          return iterator.next();
        }
        public void remove(){
          iterator.remove();
        }
        public void dispose(){
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Convert a method that implements the Collector<> class with a standard Iterable<>, by collecting the results in a list, and returning an iterator to that list.
 * @exception IllegalActionException 
 */
public YieldAdapterIterable<T> adapt(Collector<T> client) throws IllegalActionException {
  final ArrayList<T> results=new ArrayList<T>();
  try {
    client.collect(new ResultHandler<T>(){
      public void handleResult(      T value){
        results.add(value);
      }
    }
);
  }
 catch (  CollectionAbortedException e) {
  }
  return new YieldAdapterIterable<T>(){
    public YieldAdapterIterator<T> iterator(){
      final Iterator<T> iterator=results.iterator();
      return new YieldAdapterIterator<T>(){
        public boolean hasNext(){
          return iterator.hasNext();
        }
        public T next(){
          return iterator.next();
        }
        public void remove(){
          iterator.remove();
        }
        public void dispose(){
        }
      }
;
    }
  }
;
}
Program: 72693
Project: 72693
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the <code>iteration</code> public member to the parameters of the new actor.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(workspace);
  newObject._addPathCommand=null;
  newObject._iterationCount=1;
  newObject._previousPath=null;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the <code>iteration</code> public member to the parameters of the new actor.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(workspace);
  newObject._addPathCommand=null;
  newObject._iterationCount=1;
  newObject._previousPath=null;
  newObject._inputTokens=new HashMap<String,Token>();
  return newObject;
}
Program: 72695
Project: 72695
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the <code>iteration</code> public member to the parameters of the new actor.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(workspace);
  newObject._addPathCommand=null;
  newObject._iterationCount=1;
  try {
    newObject._iteration.setContainer(null);
    newObject._iteration=new Variable(this,"String_Node_Str",new IntToken(1));
  }
 catch (  Throwable throwable) {
    throw new CloneNotSupportedException("String_Node_Str" + "String_Node_Str" + throwable);
  }
  newObject._previousPath=null;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the <code>iteration</code> public member to the parameters of the new actor.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(workspace);
  newObject._addPathCommand=null;
  newObject._iterationCount=1;
  newObject._previousPath=null;
  return newObject;
}
Program: 72697
Project: 72697
Buggy source:
public Token convert(Token t) throws IllegalActionException {
  return StringToken.convert(t);
}

Fixed version (ground truth):
public Token convert(Token t) throws IllegalActionException {
  return DateToken.convert(t);
}
Program: 72698
Project: 72698
Buggy source:
/** 
 * Construct an algebraic loop solver.
 * @param tolerance Tolerance for each variable.
 * @param maxIterations Maximum number of iterations.
 */
public AlgebraicLoopSolver(double[] tolerance,int maxIterations){
  _tolerance=tolerance;
  _maxIterations=maxIterations;
  _converged=false;
  _iterationCount=0;
  if (_isNewtonRaphson) {
    _deltaX=new double[tolerance.length];
    for (int i=0; i < tolerance.length; i++) {
      _tolerance[i]=1E-5;
      _deltaX[i]=1E-5;
    }
  }
}

Fixed version (ground truth):
/** 
 * Construct an algebraic loop solver.
 * @param variableNames Names of each break variable.
 * @param tolerance Tolerance for each variable.
 * @param maxIterations Maximum number of iterations.
 */
public AlgebraicLoopSolver(String[] variableNames,double[] tolerance,int maxIterations){
  _variableNames=variableNames;
  _tolerance=tolerance;
  _maxIterations=maxIterations;
  _converged=false;
  _iterationCount=0;
  if (_isNewtonRaphson) {
    _deltaX=new double[tolerance.length];
    for (int i=0; i < tolerance.length; i++) {
      _tolerance[i]=1E-5;
      _deltaX[i]=1E-5;
    }
  }
}
Program: 72699
Project: 72699
Buggy source:
/** 
 * Return the new iterate of a Newton step. 
 * @param x The best known iterate.
 * @return The new guess for the solution.
 * @exception IllegalActionException If an actor violates themonotonicity constraints, or the prefire() or fire() method of the actor throws it.
 * @exception IllegalArgumentException If the solver fails to find a solution.
 */
protected double[] _newtonStep(double[] x) throws IllegalActionException {
  final int n=x.length;
  double[] xNew=new double[n];
  System.arraycopy(x,0,xNew,0,n);
  double[][] J=new double[n][n];
  final double[] g=_evaluateLoopFunction(x);
  for (int i=0; i < n; i++) {
    final double xOri=xNew[i];
    xNew[i]+=_deltaX[i];
    final double[] gNew=_evaluateLoopFunction(xNew);
    for (int k=0; k < n; k++)     J[i][k]=(gNew[k] - g[k]) / _deltaX[i];
    xNew[i]=xOri;
  }
  final double det=DoubleMatrixMath.determinant(J);
  if (Math.abs(det) < 1E-5) {
    final String LS=System.getProperty("String_Node_Str");
    String em="String_Node_Str" + LS + "String_Node_Str"+ DoubleMatrixMath.toString(J)+ LS+ "String_Node_Str"+ det;
    throw new IllegalArgumentException(em);
  }
  if (n == 1) {
    final double d=-g[0] / J[0][0];
    xNew[0]=x[0] + d;
  }
 else {
    final double[] d=gaussElimination(J,g);
    for (int i=0; i < n; i++)     xNew[i]=x[i] - d[i];
  }
  return xNew;
}

Fixed version (ground truth):
/** 
 * Return the new iterate of a Newton step. 
 * @param x The best known iterate.
 * @return The new guess for the solution.
 * @exception IllegalActionException If the solver fails to find a solution.
 */
protected double[] _newtonStep(double[] x) throws IllegalActionException {
  final int n=x.length;
  double[] xNew=new double[n];
  System.arraycopy(x,0,xNew,0,n);
  double[][] J=new double[n][n];
  final double[] g=_evaluateLoopFunction(x);
  for (int i=0; i < n; i++) {
    final double xOri=xNew[i];
    xNew[i]+=_deltaX[i];
    final double[] gNew=_evaluateLoopFunction(xNew);
    for (int k=0; k < n; k++) {
      J[i][k]=(gNew[k] - g[k]) / _deltaX[i];
    }
    xNew[i]=xOri;
  }
  final double det=DoubleMatrixMath.determinant(J);
  if (Math.abs(det) < 1E-5) {
    final String LS=System.getProperty("String_Node_Str");
    String em="String_Node_Str" + LS + "String_Node_Str"+ LS;
    for (    String name : _variableNames) {
      em+="String_Node_Str" + name + LS;
    }
    em+="String_Node_Str" + DoubleMatrixMath.toString(J) + LS+ "String_Node_Str"+ det;
    throw new IllegalActionException(em);
  }
  if (n == 1) {
    final double d=-g[0] / J[0][0];
    xNew[0]=x[0] + d;
  }
 else {
    final double[] d=gaussElimination(J,g);
    for (int i=0; i < n; i++)     xNew[i]=x[i] - d[i];
  }
  return xNew;
}
Program: 72700
Project: 72700
Buggy source:
/** 
 * Solve the algebraic loop using the specified array as the initial guess for the variables being solved for and replace the contents of the specified array with the solution that is found.  <p> This method iterates until a solution is found. If it does not converge within the maximum number of iterations, it throws an IllegalActionException. A method that calls solve(double[] xInitial) can then call converged() to check whether the exception is thrown because of lack of convergence.
 * @param x Array with the initial values of the variables, to be replacedwith the solution by this method.
 * @exception IllegalActionException If the prefire() or fire() methodof an actor throws it.
 * @exception IllegalArgumentException If the solver fails to find a solution.
 */
public void solve(double[] x) throws IllegalActionException {
  _iterationCount=0;
  do {
    double[] xNew;
    if (_isNewtonRaphson) {
      xNew=_newtonStep(x);
    }
 else {
      xNew=_evaluateLoopFunction(x);
    }
    _iterationCount++;
    _converged=true;
    for (int i=0; i < x.length; i++) {
      double diff=x[i] - xNew[i];
      if (diff > _tolerance[i] || -diff > _tolerance[i]) {
        _converged=false;
        break;
      }
    }
    System.arraycopy(xNew,0,x,0,x.length);
    if (!_converged && _iterationCount > _maxIterations) {
      throw new RuntimeException("String_Node_Str" + _maxIterations + "String_Node_Str");
    }
  }
 while (!_converged && !_stopRequested);
}

Fixed version (ground truth):
/** 
 * Solve the algebraic loop using the specified array as the initial guess for the variables being solved for and replace the contents of the specified array with the solution that is found.  <p> This method iterates until a solution is found. If it does not converge within the maximum number of iterations, it throws an IllegalActionException. A method that calls solve(double[] xInitial) can then call converged() to check whether the exception is thrown because of lack of convergence.
 * @param x Array with the initial values of the variables, to be replacedwith the solution by this method.
 * @exception IllegalActionException If the prefire() or fire() methodof an actor throws it.
 * @exception IllegalActionException If the solver fails to find a solution.
 */
public void solve(double[] x) throws IllegalActionException {
  _iterationCount=0;
  do {
    double[] xNew;
    if (_isNewtonRaphson) {
      xNew=_newtonStep(x);
    }
 else {
      xNew=_evaluateLoopFunction(x);
    }
    _iterationCount++;
    _converged=true;
    for (int i=0; i < x.length; i++) {
      final double diff=Math.abs(x[i] - xNew[i]);
      if (diff > Math.max(_tolerance[i],diff * _tolerance[i])) {
        _converged=false;
        break;
      }
    }
    System.arraycopy(xNew,0,x,0,x.length);
    if (!_converged && _iterationCount > _maxIterations) {
      throw new IllegalActionException("String_Node_Str" + _maxIterations + "String_Node_Str");
    }
  }
 while (!_converged && !_stopRequested);
  if (_debugging && _converged) {
    _debug("String_Node_Str" + _iterationCount + "String_Node_Str");
  }
}
Program: 72701
Project: 72701
Buggy source:
/** 
 * Prefire and fire actors in the order given by the scheduler until the iteration converges. An iteration converges when a pass through the schedule does not change the status of any receiver.
 * @exception IllegalActionException If an actor violates themonotonicity constraints, or the prefire() or fire() method of the actor throws it.
 */
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  int i=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        Token t=receiver.get();
        if (t instanceof DoubleToken) {
          _x_n[i]=((DoubleToken)t).doubleValue();
          _tolerance[i]=_getErrorTolerance(port);
          i++;
        }
 else {
          throw new IllegalActionException("String_Node_Str" + t + "String_Node_Str"+ port.getName(getContainer()));
        }
      }
    }
  }
  int maxIterationsValue=((IntToken)(maxIterations.getToken())).intValue();
  AlgebraicLoopSolver solver=new AlgebraicLoopSolver(_tolerance,maxIterationsValue);
  try {
    solver.solve(_x_n);
  }
 catch (  IllegalArgumentException e) {
    throw new IllegalActionException(this,e.getMessage());
  }
  if (_debugging) {
    _debug(this.getFullName() + "String_Node_Str" + solver.getIterationCount()+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Prefire and fire actors in the order given by the scheduler until the iteration converges. An iteration converges when a pass through the schedule does not change the status of any receiver.
 * @exception IllegalActionException If an actor violates themonotonicity constraints, or the prefire() or fire() method of the actor throws it.
 */
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  int i=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        Token t=receiver.get();
        if (t instanceof DoubleToken) {
          _x_n[i]=((DoubleToken)t).doubleValue();
          i++;
        }
 else {
          throw new IllegalActionException("String_Node_Str" + t + "String_Node_Str"+ port.getName(getContainer()));
        }
      }
    }
  }
  _solver.solve(_x_n);
  if (_debugging) {
    _debug(this.getFullName() + "String_Node_Str" + _solver.getIterationCount()+ "String_Node_Str");
  }
}
Program: 72706
Project: 72706
Buggy source:
/** 
 * Execution aspects are decorators and this method recursively computes all entities inside a given container that are decorated by execution aspects.
 * @param container The container.
 * @return All entities to decorate.
 */
public static List<NamedObj> getEntitiesToDecorate(CompositeEntity container){
  List<NamedObj> toDecorate=new ArrayList<NamedObj>();
  for (  Object entity : container.entityList()) {
    if (!(entity instanceof ActorExecutionAspect)) {
      toDecorate.add((NamedObj)entity);
      if (entity instanceof CompositeEntity) {
        toDecorate.addAll(ExecutionAspectHelper.getEntitiesToDecorate((CompositeEntity)entity));
      }
    }
  }
  return toDecorate;
}

Fixed version (ground truth):
/** 
 * Execution aspects are decorators and this method recursively computes all entities inside a given container that are decorated by execution aspects.
 * @param container The container.
 * @return All entities to decorate.
 */
public static List<NamedObj> getEntitiesToDecorate(CompositeEntity container){
  List<NamedObj> toDecorate=new ArrayList<NamedObj>();
  for (  Object entity : container.entityList()) {
    if (!(entity instanceof ActorExecutionAspect || entity instanceof Director)) {
      toDecorate.add((NamedObj)entity);
      if (entity instanceof CompositeEntity) {
        toDecorate.addAll(ExecutionAspectHelper.getEntitiesToDecorate((CompositeEntity)entity));
      }
    }
  }
  return toDecorate;
}