nus-yam/ex-repair huggingface dataset:
Program: 74830
Project: 74830
Buggy source:
/** 
 * Create receivers and input variables for the input ports of this actor, and validate attributes of this actor, and attributes of the ports of this actor. Set current state to the initial state. Throw an exception if this actor does not contain a state with name specified by the <i>initialStateName</i> attribute.
 * @exception IllegalActionException If this actor does not contain astate with name specified by the <i>initialStateName</i> attribute.
 */
public void preinitialize() throws IllegalActionException {
  _stopRequested=false;
  _reachedFinalState=false;
  _createReceivers();
  _newIteration=true;
  _tokenListArrays=new Hashtable();
  _identifierToPort.clear();
  for (Iterator inputPorts=inputPortList().iterator(); inputPorts.hasNext(); ) {
    IOPort inPort=(IOPort)inputPorts.next();
    _setIdentifierToPort(inPort.getName(),inPort);
    _setIdentifierToPort(inPort.getName() + "String_Node_Str",inPort);
    _setIdentifierToPort(inPort.getName() + "String_Node_Str",inPort);
    for (int i=0; i < inPort.getWidth(); i++) {
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i,inPort);
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i+ "String_Node_Str",inPort);
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i+ "String_Node_Str",inPort);
    }
  }
  _inputTokenMap.clear();
  reset();
}

Fixed version (ground truth):
/** 
 * Create receivers and input variables for the input ports of this actor, and validate attributes of this actor, and attributes of the ports of this actor. Set current state to the initial state. Throw an exception if this actor does not contain a state with name specified by the <i>initialStateName</i> attribute.
 * @exception IllegalActionException If this actor does not contain astate with name specified by the <i>initialStateName</i> attribute.
 */
public void preinitialize() throws IllegalActionException {
  _stopRequested=false;
  _reachedFinalState=false;
  if (_receiversVersion != workspace().getVersion()) {
    _createReceivers();
    _receiversVersion=workspace().getVersion();
  }
 else {
    _resetReceivers();
  }
  _newIteration=true;
  _tokenListArrays=new Hashtable();
  _initialStateVersion=-1;
  _identifierToPort.clear();
  for (Iterator inputPorts=inputPortList().iterator(); inputPorts.hasNext(); ) {
    IOPort inPort=(IOPort)inputPorts.next();
    _setIdentifierToPort(inPort.getName(),inPort);
    _setIdentifierToPort(inPort.getName() + "String_Node_Str",inPort);
    _setIdentifierToPort(inPort.getName() + "String_Node_Str",inPort);
    for (int i=0; i < inPort.getWidth(); i++) {
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i,inPort);
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i+ "String_Node_Str",inPort);
      _setIdentifierToPort(inPort.getName() + "String_Node_Str" + i+ "String_Node_Str",inPort);
    }
  }
  _inputTokenMap.clear();
  reset();
}
Program: 74831
Project: 74831
Buggy source:
/** 
 * Create receivers for each input port.
 * @exception IllegalActionException If any port throws it.
 */
private void _createReceivers() throws IllegalActionException {
  Iterator inputPorts=inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort inPort=(IOPort)inputPorts.next();
    inPort.createReceivers();
  }
}

Fixed version (ground truth):
/** 
 * Create receivers for each input port. This method gets write permission on the workspace.
 * @exception IllegalActionException If any port throws it.
 */
private void _createReceivers() throws IllegalActionException {
  try {
    workspace().getWriteAccess();
    Iterator inputPorts=inputPortList().iterator();
    while (inputPorts.hasNext()) {
      IOPort inPort=(IOPort)inputPorts.next();
      inPort.createReceivers();
    }
  }
  finally {
    workspace().doneWriting();
  }
}
Program: 74832
Project: 74832
Buggy source:
/** 
 * Initialize this actor.  Goto initial state.
 * @exception IllegalActionException If a derived class throws it.
 */
public void initialize() throws IllegalActionException {
  reset();
  Iterator states=deepEntityList().iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    state.setVisited(false);
  }
}

Fixed version (ground truth):
/** 
 * Initialize this actor.  Goto initial state.
 * @exception IllegalActionException If a derived class throws it.
 */
public void initialize() throws IllegalActionException {
  reset();
  _receiversVersion=workspace().getVersion();
  Iterator states=deepEntityList().iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    state.setVisited(false);
  }
}
Program: 74834
Project: 74834
Buggy source:
/** 
 * @return True if this nested actor is ready to be created.
 * @exception PtalonRuntimeException If there isproblem accessing any parameters.
 */
public boolean isReady() throws PtalonRuntimeException {
  if (_unknownAssignments.size() > 0) {
    return false;
  }
  try {
    if (getType(_symbol).equals("String_Node_Str")) {
      PtalonParameter param=_actor.getPtalonParameter(_symbol);
      if (!param.hasValue()) {
        return false;
      }
    }
 else     if (!(getType(_symbol).equals("String_Node_Str") || getType(_symbol).equals("String_Node_Str"))) {
      throw new PtalonRuntimeException("String_Node_Str" + _symbol);
    }
    for (    String bool : _boolParams) {
      PtalonBoolParameter param=(PtalonBoolParameter)_actor.getAttribute(getMappedName(bool));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    String integer : _intParams) {
      PtalonIntParameter param=(PtalonIntParameter)_actor.getAttribute(getMappedName(integer));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    ActorTree child : _children) {
      if (!child.isReady()) {
        return false;
      }
    }
    return true;
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @return True if this nested actor is ready to be created.
 * @exception PtalonRuntimeException If there isproblem accessing any parameters.
 */
public boolean isReady() throws PtalonRuntimeException {
  for (  String portName : _unknownExpressions.keySet()) {
    if (evaluateString(_unknownExpressions.get(portName)) == null) {
      return false;
    }
  }
  try {
    if (getType(_symbol).equals("String_Node_Str")) {
      PtalonParameter param=_actor.getPtalonParameter(_symbol);
      if (!param.hasValue()) {
        return false;
      }
    }
 else     if (!(getType(_symbol).equals("String_Node_Str") || getType(_symbol).equals("String_Node_Str"))) {
      throw new PtalonRuntimeException("String_Node_Str" + _symbol);
    }
    for (    String bool : _boolParams) {
      PtalonBoolParameter param=(PtalonBoolParameter)_actor.getAttribute(getMappedName(bool));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    String integer : _intParams) {
      PtalonIntParameter param=(PtalonIntParameter)_actor.getAttribute(getMappedName(integer));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    ActorTree child : _children) {
      if (!child.isReady()) {
        return false;
      }
    }
    return true;
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}
Program: 74835
Project: 74835
Buggy source:
/** 
 * Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation.  This is not allowed in nested actor declarations, only top-level declarations. For instance, Foo(port := containing) port is okay, but not Bar(a := Foo(port := containing))
 * @param portName The name of the port in this 
 * @param connectPoint The name of the container's port or relation.
 * @exception PtalonScopeException If this is not a top-level actor declaration with respectto the assignment, or if connectPoint is not a port or relation.
 */
public void addPortAssign(String portName,String connectPoint) throws PtalonScopeException {
  if (_parent != null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  if (getType(connectPoint).equals("String_Node_Str")) {
    _relations.put(portName,connectPoint);
  }
 else   if (getType(connectPoint).endsWith("String_Node_Str")) {
    _ports.put(portName,connectPoint);
  }
 else {
    throw new PtalonScopeException(connectPoint + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation. Here 
 * @param portName The name of the port in this 
 * @param connectPointPrefix The name of the container's port or relation.
 * @param connectPointExpression The name of the container's port or relation.
 * @exception PtalonScopeException If this is not a top-level actor declaration with respectto the assignment, or if connectPoint is not a port or relation.
 */
public void addPortAssign(String portName,String connectPointPrefix,String connectPointExpression) throws PtalonScopeException {
  if (_parent != null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  _unknownPrefixes.put(portName,connectPointPrefix);
  _unknownExpressions.put(portName,connectPointExpression);
}
Program: 74838
Project: 74838
Buggy source:
/** 
 * Set the location without altering the modified status.
 * @param location The location.
 * @return True if the location was modified.
 * @exception IllegalActionException If the call to attributeChanged()throws it.
 */
private boolean _setLocation(double[] location) throws IllegalActionException {
  if (_location != null) {
    if (_location.length == location.length) {
      boolean match=true;
      for (int i=0; i < location.length; i++) {
        if (_location[i] != location[i]) {
          match=false;
          break;
        }
      }
      if (match) {
        return false;
      }
      if (_location.length != location.length) {
        _location=new double[location.length];
      }
    }
  }
 else {
    _location=new double[location.length];
  }
  if (location != null) {
    for (int i=0; i < location.length; i++) {
      _location[i]=location[i];
    }
  }
  NamedObj container=getContainer();
  if (container != null) {
    container.attributeChanged(this);
  }
  if (_valueListeners != null) {
    Iterator listeners=_valueListeners.iterator();
    while (listeners.hasNext()) {
      ValueListener listener=(ValueListener)listeners.next();
      listener.valueChanged(this);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Set the location without altering the modified status.
 * @param location The location.
 * @return True if the location was modified.
 * @exception IllegalActionException If the call to attributeChanged()throws it.
 */
private boolean _setLocation(double[] location) throws IllegalActionException {
  if (_location != null) {
    if (_location.length == location.length) {
      boolean match=true;
      for (int i=0; i < location.length; i++) {
        if (_location[i] != location[i]) {
          match=false;
          break;
        }
      }
      if (match) {
        return false;
      }
    }
 else {
      _location=new double[location.length];
    }
  }
 else {
    _location=new double[location.length];
  }
  if (location != null) {
    for (int i=0; i < location.length; i++) {
      _location[i]=location[i];
    }
  }
  NamedObj container=getContainer();
  if (container != null) {
    container.attributeChanged(this);
  }
  if (_valueListeners != null) {
    Iterator listeners=_valueListeners.iterator();
    while (listeners.hasNext()) {
      ValueListener listener=(ValueListener)listeners.next();
      listener.valueChanged(this);
    }
  }
  return true;
}
Program: 74839
Project: 74839
Buggy source:
/** 
 * Override the base class to ensure that the _default member points to the default refinement.
 * @param workspace The workspace for the new object.
 * @return A new Case.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Case newObject=(Case)super.clone(workspace);
  newObject._default=(Refinement)newObject.getEntity("String_Node_Str");
  newObject._current=newObject._default;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Override the base class to ensure that the _default member points to the default refinement.
 * @param workspace The workspace for the new object.
 * @return A new Case.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Case newObject=(Case)super.clone(workspace);
  newObject._default=(Refinement)newObject.getEntity("String_Node_Str");
  newObject._current=newObject._default;
  newObject._director=(CaseDirector)newObject.getAttribute("String_Node_Str");
  return newObject;
}
Program: 74840
Project: 74840
Buggy source:
private static void _copyModelRemoveGeneratorTableau(URL modelPathURL,File newModelFile) throws Exception {
  MoMLParser parser=new MoMLParser();
  List oldFilters=parser.getMoMLFilters();
  parser.setMoMLFilters(null);
  try {
    parser.addMoMLFilters(BackwardCompatibility.allFilters());
    RemoveGraphicalClasses removeGraphicalClasses=new RemoveGraphicalClasses();
    removeGraphicalClasses.clear();
    removeGraphicalClasses.put("String_Node_Str",null);
    parser.addMoMLFilter(removeGraphicalClasses);
    CompositeActor toplevel=null;
    toplevel=(CompositeActor)parser.parse(modelPathURL,modelPathURL);
    FileWriter writer=null;
    try {
      writer=new FileWriter(newModelFile);
      toplevel.exportMoML(writer);
    }
  finally {
      if (writer != null) {
        writer.close();
      }
    }
  }
  finally {
    parser.setMoMLFilters(oldFilters);
  }
}

Fixed version (ground truth):
private static void _copyModelRemoveGeneratorTableau(URL modelPathURL,File newModelFile) throws Exception {
  MoMLParser parser=new MoMLParser();
  List oldFilters=parser.getMoMLFilters();
  MoMLParser.setMoMLFilters(null);
  try {
    parser.addMoMLFilters(BackwardCompatibility.allFilters());
    RemoveGraphicalClasses removeGraphicalClasses=new RemoveGraphicalClasses();
    removeGraphicalClasses.clear();
    removeGraphicalClasses.put("String_Node_Str",null);
    parser.addMoMLFilter(removeGraphicalClasses);
    CompositeActor toplevel=null;
    toplevel=(CompositeActor)parser.parse(modelPathURL,modelPathURL);
    FileWriter writer=null;
    try {
      writer=new FileWriter(newModelFile);
      toplevel.exportMoML(writer);
    }
  finally {
      if (writer != null) {
        writer.close();
      }
    }
  }
  finally {
    parser.setMoMLFilters(oldFilters);
  }
}
Program: 74848
Project: 74848
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double alphaValue=((DoubleToken)alpha.getToken()).doubleValue();
  double betaValue=((DoubleToken)beta.getToken()).doubleValue();
  _current=_generator.nextDouble(alphaValue,betaValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double alphaValue=((DoubleToken)alpha.getToken()).doubleValue();
  double betaValue=((DoubleToken)beta.getToken()).doubleValue();
  _current=_generator.nextDouble(alphaValue,betaValue);
}
Program: 74849
Project: 74849
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int nValue=((IntToken)n.getToken()).intValue();
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextInt(nValue,pValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int nValue=((IntToken)n.getToken()).intValue();
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextInt(nValue,pValue);
}
Program: 74850
Project: 74850
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  double gammaValue=((DoubleToken)gamma.getToken()).doubleValue();
  double cutValue=((DoubleToken)cut.getToken()).doubleValue();
  _current=_generator.nextDouble(meanValue,gammaValue,cutValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  double gammaValue=((DoubleToken)gamma.getToken()).doubleValue();
  double cutValue=((DoubleToken)cut.getToken()).doubleValue();
  _current=_generator.nextDouble(meanValue,gammaValue,cutValue);
}
Program: 74851
Project: 74851
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double freedomValue=((DoubleToken)freedom.getToken()).doubleValue();
  _current=_generator.nextDouble(freedomValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double freedomValue=((DoubleToken)freedom.getToken()).doubleValue();
  _current=_generator.nextDouble(freedomValue);
}
Program: 74852
Project: 74852
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double lambdaValue=((DoubleToken)lambda.getToken()).doubleValue();
  _current=_generator.nextDouble(lambdaValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double lambdaValue=((DoubleToken)lambda.getToken()).doubleValue();
  _current=_generator.nextDouble(lambdaValue);
}
Program: 74853
Project: 74853
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double tauValue=((DoubleToken)tau.getToken()).doubleValue();
  _current=_generator.nextDouble(tauValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double tauValue=((DoubleToken)tau.getToken()).doubleValue();
  _current=_generator.nextDouble(tauValue);
}
Program: 74854
Project: 74854
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double alphaValue=((DoubleToken)alpha.getToken()).doubleValue();
  double lambdaValue=((DoubleToken)lambda.getToken()).doubleValue();
  _current=_generator.nextDouble(alphaValue,lambdaValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double alphaValue=((DoubleToken)alpha.getToken()).doubleValue();
  double lambdaValue=((DoubleToken)lambda.getToken()).doubleValue();
  _current=_generator.nextDouble(alphaValue,lambdaValue);
}
Program: 74855
Project: 74855
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int NValue=((IntToken)N.getToken()).intValue();
  int sValue=((IntToken)s.getToken()).intValue();
  int nValue=((IntToken)n.getToken()).intValue();
  _current=_generator.nextInt(NValue,sValue,nValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int NValue=((IntToken)N.getToken()).intValue();
  int sValue=((IntToken)s.getToken()).intValue();
  int nValue=((IntToken)n.getToken()).intValue();
  _current=_generator.nextInt(NValue,sValue,nValue);
}
Program: 74856
Project: 74856
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextDouble(pValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextDouble(pValue);
}
Program: 74857
Project: 74857
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int nValue=((IntToken)n.getToken()).intValue();
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextInt(nValue,pValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  int nValue=((IntToken)n.getToken()).intValue();
  double pValue=((DoubleToken)p.getToken()).doubleValue();
  _current=_generator.nextInt(nValue,pValue);
}
Program: 74858
Project: 74858
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  double standardDeviationValue=((DoubleToken)standardDeviation.getToken()).doubleValue();
  _generator.setState(meanValue,standardDeviationValue);
  _current=_generator.nextDouble();
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  double standardDeviationValue=((DoubleToken)standardDeviation.getToken()).doubleValue();
  _generator.setState(meanValue,standardDeviationValue);
  _current=_generator.nextDouble();
}
Program: 74859
Project: 74859
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  _current=_generator.nextInt(meanValue);
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  _current=_generator.nextInt(meanValue);
}
Program: 74860
Project: 74860
Buggy source:
/** 
 * Generate a new random number.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  _generator.setMean(meanValue);
  _current=_generator.nextInt();
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double meanValue=((DoubleToken)mean.getToken()).doubleValue();
  _generator.setMean(meanValue);
  _current=_generator.nextInt();
}
Program: 74861
Project: 74861
Buggy source:
/** 
 * Generate a new random number.
 * @exception If the parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double roValue=((DoubleToken)ro.getToken()).doubleValue();
  double pkValue=((DoubleToken)pk.getToken()).doubleValue();
  _generator.setState(roValue,pkValue);
  _current=_generator.nextInt();
}

Fixed version (ground truth):
/** 
 * Generate a new random number.
 * @exception IllegalActionException If the parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double roValue=((DoubleToken)ro.getToken()).doubleValue();
  double pkValue=((DoubleToken)pk.getToken()).doubleValue();
  _generator.setState(roValue,pkValue);
  _current=_generator.nextInt();
}
Program: 74864
Project: 74864
Buggy source:
/** 
 * Return the minimum of the step sizes suggested by any actors that were fired in current iteration.
 * @return The suggested next step size.
 */
public double suggestedStepSize(){
  double result=Double.POSITIVE_INFINITY;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      double candidate=((ContinuousStepSizeController)actor).suggestedStepSize();
      if (candidate < result) {
        result=candidate;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Iterator insideActors=((CompositeActor)actor).deepEntityList().iterator();
      while (insideActors.hasNext()) {
        Actor insideActor=(Actor)insideActors.next();
        if (insideActor instanceof ContinuousStepSizeController) {
          double candidate=((ContinuousStepSizeController)insideActor).suggestedStepSize();
          if (candidate < result) {
            result=candidate;
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return the minimum of the step sizes suggested by any actors that were fired in current iteration.
 * @return The suggested next step size.
 */
public double suggestedStepSize(){
  double result=Double.POSITIVE_INFINITY;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      double candidate=((ContinuousStepSizeController)actor).suggestedStepSize();
      if (candidate < result) {
        result=candidate;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Director director=actor.getDirector();
      if (director instanceof ContinuousStepSizeController) {
        double candidate=((ContinuousStepSizeController)director).suggestedStepSize();
        if (candidate < result) {
          result=candidate;
        }
      }
    }
  }
  return result;
}
Program: 74866
Project: 74866
Buggy source:
/** 
 * Return the minimum of the step sizes suggested by any actors that were fired in the current iteration.
 * @return The suggested refined step size.
 * @throws IllegalActionException If the step size cannot be further refined.
 */
public double refinedStepSize() throws IllegalActionException {
  double result=Double.POSITIVE_INFINITY;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      double candidate=((ContinuousStepSizeController)actor).refinedStepSize();
      if (candidate < result) {
        result=candidate;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Iterator insideActors=((CompositeActor)actor).deepEntityList().iterator();
      while (insideActors.hasNext()) {
        Actor insideActor=(Actor)insideActors.next();
        if (insideActor instanceof ContinuousStepSizeController) {
          double candidate=((ContinuousStepSizeController)insideActor).refinedStepSize();
          if (candidate < result) {
            result=candidate;
          }
        }
      }
    }
  }
  if (_distanceToBoundary > 0.0) {
    ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
    if (enclosingDirector != null) {
      double errorTolerance=enclosingDirector.getErrorTolerance();
      double currentStepSize=enclosingDirector.getCurrentStepSize();
      double refinedStepSize=(currentStepSize * currentStepSize / (currentStepSize + _distanceToBoundary));
      result=Math.min(result,refinedStepSize);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return the minimum of the step sizes suggested by any actors that were fired in the current iteration.
 * @return The suggested refined step size.
 * @throws IllegalActionException If the step size cannot be further refined.
 */
public double refinedStepSize() throws IllegalActionException {
  double result=Double.POSITIVE_INFINITY;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      double candidate=((ContinuousStepSizeController)actor).refinedStepSize();
      if (candidate < result) {
        result=candidate;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Director director=actor.getDirector();
      if (director instanceof ContinuousStepSizeController) {
        double candidate=((ContinuousStepSizeController)director).refinedStepSize();
        if (candidate < result) {
          result=candidate;
        }
      }
    }
  }
  if (_distanceToBoundary > 0.0) {
    ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
    if (enclosingDirector != null) {
      double errorTolerance=enclosingDirector.getErrorTolerance();
      double currentStepSize=enclosingDirector.getCurrentStepSize();
      double refinedStepSize=(currentStepSize * currentStepSize / (currentStepSize + _distanceToBoundary));
      result=Math.min(result,refinedStepSize);
    }
  }
  return result;
}
Program: 74867
Project: 74867
Buggy source:
/** 
 * Initialize this director.
 * @exception IllegalActionException If the superclass throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _actorsFired.clear();
}

Fixed version (ground truth):
/** 
 * Initialize this director.
 * @exception IllegalActionException If the superclass throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _actorsFired.clear();
  _disabledActors.clear();
}
Program: 74871
Project: 74871
Buggy source:
/** 
 * Read at most one token from each input channel and broadcast the one with the largest value to the <i>maximumValue</i>output. In addition, broadcast its channel number to the <i>channelNumber</i> output.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  ScalarToken result=null;
  int channelNum=-1;
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
      ScalarToken in=(ScalarToken)input.get(i);
      if (result == null) {
        result=in;
        channelNum=i;
      }
 else {
        if (result.isLessThan(in).booleanValue() == true) {
          result=in;
          channelNum=i;
        }
      }
    }
  }
  if (result != null) {
    maximumValue.broadcast(result);
    channelNumber.broadcast(new IntToken(channelNum));
  }
}

Fixed version (ground truth):
/** 
 * Read at most one token from each input channel and broadcast the one with the largest value to the <i>maximumValue</i>output. In addition, broadcast its channel number to the <i>channelNumber</i> output.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  ScalarToken result=null;
  ScalarToken resultMagnitude=null;
  ScalarToken inMagnitude=null;
  int channelNum=-1;
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
      ScalarToken in=(ScalarToken)input.get(i);
      if (in.getType() == BaseType.COMPLEX) {
        inMagnitude=in.absolute();
      }
 else {
        inMagnitude=in;
      }
      if (result == null) {
        result=in;
        resultMagnitude=inMagnitude;
        channelNum=i;
      }
 else {
        if (inMagnitude.isGreaterThan(resultMagnitude).booleanValue() == true) {
          result=in;
          resultMagnitude=inMagnitude;
          channelNum=i;
        }
      }
    }
  }
  if (result != null) {
    maximumValue.broadcast(result);
    channelNumber.broadcast(new IntToken(channelNum));
  }
}
Program: 74872
Project: 74872
Buggy source:
/** 
 * Read at most one token from each input channel and send the one with the least value to the output.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  ScalarToken result=null;
  int channelNum=-1;
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
      ScalarToken in=(ScalarToken)input.get(i);
      if (result == null) {
        result=in;
        channelNum=i;
      }
 else {
        if (in.isLessThan(result).booleanValue() == true) {
          result=in;
          channelNum=i;
        }
      }
    }
  }
  if (result != null) {
    minimumValue.broadcast(result);
    channelNumber.broadcast(new IntToken(channelNum));
  }
}

Fixed version (ground truth):
/** 
 * Read at most one token from each input channel and send the one with the least value to the output.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  ScalarToken result=null;
  ScalarToken resultMagnitude=null;
  ScalarToken inMagnitude=null;
  int channelNum=-1;
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
      ScalarToken in=(ScalarToken)input.get(i);
      if (in.getType() == BaseType.COMPLEX) {
        inMagnitude=in.absolute();
      }
 else {
        inMagnitude=in;
      }
      if (result == null) {
        result=in;
        resultMagnitude=inMagnitude;
        channelNum=i;
      }
 else {
        if (inMagnitude.isLessThan(resultMagnitude).booleanValue() == true) {
          result=in;
          resultMagnitude=inMagnitude;
          channelNum=i;
        }
      }
    }
  }
  if (result != null) {
    minimumValue.broadcast(result);
    channelNumber.broadcast(new IntToken(channelNum));
  }
}
Program: 74873
Project: 74873
Buggy source:
/** 
 * Output a JAIImageToken containing the image.
 * @exception IllegalActionException If a contained method throws it,or if the attempt to load the file has failed.
 */
public void fire() throws IllegalActionException {
  super.fire();
  InputStream inputStream=null;
  SeekableStream seekableStream=null;
  try {
    try {
      inputStream=_fileURL.openStream();
      seekableStream=new FileCacheSeekableStream(inputStream);
    }
 catch (    IOException ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str" + _fileURL + "String_Node_Str");
    }
    _outputtedImage=JAI.create("String_Node_Str",seekableStream);
  }
  finally {
    if (seekableStream != null) {
      try {
        seekableStream.close();
      }
 catch (      Throwable throwable2) {
        throw new IllegalActionException(this,throwable2,"String_Node_Str" + _fileURL + "String_Node_Str");
      }
    }
    if (inputStream != null) {
      try {
        inputStream.close();
      }
 catch (      Throwable throwable3) {
        throw new IllegalActionException(this,throwable3,"String_Node_Str" + _fileURL + "String_Node_Str");
      }
    }
  }
  output.send(0,new JAIImageToken(_outputtedImage));
}

Fixed version (ground truth):
/** 
 * Output a JAIImageToken containing the image.
 * @exception IllegalActionException If a contained method throws it,or if the attempt to load the file has failed.
 */
public void fire() throws IllegalActionException {
  super.fire();
  InputStream inputStream=null;
  SeekableStream seekableStream=null;
  try {
    try {
      inputStream=_fileURL.openStream();
      seekableStream=new FileCacheSeekableStream(inputStream);
    }
 catch (    IOException ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str" + _fileURL + "String_Node_Str");
    }
    _outputtedImage=JAI.create("String_Node_Str",seekableStream);
    _outputtedImage.getRendering();
  }
  finally {
    if (seekableStream != null) {
      try {
        seekableStream.close();
      }
 catch (      Throwable throwable2) {
        throw new IllegalActionException(this,throwable2,"String_Node_Str" + _fileURL + "String_Node_Str");
      }
    }
    if (inputStream != null) {
      try {
        inputStream.close();
      }
 catch (      Throwable throwable3) {
        throw new IllegalActionException(this,throwable3,"String_Node_Str" + _fileURL + "String_Node_Str");
      }
    }
  }
  output.send(0,new JAIImageToken(_outputtedImage));
}
Program: 74874
Project: 74874
Buggy source:
/** 
 * Add a reconciling listener to the list of reconciling listeners to be notified.
 * @param listener The reconciling listener to be added.
 */
public void addJavaReconcileListener(IJavaReconcilingListener listener){
synchronized (_reconcilingListeners) {
    _reconcilingListeners.add(listener);
  }
}

Fixed version (ground truth):
/** 
 * Add a reconciling listener to the list of reconciling listeners to be notified.
 * @param listener The reconciling listener to be added.
 * @see #removeJavaReconcileListener(IJavaReconcilingListener)
 */
public void addJavaReconcileListener(IJavaReconcilingListener listener){
synchronized (_reconcilingListeners) {
    _reconcilingListeners.add(listener);
  }
}
Program: 74875
Project: 74875
Buggy source:
/** 
 * Remove a reconciling listener from the list of reconciling listeners to be notified.
 * @param listener The reconciling listener to be removed.
 */
public void removeJavaReconcileListener(IJavaReconcilingListener listener){
synchronized (_reconcilingListeners) {
    _reconcilingListeners.remove(listener);
  }
}

Fixed version (ground truth):
/** 
 * Remove a reconciling listener from the list of reconciling listeners to be notified.
 * @param listener The reconciling listener to be removed.
 * @see #addJavaReconcileListener(IJavaReconcilingListener)
 */
public void removeJavaReconcileListener(IJavaReconcilingListener listener){
synchronized (_reconcilingListeners) {
    _reconcilingListeners.remove(listener);
  }
}
Program: 74876
Project: 74876
Buggy source:
/** 
 * Set the record list previous to this one. Its next record list is also set to this one.
 * @param previous The previous record list.
 * @see #_setNext(RecordList)
 */
protected void _setPrevious(RecordList previous){
  _previous=previous;
  if (previous != null) {
    previous._next=this;
  }
}

Fixed version (ground truth):
/** 
 * Set the record list previous to this one. Its next record list is also set to this one.
 * @param previous The previous record list.
 * @see #_setNext(ptolemy.backtrack.util.FieldRecord.RecordList)
 */
protected void _setPrevious(RecordList previous){
  _previous=previous;
  if (previous != null) {
    previous._next=this;
  }
}
Program: 74877
Project: 74877
Buggy source:
/** 
 * Set the record list next to this one. Its previous record list is also set to this one.
 * @param next The next record list.
 * @see #_setPrevious(RecordList)
 */
protected void _setNext(RecordList next){
  _next=next;
  if (next != null) {
    next._previous=this;
  }
}

Fixed version (ground truth):
/** 
 * Set the record list next to this one. Its previous record list is also set to this one.
 * @param next The next record list.
 * @see #_setPrevious(ptolemy.backtrack.util.FieldRecord.RecordList)
 */
protected void _setNext(RecordList next){
  _next=next;
  if (next != null) {
    next._previous=this;
  }
}
Program: 74878
Project: 74878
Buggy source:
/** 
 * Start traversing the children of this node by initializing the internal iterator.
 * @see {@link #hasMoreChildren()}
 * @see {@link #nextChild()}
 */
public void startTraverseChildren(){
  _iterator=_children.iterator();
}

Fixed version (ground truth):
/** 
 * Start traversing the children of this node by initializing the internal iterator.
 * @see #hasMoreChildren()
 * @see #nextChild()
 */
public void startTraverseChildren(){
  _iterator=_children.iterator();
}
Program: 74879
Project: 74879
Buggy source:
/** 
 * Return the next child to be traversed.
 * @return The next child.
 * @see {@link #hasMoreChildren()}
 * @see {@link #startTraverseChildren()};
 */
public ConfigXmlTree nextChild(){
  return (ConfigXmlTree)_iterator.next();
}

Fixed version (ground truth):
/** 
 * Return the next child to be traversed.
 * @return The next child.
 * @see #hasMoreChildren()
 * @see #startTraverseChildren()
 */
public ConfigXmlTree nextChild(){
  return (ConfigXmlTree)_iterator.next();
}
Program: 74880
Project: 74880
Buggy source:
/** 
 * Test whether there are more children to traverse.
 * @return true if there are more children to traverse; false, otherwise.
 * @see {@link #nextChild()}
 * @see {@link #startTraverseChildren()}
 */
public boolean hasMoreChildren(){
  return _iterator.hasNext();
}

Fixed version (ground truth):
/** 
 * Test whether there are more children to traverse.
 * @return true if there are more children to traverse; false, otherwise.
 * @see #nextChild()
 * @see #startTraverseChildren()
 */
public boolean hasMoreChildren(){
  return _iterator.hasNext();
}
Program: 74881
Project: 74881
Buggy source:
/** 
 * Process the instruction given in the data. This method only handles the "moml" target type.
 * @param target The target (the name at the start of the processinginstruction).
 * @param data The data, if any (the rest of the processing instruction).
 */
public void processingInstruction(String target,String data) throws Exception {
  if (target.equals("String_Node_Str")) {
    StringReader dataReader=new StringReader(data);
    XmlParser newParser=new XmlParser();
    ConfigXmlHandler newHandler=new ConfigXmlHandler(getCurrentTree(),getSystemId(),_includedClasses);
    newHandler.addExcludedFiles(_excludedFiles);
    newParser.setHandler(newHandler);
    newParser.parse(getSystemId(),null,dataReader);
    dataReader.close();
  }
}

Fixed version (ground truth):
/** 
 * Process the instruction given in the data. This method only handles the "moml" target type.
 * @param target The target (the name at the start of the processinginstruction).
 * @param data The data, if any (the rest of the processing instruction).
 * @exception Exception If the MoML parser throws an exception.
 */
public void processingInstruction(String target,String data) throws Exception {
  if (target.equals("String_Node_Str")) {
    StringReader dataReader=new StringReader(data);
    XmlParser newParser=new XmlParser();
    ConfigXmlHandler newHandler=new ConfigXmlHandler(getCurrentTree(),getSystemId(),_includedClasses);
    newHandler.addExcludedFiles(_excludedFiles);
    newParser.setHandler(newHandler);
    newParser.parse(getSystemId(),null,dataReader);
    dataReader.close();
  }
}
Program: 74882
Project: 74882
Buggy source:
/** 
 * Execute actions before the AST is traversed by   {@link TypeAnalyzer}.
 * @param analyzer The type analyzer.
 * @param root The root of the AST.
 * @see #afterTraverse(CompilationUnit)
 */
public abstract void beforeTraverse(TypeAnalyzer analyzer,CompilationUnit root);

Fixed version (ground truth):
/** 
 * Execute actions before the AST is traversed by   {@link TypeAnalyzer}.
 * @param analyzer The type analyzer.
 * @param root The root of the AST.
 * @see #afterTraverse(TypeAnalyzer,CompilationUnit)
 */
public abstract void beforeTraverse(TypeAnalyzer analyzer,CompilationUnit root);
Program: 74883
Project: 74883
Buggy source:
/** 
 * Read in one or more Java source files, parse them with the Eclipse parser, and output their AST structure to standard output.
 * @param args The names of Java source files.
 */
public static void main(String[] args) throws Exception {
  if (args.length == 0) {
    System.err.println("String_Node_Str" + "String_Node_Str");
  }
 else {
    Writer writer=new OutputStreamWriter(System.out);
    for (int i=0; i < args.length; i++) {
      String fileName=args[i];
      CompilationUnit root=ASTBuilder.parse(fileName);
      ASTDump dump=new ASTDump(writer);
      root.accept(dump);
    }
    writer.close();
  }
}

Fixed version (ground truth):
/** 
 * Read in one or more Java source files, parse them with the Eclipse parser, and output their AST structure to standard output.
 * @param args The names of Java source files.
 * @exception Exception If any error occurs.
 */
public static void main(String[] args) throws Exception {
  if (args.length == 0) {
    System.err.println("String_Node_Str" + "String_Node_Str");
  }
 else {
    Writer writer=new OutputStreamWriter(System.out);
    for (int i=0; i < args.length; i++) {
      String fileName=args[i];
      CompilationUnit root=ASTBuilder.parse(fileName);
      ASTDump dump=new ASTDump(writer);
      root.accept(dump);
    }
    writer.close();
  }
}
Program: 74884
Project: 74884
Buggy source:
/** 
 * Construct an AST exception with a message.
 * @param errorMessage The message.
 */
public ASTException(String message){
  super(message);
}

Fixed version (ground truth):
/** 
 * Construct an AST exception with a message.
 * @param message The message.
 */
public ASTException(String message){
  super(message);
}
Program: 74885
Project: 74885
Buggy source:
/** 
 * Add a record to the list at the given index.
 * @param indices The index.
 * @param record The record.
 */
protected void _addRecord(int index,Record record){
  RecordList list=new RecordList(record);
  list._setNext(_getTopState()._getRecords()[index]);
  _getTopState()._getRecords()[index]=list;
  _getTopState()._increaseTotalNum();
}

Fixed version (ground truth):
/** 
 * Add a record to the list at the given index.
 * @param index The index.
 * @param record The record.
 */
protected void _addRecord(int index,Record record){
  RecordList list=new RecordList(record);
  list._setNext(_getTopState()._getRecords()[index]);
  _getTopState()._getRecords()[index]=list;
  _getTopState()._increaseTotalNum();
}
Program: 74886
Project: 74886
Buggy source:
protected FieldRecordState(int dimensions){
  _records=new RecordList[dimensions + 1];
}

Fixed version (ground truth):
/** 
 * Construct a field record.
 * @param dimensions The number of dimensions of this field.
 */
protected FieldRecordState(int dimensions){
  _records=new RecordList[dimensions + 1];
}
Program: 74887
Project: 74887
Buggy source:
/** 
 * Set the Ptolemy path.
 * @param path
 * @see #getPtolemyPath()
 */
public static void setPtolemyPath(String path){
  _ptolemyPath=path;
  if ((_ptolemyPath != null) && !_ptolemyPath.equals("String_Node_Str") && !_ptolemyPath.endsWith("String_Node_Str" + File.separatorChar)&& !_ptolemyPath.endsWith("String_Node_Str")&& !_ptolemyPath.endsWith("String_Node_Str")) {
    _ptolemyPath+=File.separatorChar;
  }
}

Fixed version (ground truth):
/** 
 * Set the Ptolemy path.
 * @param path The Ptolemy path.
 * @see #getPtolemyPath()
 */
public static void setPtolemyPath(String path){
  _ptolemyPath=path;
  if ((_ptolemyPath != null) && !_ptolemyPath.equals("String_Node_Str") && !_ptolemyPath.endsWith("String_Node_Str" + File.separatorChar)&& !_ptolemyPath.endsWith("String_Node_Str")&& !_ptolemyPath.endsWith("String_Node_Str")) {
    _ptolemyPath+=File.separatorChar;
  }
}