nus-yam/ex-repair huggingface dataset:
Program: 75955
Project: 75955
Buggy source:
/** 
 * Get the actor associated with this Firing. The setActor() method is used to set the actor that this method returns. If setActor() was never called, then throw an exception.
 * @return The actor associated with this Firing.
 */
public Executable getActor(){
  return _actor;
}

Fixed version (ground truth):
/** 
 * Get the actor associated with this Firing. The setActor() method is used to set the actor that this method returns. If setActor() was never called, then throw an exception.
 * @return The actor associated with this Firing.
 */
public Actor getActor(){
  return _actor;
}
Program: 75957
Project: 75957
Buggy source:
/** 
 * Get the type of this variable. If a token has been set by setToken(), the returned type is the type of that token; If an expression has been set by setExpression(), and the expression can be evaluated, the returned type is the type the evaluation result. If the expression cannot be evaluated at this time, the returned type is the declared type of this Variable, which is either set by setTypeEquals(), or the default BaseType.NAT; If no token has been set by setToken(), no expression has been set by setExpression(), and setTypeEquals() has not been called, the returned type is BaseType.NAT.
 * @return The type of this variable.
 */
public Type getType(){
  try {
    _evaluate();
    return _varType;
  }
 catch (  IllegalActionException iae) {
    return _declaredType;
  }
}

Fixed version (ground truth):
/** 
 * Get the type of this variable. If a token has been set by setToken(), the returned type is the type of that token; If an expression has been set by setExpression(), and the expression can be evaluated, the returned type is the type the evaluation result. If the expression cannot be evaluated at this time, the returned type is the declared type of this Variable, which is either set by setTypeEquals(), or the default BaseType.NAT; If no token has been set by setToken(), no expression has been set by setExpression(), and setTypeEquals() has not been called, the returned type is BaseType.NAT.
 * @return The type of this variable.
 */
public Type getType(){
  try {
    if (_needsEvaluation)     _evaluate();
    return _varType;
  }
 catch (  IllegalActionException iae) {
    return _declaredType;
  }
}
Program: 75958
Project: 75958
Buggy source:
/** 
 * Get the token contained by this variable.  The type of the returned token is always that returned by getType().  Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public ptolemy.data.Token getToken() throws IllegalActionException {
  _evaluate();
  return _token;
}

Fixed version (ground truth):
/** 
 * Get the token contained by this variable.  The type of the returned token is always that returned by getType().  Calling this method will trigger evaluation of the expression, if the value has been given by setExpression(). Notice the evaluation of the expression can trigger an exception if the expression is not valid, or if the result of the expression violates type constraints specified by setTypeEquals() or setTypeAtMost(), or if the result of the expression is null and there are other variables that depend on this one. The returned value will be null if neither an expression nor a token has been set, or either has been set to null.
 * @return The token contained by this variable converted to thetype of this variable, or null if there is none.
 * @exception IllegalActionException If the expression cannotbe parsed or cannot be evaluated, or if the result of evaluation violates type constraints, or if the result of evaluation is null and there are variables that depend on this one.
 */
public ptolemy.data.Token getToken() throws IllegalActionException {
  if (_needsEvaluation)   _evaluate();
  return _token;
}
Program: 75959
Project: 75959
Buggy source:
/** 
 * Set up the taps and consumption and production constants.
 * @exception IllegalActionException If the parameters are out of range.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  double ebw=((DoubleToken)(excessBW.getToken())).doubleValue();
  int inter=((IntToken)(symbolInterval.getToken())).intValue();
  int len=((IntToken)(length.getToken())).intValue();
  boolean sqrt=((BooleanToken)(root.getToken())).booleanValue();
  if (ebw < 0.0) {
    throw new IllegalActionException(this,"String_Node_Str" + ebw + "String_Node_Str");
  }
  if (len <= 0) {
    throw new IllegalActionException(this,"String_Node_Str" + len + "String_Node_Str");
  }
  double[][] tps=new double[1][];
  double center=len * 0.5;
  DoubleUnaryOperation rcSg=sqrt ? (DoubleUnaryOperation)new SignalProcessing.SqrtRaisedCosineSampleGenerator(inter,ebw) : (DoubleUnaryOperation)new SignalProcessing.RaisedCosineSampleGenerator(inter,ebw);
  tps[0]=SignalProcessing.sampleWave(len,-center,1.0,rcSg);
  taps.setToken(new DoubleMatrixToken(tps));
  super.preinitialize();
}

Fixed version (ground truth):
/** 
 * Set up the taps and consumption and production constants.
 * @exception IllegalActionException If the parameters are out of range.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  double ebw=((DoubleToken)(excessBW.getToken())).doubleValue();
  int inter=((IntToken)(symbolInterval.getToken())).intValue();
  int len=((IntToken)(length.getToken())).intValue();
  boolean sqrt=((BooleanToken)(root.getToken())).booleanValue();
  if (ebw < 0.0) {
    throw new IllegalActionException(this,"String_Node_Str" + ebw + "String_Node_Str");
  }
  if (len <= 0) {
    throw new IllegalActionException(this,"String_Node_Str" + len + "String_Node_Str");
  }
  double[][] tps=new double[1][];
  double center=len * 0.5;
  DoubleUnaryOperation rcSg=sqrt ? (DoubleUnaryOperation)new SignalProcessing.SqrtRaisedCosineSampleGenerator(inter,ebw) : (DoubleUnaryOperation)new SignalProcessing.RaisedCosineSampleGenerator(inter,ebw);
  tps[0]=SignalProcessing.sampleWave(len,-center,1.0,rcSg);
  taps.setToken(new DoubleMatrixToken(tps));
}
Program: 75960
Project: 75960
Buggy source:
/** 
 * End the document. The MoMLParser calls this method once, when it has finished parsing the complete XML document. It is guaranteed that this will be the last method called in the XML parsing process. As a consequence, it is guaranteed that all dependencies between parameters used in the XML description are resolved.
 * @exception CancelException If an error occurs parsing one of theparameter values, and the user clicks on "cancel" to cancel the parse.
 */
public void endDocument() throws Exception {
  Iterator parameters=_paramsToParse.iterator();
  while (parameters.hasNext()) {
    Variable param=(Variable)parameters.next();
    try {
      param.getToken();
    }
 catch (    IllegalActionException ex) {
      MessageHandler.warning("String_Node_Str" + param.getFullName() + "String_Node_Str",ex);
    }
  }
  if (_unrecognized != null) {
    StringBuffer warning=new StringBuffer("String_Node_Str");
    Iterator elements=_unrecognized.iterator();
    while (elements.hasNext()) {
      warning.append("String_Node_Str" + elements.next().toString());
    }
    try {
      MessageHandler.warning(warning.toString());
    }
 catch (    CancelException ex) {
    }
  }
}

Fixed version (ground truth):
/** 
 * End the document. The MoMLParser calls this method once, when it has finished parsing the complete XML document. It is guaranteed that this will be the last method called in the XML parsing process. As a consequence, it is guaranteed that all dependencies between parameters used in the XML description are resolved.
 * @exception CancelException If an error occurs parsing one of theparameter values, and the user clicks on "cancel" to cancel the parse.
 */
public void endDocument() throws Exception {
  Iterator parameters=_paramsToParse.iterator();
  while (parameters.hasNext()) {
    Variable param=(Variable)parameters.next();
    try {
      param.propagate();
    }
 catch (    IllegalActionException ex) {
      MessageHandler.warning("String_Node_Str" + param.getFullName() + "String_Node_Str",ex);
    }
  }
  if (_unrecognized != null) {
    StringBuffer warning=new StringBuffer("String_Node_Str");
    Iterator elements=_unrecognized.iterator();
    while (elements.hasNext()) {
      warning.append("String_Node_Str" + elements.next().toString());
    }
    try {
      MessageHandler.warning(warning.toString());
    }
 catch (    CancelException ex) {
    }
  }
}
Program: 75962
Project: 75962
Buggy source:
/** 
 * Calculate the next random boolean for this iteration.
 * @exception IllegalActionException If the base class throws it.
 * @return True if it is ok to continue.
 */
public boolean prefire() throws IllegalActionException {
  double tp=((DoubleToken)(trueProbability.getToken())).doubleValue();
  double rawNum=_random.nextDouble();
  if (rawNum < tp) {
    _current=true;
  }
 else {
    _current=false;
  }
  return super.prefire();
}

Fixed version (ground truth):
/** 
 * Calculate the next random boolean for this iteration.
 * @exception IllegalActionException If the base class throws it.
 * @return True if it is ok to continue.
 */
public boolean prefire() throws IllegalActionException {
  if (_random.nextDouble() < ((DoubleToken)(trueProbability.getToken())).doubleValue()) {
    _current=true;
  }
 else {
    _current=false;
  }
  return super.prefire();
}
Program: 75963
Project: 75963
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Clock newObject=(Clock)super.clone(workspace);
  try {
    newObject.attributeChanged(newObject.offsets);
    newObject.attributeChanged(values);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elemTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Clock newObject=(Clock)super.clone(workspace);
  try {
    newObject.attributeChanged(newObject.offsets);
    newObject.attributeChanged(values);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elementTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}
Program: 75964
Project: 75964
Buggy source:
/** 
 * Notify the director that a type change has occurred that may affect the type of the output. This will cause type resolution to be redone when it is next needed. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the new values array has noelements in it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director dir=getDirector();
    if (dir != null) {
      dir.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Notify the director that a type change has occurred that may affect the type of the output. This will cause type resolution to be redone when it is next needed. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the new values array has noelements in it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director director=getDirector();
    if (director != null) {
      director.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}
Program: 75966
Project: 75966
Buggy source:
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Clock(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  period=new Parameter(this,"String_Node_Str",new DoubleToken(2.0));
  period.setTypeEquals(BaseType.DOUBLE);
  double defaultOffsets[][]={{0.0,1.0}};
  offsets=new Parameter(this,"String_Node_Str",new DoubleMatrixToken(defaultOffsets));
  offsets.setTypeEquals(BaseType.DOUBLE_MATRIX);
  attributeChanged(offsets);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elemTerm);
  attributeChanged(values);
}

Fixed version (ground truth):
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Clock(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  period=new Parameter(this,"String_Node_Str",new DoubleToken(2.0));
  period.setTypeEquals(BaseType.DOUBLE);
  double defaultOffsets[][]={{0.0,1.0}};
  offsets=new Parameter(this,"String_Node_Str",new DoubleMatrixToken(defaultOffsets));
  offsets.setTypeEquals(BaseType.DOUBLE_MATRIX);
  attributeChanged(offsets);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elementTerm);
  attributeChanged(values);
}
Program: 75967
Project: 75967
Buggy source:
/** 
 * Notify the director when a type change in the parameter occurs. This will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameter are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 */
public void attributeTypeChanged(Attribute attribute){
  Director dir=getDirector();
  if (dir != null) {
    dir.invalidateResolvedTypes();
  }
}

Fixed version (ground truth):
/** 
 * Notify the director when a type change in the parameter occurs. This will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameter are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 */
public void attributeTypeChanged(Attribute attribute){
  Director director=getDirector();
  if (director != null) {
    director.invalidateResolvedTypes();
  }
}
Program: 75968
Project: 75968
Buggy source:
/** 
 * Send the current value of the state of this actor to the output.
 * @exception IllegalActionException If send() throws it.
 */
public void fire() throws IllegalActionException {
  super.fire();
  Director dir=getDirector();
  output.send(0,new DoubleToken(dir.getCurrentTime()));
}

Fixed version (ground truth):
/** 
 * Send the current value of the state of this actor to the output.
 * @exception IllegalActionException If send() throws it.
 */
public void fire() throws IllegalActionException {
  super.fire();
  Director director=getDirector();
  output.send(0,new DoubleToken(director.getCurrentTime()));
}
Program: 75969
Project: 75969
Buggy source:
/** 
 * Return the speified number in decibels, but no less than <i>minValue</i>.
 */
private DoubleToken _doFunction(double number,double minValue) throws IllegalActionException {
  double outNumber;
  if (number <= 0.0) {
    outNumber=minValue;
  }
 else {
    outNumber=ptolemy.math.SignalProcessing.decibel(number);
    if (((BooleanToken)inputIsPower.getToken()).booleanValue()) {
      outNumber/=2.0;
    }
    if (outNumber < minValue) {
      outNumber=minValue;
    }
  }
  return new DoubleToken(outNumber);
}

Fixed version (ground truth):
/** 
 * Return the specified number in decibels, but no less than <i>minValue</i>.
 */
private DoubleToken _doFunction(double number,double minValue) throws IllegalActionException {
  double outNumber;
  if (number <= 0.0) {
    outNumber=minValue;
  }
 else {
    outNumber=ptolemy.math.SignalProcessing.decibel(number);
    if (((BooleanToken)inputIsPower.getToken()).booleanValue()) {
      outNumber/=2.0;
    }
    if (outNumber < minValue) {
      outNumber=minValue;
    }
  }
  return new DoubleToken(outNumber);
}
Program: 75970
Project: 75970
Buggy source:
/** 
 * Allow the type of <i>values</i> to change. This will cause the type of the output port to change. Notify the director, which will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameter are implemented by the container's change request mechanism, so they are implemented when it is safe to redo type resolution.
 * @param attribute The attribute whose type has changed.
 * @exception IllegalActionException If the base class throws itfor some parameter other than attribute.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Token value=((MatrixToken)values.getToken()).getElementAsToken(0,0);
    output.setTypeEquals(value.getType());
    Director dir=getDirector();
    if (dir != null) {
      dir.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Allow the type of <i>values</i> to change. This will cause the type of the output port to change. Notify the director, which will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameter are implemented by the container's change request mechanism, so they are implemented when it is safe to redo type resolution.
 * @param attribute The attribute whose type has changed.
 * @exception IllegalActionException If the base class throws itfor some parameter other than attribute.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Token value=((MatrixToken)values.getToken()).getElementAsToken(0,0);
    output.setTypeEquals(value.getType());
    Director director=getDirector();
    if (director != null) {
      director.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}
Program: 75971
Project: 75971
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param ws 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 ws) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(ws);
  newObject._iterationCount=1;
  newObject._time=(Variable)newObject.getAttribute("String_Node_Str");
  newObject._iteration=(Variable)newObject.getAttribute("String_Node_Str");
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Expression newObject=(Expression)super.clone(workspace);
  newObject._iterationCount=1;
  newObject._time=(Variable)newObject.getAttribute("String_Node_Str");
  newObject._iteration=(Variable)newObject.getAttribute("String_Node_Str");
  return newObject;
}
Program: 75972
Project: 75972
Buggy source:
/** 
 * Evaluate the expression and send its result to the output.
 * @exception IllegalActionException If the evaluation of the expressiontriggers it, or the evaluation yields a null result, or the evaluation yields an incompatible type, or if there is no director.
 */
public void fire() throws IllegalActionException {
  Director dir=getDirector();
  if (dir == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _time.setToken(new DoubleToken(dir.getCurrentTime()));
  Iterator inputPorts=inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort port=(IOPort)(inputPorts.next());
    if (port.getWidth() > 0) {
      if (port.hasToken(0)) {
        Token inputToken=port.get(0);
        Variable var=(Variable)(getAttribute(port.getName()));
        var.setToken(inputToken);
      }
    }
  }
  Token result=expression.getToken();
  if (result == null) {
    throw new IllegalActionException(this,"String_Node_Str" + expression.getExpression());
  }
  output.send(0,result);
}

Fixed version (ground truth):
/** 
 * Evaluate the expression and send its result to the output.
 * @exception IllegalActionException If the evaluation of the expressiontriggers it, or the evaluation yields a null result, or the evaluation yields an incompatible type, or if there is no director.
 */
public void fire() throws IllegalActionException {
  Director director=getDirector();
  if (director == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _time.setToken(new DoubleToken(director.getCurrentTime()));
  Iterator inputPorts=inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort port=(IOPort)(inputPorts.next());
    if (port.getWidth() > 0) {
      if (port.hasToken(0)) {
        Token inputToken=port.get(0);
        Variable var=(Variable)(getAttribute(port.getName()));
        var.setToken(inputToken);
      }
    }
  }
  Token result=expression.getToken();
  if (result == null) {
    throw new IllegalActionException(this,"String_Node_Str" + expression.getExpression());
  }
  output.send(0,result);
}
Program: 75973
Project: 75973
Buggy source:
/** 
 * Initialize the filter state vector with zero state.
 * @exception IllegalActionException If the base class throwsit.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  int stateSize=(int)java.lang.Math.max(_numerator.length,_denominator.length);
  _stateVector=new double[stateSize];
  _curTap=0;
}

Fixed version (ground truth):
/** 
 * Initialize the filter state vector with zero state.
 * @exception IllegalActionException If the base class throwsit.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  int stateSize=(int)java.lang.Math.max(_numerator.length,_denominator.length);
  _stateVector=new double[stateSize];
  _currentTap=0;
}
Program: 75975
Project: 75975
Buggy source:
/** 
 * Update the state of the actor and schedule the next firing, if appropriate.
 * @exception IllegalActionException If the director throws it whenscheduling the next firing.
 */
public boolean postfire() throws IllegalActionException {
  _currentOutputIndex=_tentativeCurrentOutputIndex;
  if (_boundaryCrossed) {
    double meanTimeValue=((DoubleToken)meanTime.getToken()).doubleValue();
    double exp=-Math.log((1 - Math.random())) * meanTimeValue;
    Director dir=getDirector();
    _nextFiringTime=dir.getCurrentTime() + exp;
    dir.fireAt(this,_nextFiringTime);
  }
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Update the state of the actor and schedule the next firing, if appropriate.
 * @exception IllegalActionException If the director throws it whenscheduling the next firing.
 */
public boolean postfire() throws IllegalActionException {
  _currentOutputIndex=_tentativeCurrentOutputIndex;
  if (_boundaryCrossed) {
    double meanTimeValue=((DoubleToken)meanTime.getToken()).doubleValue();
    double exp=-Math.log((1 - Math.random())) * meanTimeValue;
    Director director=getDirector();
    _nextFiringTime=director.getCurrentTime() + exp;
    director.fireAt(this,_nextFiringTime);
  }
  return super.postfire();
}
Program: 75976
Project: 75976
Buggy source:
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Poisson(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  meanTime=new Parameter(this,"String_Node_Str",new DoubleToken(1.0));
  meanTime.setTypeEquals(BaseType.DOUBLE);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elemTerm);
  attributeChanged(values);
}

Fixed version (ground truth):
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Poisson(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  meanTime=new Parameter(this,"String_Node_Str",new DoubleToken(1.0));
  meanTime.setTypeEquals(BaseType.DOUBLE);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elementTerm);
  attributeChanged(values);
}
Program: 75977
Project: 75977
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Poisson newObject=(Poisson)super.clone(workspace);
  try {
    newObject.attributeChanged(values);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elemTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Poisson newObject=(Poisson)super.clone(workspace);
  try {
    newObject.attributeChanged(values);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elementTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}
Program: 75978
Project: 75978
Buggy source:
/** 
 * If the parameter being changed is <i>values</i>, notify the director that type resolution may be invalid. This will cause type resolution to be redone when it is next needed. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the parent class throws it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director dir=getDirector();
    if (dir != null) {
      dir.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the parameter being changed is <i>values</i>, notify the director that type resolution may be invalid. This will cause type resolution to be redone when it is next needed. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the parent class throws it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director director=getDirector();
    if (director != null) {
      director.invalidateResolvedTypes();
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}
Program: 75979
Project: 75979
Buggy source:
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Pulse(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  indexes=new Parameter(this,"String_Node_Str",_defaultIndexToken);
  indexes.setTypeEquals(BaseType.INT_MATRIX);
  attributeChanged(indexes);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  repeat=new Parameter(this,"String_Node_Str",new BooleanToken(false));
  repeat.setTypeEquals(BaseType.BOOLEAN);
  attributeChanged(repeat);
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elemTerm);
  attributeChanged(values);
  _zero=new IntToken(0);
}

Fixed version (ground truth):
/** 
 * Construct an actor with the specified container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public Pulse(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  indexes=new Parameter(this,"String_Node_Str",_defaultIndexToken);
  indexes.setTypeEquals(BaseType.INT_MATRIX);
  attributeChanged(indexes);
  IntToken[] defaultValues=new IntToken[2];
  defaultValues[0]=new IntToken(1);
  defaultValues[1]=new IntToken(0);
  ArrayToken defaultValueToken=new ArrayToken(defaultValues);
  values=new Parameter(this,"String_Node_Str",defaultValueToken);
  values.setTypeEquals(new ArrayType(BaseType.ANY));
  repeat=new Parameter(this,"String_Node_Str",new BooleanToken(false));
  repeat.setTypeEquals(BaseType.BOOLEAN);
  attributeChanged(repeat);
  ArrayType valuesArrayType=(ArrayType)values.getType();
  InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
  output.setTypeAtLeast(elementTerm);
  attributeChanged(values);
  _zero=new IntToken(0);
}
Program: 75980
Project: 75980
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Pulse newObject=(Pulse)super.clone(workspace);
  try {
    newObject.attributeChanged(newObject.indexes);
    newObject.attributeChanged(newObject.values);
    newObject.attributeChanged(newObject.repeat);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elemTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elemTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer 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 {
  Pulse newObject=(Pulse)super.clone(workspace);
  try {
    newObject.attributeChanged(newObject.indexes);
    newObject.attributeChanged(newObject.values);
    newObject.attributeChanged(newObject.repeat);
    ArrayType valuesArrayType=(ArrayType)newObject.values.getType();
    InequalityTerm elementTerm=valuesArrayType.getElementTypeTerm();
    newObject.output.setTypeAtLeast(elementTerm);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex.getMessage());
  }
  return newObject;
}
Program: 75981
Project: 75981
Buggy source:
/** 
 * Notify the director that a type change has occurred that may affect the type of the output. This will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the new values array has noelements in it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director dir=getDirector();
    if (dir != null) {
      dir.invalidateResolvedTypes();
    }
    try {
      ArrayToken valuesArray=(ArrayToken)values.getToken();
      Token prototype=valuesArray.getElement(0);
      _zero=prototype.zero();
    }
 catch (    ArrayIndexOutOfBoundsException ex) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
catch (    ClassCastException ex) {
      throw new IllegalActionException(this,"String_Node_Str" + values.getToken());
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Notify the director that a type change has occurred that may affect the type of the output. This will cause type resolution to be redone at the next opportunity. It is assumed that type changes in the parameters are implemented by the director's change request mechanism, so they are implemented when it is safe to redo type resolution. If there is no director, then do nothing.
 * @exception IllegalActionException If the new values array has noelements in it.
 */
public void attributeTypeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == values) {
    Director director=getDirector();
    if (director != null) {
      director.invalidateResolvedTypes();
    }
    try {
      ArrayToken valuesArray=(ArrayToken)values.getToken();
      Token prototype=valuesArray.getElement(0);
      _zero=prototype.zero();
    }
 catch (    ArrayIndexOutOfBoundsException ex) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
catch (    ClassCastException ex) {
      throw new IllegalActionException(this,"String_Node_Str" + values.getToken());
    }
  }
 else {
    super.attributeTypeChanged(attribute);
  }
}
Program: 75982
Project: 75982
Buggy source:
/** 
 * If the argument is the levels parameter, check that the array is increasing and has the right dimension.  Recompute the quantization thresholds.
 * @exception IllegalActionException If the levels array is notincreasing, or it is not a row vector.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == levels) {
    double[][] lvls=((DoubleMatrixToken)levels.getToken()).doubleMatrix();
    if (lvls.length != 1 || lvls[0].length == 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    int length=lvls[0].length;
    for (int j=1; j < length; j++) {
      if (lvls[0][j] <= lvls[0][j - 1]) {
        throw new IllegalActionException(this,"String_Node_Str");
      }
    }
    _thresholds=new double[length - 1];
    for (int j=0; j < length - 1; j++) {
      _thresholds[j]=(lvls[0][j + 1] + lvls[0][j]) / 2.0;
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If the argument is the levels parameter, check that the array is increasing and has the right dimension.  Recompute the quantization thresholds.
 * @exception IllegalActionException If the levels array is notincreasing, or it is not a row vector.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == levels) {
    double[][] levelsArray=((DoubleMatrixToken)levels.getToken()).doubleMatrix();
    if (levelsArray.length != 1 || levelsArray[0].length == 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
    int length=levelsArray[0].length;
    for (int j=1; j < length; j++) {
      if (levelsArray[0][j] <= levelsArray[0][j - 1]) {
        throw new IllegalActionException(this,"String_Node_Str");
      }
    }
    _thresholds=new double[length - 1];
    for (int j=0; j < length - 1; j++) {
      _thresholds[j]=(levelsArray[0][j + 1] + levelsArray[0][j]) / 2.0;
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75983
Project: 75983
Buggy source:
/** 
 * Handle parameter change events on the <i>numerator</i> and <i>denominator</i> parameters. The filter state vector is reinitialized to zero state.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If this method is invokedwith an unrecognized parameter.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == numerator) {
    _numerator=(((DoubleMatrixToken)numerator.getToken()).doubleMatrix())[0];
  }
 else   if (attribute == denominator) {
    _denominator=(((DoubleMatrixToken)denominator.getToken()).doubleMatrix())[0];
    _denominator[0]=1.0;
  }
 else {
    throw new IllegalActionException(this,"String_Node_Str" + attribute.getName());
  }
  if ((_numerator != null) && (_denominator != null)) {
    int stateSize=(int)java.lang.Math.max(_numerator.length,_denominator.length);
    _stateVector=new double[stateSize];
  }
}

Fixed version (ground truth):
/** 
 * Handle parameter change events on the <i>numerator</i> and <i>denominator</i> parameters. The filter state vector is reinitialized to zero state.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If this method is invokedwith an unrecognized parameter.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == numerator) {
    _numerator=(((DoubleMatrixToken)numerator.getToken()).doubleMatrix())[0];
  }
 else   if (attribute == denominator) {
    _denominator=(((DoubleMatrixToken)denominator.getToken()).doubleMatrix())[0];
    _denominator[0]=1.0;
  }
 else {
    super.attributeChanged(attribute);
  }
  if ((_numerator != null) && (_denominator != null)) {
    int stateSize=(int)java.lang.Math.max(_numerator.length,_denominator.length);
    _stateVector=new double[stateSize];
  }
}
Program: 75984
Project: 75984
Buggy source:
/** 
 * Convert the argument token into an ArrayToken having this type, if losslessly conversion can be done. The argument can be an ArrayToken or a MatrixToken. If the argument is a MatrixToken, it will be converted to an ArrayToken containing a one dimensional token array if the MatrixToken has only one row, or it will be converted to an ArrayToken containing another ArrayToken (an array of arrays) if the MatrixToken has more than one row. If this type is a variable, convert the the argument into a substitution instance of this variable.
 * @param t A token.
 * @return An ArrayToken.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token t) throws IllegalActionException {
  if (!isCompatible(t)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  ArrayToken argArrTok;
  if (t instanceof MatrixToken) {
    argArrTok=fromMatrixToken((MatrixToken)t);
  }
 else {
    argArrTok=(ArrayToken)t;
  }
  if (isConstant()) {
    if (isEqualTo(argArrTok.getType())) {
      return argArrTok;
    }
 else {
      Token[] argArray=argArrTok.arrayValue();
      Token[] result=new Token[argArray.length];
      for (int i=0; i < argArray.length; i++) {
        result[i]=_elementType.convert(argArray[i]);
      }
      return new ArrayToken(result);
    }
  }
  if (isSubstitutionInstance(argArrTok.getType())) {
    return argArrTok;
  }
 else {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Convert the argument token into an ArrayToken having this type, if losslessly conversion can be done. The argument can be an ArrayToken or a MatrixToken. If the argument is a MatrixToken, it will be converted to an ArrayToken containing a one dimensional token array if the MatrixToken has only one row, or it will be converted to an ArrayToken containing another ArrayToken (an array of arrays) if the MatrixToken has more than one row.
 * @param t A token.
 * @return An ArrayToken.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token t) throws IllegalActionException {
  if (!isCompatible(t)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  ArrayToken argArrTok;
  if (t instanceof MatrixToken) {
    argArrTok=fromMatrixToken((MatrixToken)t);
  }
 else {
    argArrTok=(ArrayToken)t;
  }
  Token[] argArray=argArrTok.arrayValue();
  Token[] result=new Token[argArray.length];
  for (int i=0; i < argArray.length; i++) {
    result[i]=_elementType.convert(argArray[i]);
  }
  return new ArrayToken(result);
}
Program: 75988
Project: 75988
Buggy source:
/** 
 * Validate/invalidate the current schedule by giving a true/false argument. A true argument will indicate that the current schedule is valid and can be returned immediately when schedule() is called without running the scheduling algorithm. A false argument will invalidate it.
 * @param valid True to set the current schedule to valid.
 */
public void setValid(boolean valid){
  _valid=valid;
}

Fixed version (ground truth):
/** 
 * Validate/invalidate the current schedule by giving a true/false argument. A true argument will indicate that the current schedule is valid and can be returned immediately when schedule() is called without running the scheduling algorithm. A false argument will invalidate it.
 * @param valid True to set the current schedule to valid.
 */
public void setValid(boolean valid){
  _valid=valid;
  if (valid == false) {
    _cachedSchedule=null;
    _cachedGetSchedule=null;
  }
}