nus-yam/ex-repair huggingface dataset:
Program: 73755
Project: 73755
Buggy source:
/** 
 * Most of the constructor initialization is relegated to this method. Initialization process includes : - create a new actor table to cache all actors contained - create a new receiver table to cache all receivers contained - set default number of iterations - set period value
 */
private void _init(){
  try {
    Scheduler scheduler=new GraphicsScheduler(workspace());
    setScheduler(scheduler);
  }
 catch (  Exception ex) {
    throw new InternalErrorException(this,ex,"String_Node_Str");
  }
  try {
    iterationInterval=new Parameter(this,"String_Node_Str");
    iterationInterval.setExpression("String_Node_Str");
    iterationInterval.setTypeEquals(new ArrayType(BaseType.INT,2));
    iterationTimeLowerBound=new Parameter(this,"String_Node_Str",new IntToken(33));
    iterationTimeLowerBound.setTypeEquals(BaseType.INT);
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(this,throwable,"String_Node_Str");
  }
  try {
    pushMatrix=new PushMatrix(this);
    popMatrix=new PopMatrix(this);
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(this,throwable,"String_Node_Str");
  }
  _reset();
}

Fixed version (ground truth):
/** 
 * Most of the constructor initialization is relegated to this method. Initialization process includes : - create a new actor table to cache all actors contained - create a new receiver table to cache all receivers contained - set default number of iterations - set period value
 */
private void _init(){
  try {
    Scheduler scheduler=new JoglScheduler(workspace());
    setScheduler(scheduler);
  }
 catch (  Exception ex) {
    throw new InternalErrorException(this,ex,"String_Node_Str");
  }
  try {
    iterationInterval=new Parameter(this,"String_Node_Str");
    iterationInterval.setExpression("String_Node_Str");
    iterationInterval.setTypeEquals(new ArrayType(BaseType.INT,2));
    iterationTimeLowerBound=new Parameter(this,"String_Node_Str",new IntToken(33));
    iterationTimeLowerBound.setTypeEquals(BaseType.INT);
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(this,throwable,"String_Node_Str");
  }
  try {
    pushMatrix=new PushMatrix(this);
    popMatrix=new PopMatrix(this);
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(this,throwable,"String_Node_Str");
  }
  _reset();
}
Program: 73756
Project: 73756
Buggy source:
public PopMatrix(GraphicsDirector director){
  _director=director;
}

Fixed version (ground truth):
public PopMatrix(JoglDirector director){
  _director=director;
}
Program: 73757
Project: 73757
Buggy source:
/** 
 * Clone the director into the specified workspace. This calls the base class and then copies the parameter of this director. The new actor will have the same parameter values as the old.
 * @param workspace The workspace for the new object.
 * @return A new object.
 * @exception CloneNotSupportedException If one of the attributes cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  _reset();
  GraphicsDirector newObject=(GraphicsDirector)(super.clone(workspace));
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace. This calls the base class and then copies the parameter of this director. The new actor will have the same parameter values as the old.
 * @param workspace The workspace for the new object.
 * @return A new object.
 * @exception CloneNotSupportedException If one of the attributes cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  _reset();
  JoglDirector newObject=(JoglDirector)(super.clone(workspace));
  return newObject;
}
Program: 73758
Project: 73758
Buggy source:
/** 
 * Construct a depth-first firing schedule recursively. It first creates a new firing to add to the given schedule for the given actor. Then, it make a recursive call on each of the successors (sinks connected to the given actor). The successors are specified in the given directed acyclic graph constructed previously. If the given actor is null, return and do nothing.
 * @param schedule The given schedule to add the firings to.
 * @param dag The given directed acyclic graph of the model.
 * @param actorToAdd The given actor to add a firing to theschedule.
 */
private void _constructDepthFirstSchedule(Schedule schedule,DirectedAcyclicGraph dag,Object actorToAdd){
  JoglDirector director=(JoglDirector)getContainer();
  if (actorToAdd == null) {
    return;
  }
  Firing firing=new Firing();
  firing.setActor((Actor)actorToAdd);
  schedule.add(firing);
  for (  Object node : dag.successors(dag.node(actorToAdd))) {
    _constructDepthFirstSchedule(schedule,dag,((Node)node).getWeight());
  }
}

Fixed version (ground truth):
/** 
 * Construct a depth-first firing schedule recursively. It first creates a new firing to add to the given schedule for the given actor. Then, it make a recursive call on each of the successors (sinks connected to the given actor). The successors are specified in the given directed acyclic graph constructed previously. If the given actor is null, return and do nothing.
 * @param schedule The given schedule to add the firings to.
 * @param dag The given directed acyclic graph of the model.
 * @param actorToAdd The given actor to add a firing to theschedule.
 */
private void _constructDepthFirstSchedule(Schedule schedule,DirectedAcyclicGraph dag,Object actorToAdd){
  if (actorToAdd == null) {
    return;
  }
  Firing firing=new Firing();
  firing.setActor((Actor)actorToAdd);
  schedule.add(firing);
  for (  Object node : dag.successors(dag.node(actorToAdd))) {
    _constructDepthFirstSchedule(schedule,dag,((Node)node).getWeight());
  }
}
Program: 73760
Project: 73760
Buggy source:
/** 
 * Get the component entities from the Graph search pattern.
 * @return The component entities from the graph search pattern.
 */
public ArrayList<ComponentEntity> getComponentEntitiesList(){
  return _componentEntitiesList;
}

Fixed version (ground truth):
/** 
 * Get the component entities from the Graph search pattern.
 * @see #setComponentEntitiesList
 * @return The component entities from the graph search pattern.
 */
public ArrayList<ComponentEntity> getComponentEntitiesList(){
  return _componentEntitiesList;
}
Program: 73761
Project: 73761
Buggy source:
/** 
 * Set the relations from the Graph search pattern.
 * @param relationsList The relations from the graph search pattern.
 */
public void setRelationsList(ArrayList<Relation> relationsList){
  _relationsList=relationsList;
}

Fixed version (ground truth):
/** 
 * Set the relations from the Graph search pattern.
 * @see #getRelationsList
 * @param relationsList The relations from the graph search pattern.
 */
public void setRelationsList(ArrayList<Relation> relationsList){
  _relationsList=relationsList;
}
Program: 73762
Project: 73762
Buggy source:
/** 
 * Get the relations from the Graph search pattern.
 * @return The relations from the graph search pattern.
 */
public ArrayList<Relation> getRelationsList(){
  return _relationsList;
}

Fixed version (ground truth):
/** 
 * Get the relations from the Graph search pattern.
 * @see #setRelationsList
 * @return The relations from the graph search pattern.
 */
public ArrayList<Relation> getRelationsList(){
  return _relationsList;
}
Program: 73763
Project: 73763
Buggy source:
/** 
 * Set the component entities from the Graph search pattern.
 * @param componentEntitiesList The component entities from the graphsearch pattern.
 */
public void setComponentEntitiesList(ArrayList<ComponentEntity> componentEntitiesList){
  _componentEntitiesList=componentEntitiesList;
}

Fixed version (ground truth):
/** 
 * Set the component entities from the Graph search pattern.
 * @see #getComponentEntitiesList
 * @param componentEntitiesList The component entities from the graphsearch pattern.
 */
public void setComponentEntitiesList(ArrayList<ComponentEntity> componentEntitiesList){
  _componentEntitiesList=componentEntitiesList;
}
Program: 73764
Project: 73764
Buggy source:
/** 
 * Set the composite entities from the graph search pattern. 
 * @param compositeEntitiesList The composite entities from the graph searchpattern.
 */
public void setCompositeEntities(ArrayList<CompositeEntity> compositeEntitiesList){
  _compositeEntitiesList=compositeEntitiesList;
}

Fixed version (ground truth):
/** 
 * Set the composite entities from the graph search pattern. 
 * @see #getCompositeEntities
 * @param compositeEntitiesList The composite entities from the graph searchpattern.
 */
public void setCompositeEntities(ArrayList<CompositeEntity> compositeEntitiesList){
  _compositeEntitiesList=compositeEntitiesList;
}
Program: 73765
Project: 73765
Buggy source:
/** 
 * Get the composite entities form the graph search pattern. 
 * @return The composite entities from the graph search pattern. 
 */
public ArrayList<CompositeEntity> getCompositeEntities(){
  return _compositeEntitiesList;
}

Fixed version (ground truth):
/** 
 * Get the composite entities form the graph search pattern. 
 * @see #setCompositeEntities
 * @return The composite entities from the graph search pattern. 
 */
public ArrayList<CompositeEntity> getCompositeEntities(){
  return _compositeEntitiesList;
}
Program: 73766
Project: 73766
Buggy source:
/** 
 * Get the ports from the Graph search pattern.
 * @return The ports from the graph search pattern.
 */
public ArrayList<Port> getPortsList(){
  return _portsList;
}

Fixed version (ground truth):
/** 
 * Get the ports from the Graph search pattern.
 * @see #setPortsList
 * @return The ports from the graph search pattern.
 */
public ArrayList<Port> getPortsList(){
  return _portsList;
}
Program: 73767
Project: 73767
Buggy source:
/** 
 * Set the ports from the Graph search pattern.
 * @param portsList The ports from the graph search pattern.
 */
public void setPortsList(ArrayList<Port> portsList){
  _portsList=portsList;
}

Fixed version (ground truth):
/** 
 * Set the ports from the Graph search pattern.
 * @see #getPortsList
 * @param portsList The ports from the graph search pattern.
 */
public void setPortsList(ArrayList<Port> portsList){
  _portsList=portsList;
}
Program: 73768
Project: 73768
Buggy source:
/** 
 * Get the search command criteria from the search criteria.
 * @return The XQuery search command input by the user.
 */
public String getSearchCommand(){
  return _searchCommand;
}

Fixed version (ground truth):
/** 
 * Get the search command criteria from the search criteria.
 * @see #setSearchCommand
 * @return The XQuery search command input by the user.
 */
public String getSearchCommand(){
  return _searchCommand;
}
Program: 73769
Project: 73769
Buggy source:
/** 
 * Get the attributes criteria from the search criteria.
 * @return All the attributes input by the user as the search criteria.
 */
public ArrayList<Attribute> getAttributes(){
  return _attributes;
}

Fixed version (ground truth):
/** 
 * Get the attributes criteria from the search criteria.
 * @see #setAttributes
 * @return All the attributes input by the user as the search criteria.
 */
public ArrayList<Attribute> getAttributes(){
  return _attributes;
}
Program: 73770
Project: 73770
Buggy source:
/** 
 * Set the XQuery search command for the search criteria.
 * @param searchCommand The XQuery search command to set in the searchcriteria.
 */
public void setSearchCommand(String searchCommand){
  this._searchCommand=searchCommand;
}

Fixed version (ground truth):
/** 
 * Set the XQuery search command for the search criteria.
 * @see #getSearchCommand
 * @param searchCommand The XQuery search command to set in the searchcriteria.
 */
public void setSearchCommand(String searchCommand){
  this._searchCommand=searchCommand;
}
Program: 73771
Project: 73771
Buggy source:
/** 
 * Get the graph search criteria from the search criteria.
 * @return The graph search criteria input by the user.
 */
public DBGraphSearchCriteria getDBGraphSearchCriteria(){
  return _dbGraphSearchCriteria;
}

Fixed version (ground truth):
/** 
 * Get the graph search criteria from the search criteria.
 * @see #setDBGraphSearchCriteria
 * @return The graph search criteria input by the user.
 */
public DBGraphSearchCriteria getDBGraphSearchCriteria(){
  return _dbGraphSearchCriteria;
}
Program: 73772
Project: 73772
Buggy source:
/** 
 * Set the attribute criteria for the search criteria.
 * @param attributes The attributes input by the user to set in thesearch criteria.
 */
public void setAttributes(ArrayList<Attribute> attributes){
  this._attributes=attributes;
}

Fixed version (ground truth):
/** 
 * Set the attribute criteria for the search criteria.
 * @see #getAttributes
 * @param attributes The attributes input by the user to set in thesearch criteria.
 */
public void setAttributes(ArrayList<Attribute> attributes){
  this._attributes=attributes;
}
Program: 73773
Project: 73773
Buggy source:
/** 
 * Set the graph search criteria for the search criteria.
 * @param dbGraphSearchCriteria The graph search criteria input by the userto set in the search criteria.
 */
public void setDBGraphSearchCriteria(DBGraphSearchCriteria dbGraphSearchCriteria){
  _dbGraphSearchCriteria=dbGraphSearchCriteria;
}

Fixed version (ground truth):
/** 
 * Set the graph search criteria for the search criteria.
 * @see #getDBGraphSearchCriteria
 * @param dbGraphSearchCriteria The graph search criteria input by the userto set in the search criteria.
 */
public void setDBGraphSearchCriteria(DBGraphSearchCriteria dbGraphSearchCriteria){
  _dbGraphSearchCriteria=dbGraphSearchCriteria;
}
Program: 73774
Project: 73774
Buggy source:
private void _update(Actor actor) throws NotSchedulableException {
  _SequenceInfo actorSeqInfo=_sequenceInfos.get(actor);
  int actorDistance=actorSeqInfo.distance;
  Iterator ports=actor.outputPortList().iterator();
  if (ports.hasNext() && _maxDistance <= actorDistance) {
    _maxDistance=actorDistance + 1;
  }
  while (ports.hasNext()) {
    IOPort port=(IOPort)ports.next();
    Iterator deepConnectedInPortList=port.deepConnectedInPortList().iterator();
    while (deepConnectedInPortList.hasNext()) {
      Port deepConnectedPort=(Port)deepConnectedInPortList.next();
      Actor connectedActor=(Actor)deepConnectedPort.getContainer();
      _SequenceInfo _SequenceInfo=_sequenceInfos.get(connectedActor);
      if (_SequenceInfo == null) {
        _sequenceInfos.put(connectedActor,new _SequenceInfo(actorDistance + 1,false,true));
        _unsettled.add(connectedActor);
      }
 else       if (_SequenceInfo.distance < actorDistance + 1) {
        _unsettled.add(connectedActor);
        _SequenceInfo.distance=actorDistance + 1;
        if (_SequenceInfo.isFixed) {
          _SequenceInfo.changed=true;
        }
      }
    }
  }
  _unsettled.remove(actor);
}

Fixed version (ground truth):
private void _update(Actor actor) throws NotSchedulableException {
  _SequenceInfo actorSeqInfo=_sequenceInfos.get(actor);
  int actorDistance=actorSeqInfo.distance;
  List portList=actor.outputPortList();
  if (portList != null) {
    Iterator ports=portList.iterator();
    if (ports.hasNext() && _maxDistance <= actorDistance) {
      _maxDistance=actorDistance + 1;
    }
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      Iterator deepConnectedInPortList=port.deepConnectedInPortList().iterator();
      while (deepConnectedInPortList.hasNext()) {
        Port deepConnectedPort=(Port)deepConnectedInPortList.next();
        Actor connectedActor=(Actor)deepConnectedPort.getContainer();
        _SequenceInfo _SequenceInfo=_sequenceInfos.get(connectedActor);
        if (_SequenceInfo == null) {
          _sequenceInfos.put(connectedActor,new _SequenceInfo(actorDistance + 1,false,true));
          _unsettled.add(connectedActor);
        }
 else         if (_SequenceInfo.distance < actorDistance + 1) {
          _unsettled.add(connectedActor);
          _SequenceInfo.distance=actorDistance + 1;
          if (_SequenceInfo.isFixed) {
            _SequenceInfo.changed=true;
          }
        }
      }
    }
  }
  _unsettled.remove(actor);
}
Program: 73775
Project: 73775
Buggy source:
private void _initSequencedActors(List<SequenceAttribute> independentList){
  Iterator sequenceAttributes=independentList.iterator();
  while (sequenceAttributes.hasNext()) {
    SequenceAttribute attribute=(SequenceAttribute)sequenceAttributes.next();
    int sequenceNumber=attribute.getSequenceNumber();
    _SequenceInfo info=new _SequenceInfo(sequenceNumber,true,false);
    info.original=sequenceNumber;
    Actor actor=(Actor)attribute.getContainer();
    _sequenceInfos.put(actor,info);
    _unsettled.add(actor);
  }
}

Fixed version (ground truth):
private void _initSequencedActors(List<SequenceAttribute> independentList){
  if (independentList != null) {
    Iterator sequenceAttributes=independentList.iterator();
    while (sequenceAttributes.hasNext()) {
      SequenceAttribute attribute=(SequenceAttribute)sequenceAttributes.next();
      int sequenceNumber=attribute.getSequenceNumber();
      _SequenceInfo info=new _SequenceInfo(sequenceNumber,true,false);
      info.original=sequenceNumber;
      Actor actor=(Actor)attribute.getContainer();
      _sequenceInfos.put(actor,info);
      _unsettled.add(actor);
    }
  }
}
Program: 73776
Project: 73776
Buggy source:
private Actor _selectActor(){
  Iterator it=_unsettled.iterator();
  int max=0;
  Actor result=null;
  while (it.hasNext()) {
    Actor actor=(Actor)it.next();
    _SequenceInfo info=_sequenceInfos.get(actor);
    int dist=info.distance;
    if (actor == null || dist > max) {
      result=actor;
      max=dist;
    }
  }
  return result;
}

Fixed version (ground truth):
private Actor _selectActor(){
  Iterator it=_unsettled.iterator();
  int max=-1;
  Actor result=null;
  while (it.hasNext()) {
    Actor actor=(Actor)it.next();
    _SequenceInfo info=_sequenceInfos.get(actor);
    int dist=info.distance;
    if (actor == null || dist > max) {
      result=actor;
      max=dist;
    }
  }
  return result;
}
Program: 73777
Project: 73777
Buggy source:
/** 
 * Estimate a sequenced schedule. Currently only supports basic Dijkstra  algorithm for getting the maximal distances. Thus, it cannot deal with cyclic graphs.
 * @param independentList The already present SequenceAttributes for theActors controlled by this scheduler.
 * @return A vector with the ordered actors. Note that the sequence numbersare not changed. This has to be done somewhere else.
 * @exception NotSchedulableException If the schedule is acyclic.
 */
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList) throws NotSchedulableException {
  if (_actorGraph.isAcyclic()) {
    return _estimator.estimateSequencedSchedule(independentList);
  }
 else {
    throw new NotSchedulableException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Estimate a sequenced schedule. Currently only supports basic Dijkstra  algorithm for getting the maximal distances. Thus, it cannot deal with cyclic graphs.
 * @param independentList The already present SequenceAttributes for theActors controlled by this scheduler.
 * @return A vector with the ordered actors. Note that the sequence numbersare not changed. This has to be done somewhere else.
 * @exception NotSchedulableException If the schedule is acyclic.
 */
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList) throws NotSchedulableException {
  if (_actorGraph == null) {
    return _estimator.estimateSequencedSchedule(independentList);
  }
 else   if (_actorGraph.isAcyclic()) {
    return _estimator.estimateSequencedSchedule(independentList);
  }
 else {
    throw new NotSchedulableException("String_Node_Str");
  }
}
Program: 73780
Project: 73780
Buggy source:
public SequentialScheduleEditorPane(Schedule schedule){
  super(new BorderLayout());
  _init();
  Iterator firings=schedule.actorIterator();
  while (firings.hasNext()) {
    Object actor=firings.next();
    _listModel.addElement(actor);
  }
}

Fixed version (ground truth):
/** 
 * Construct a SequentialScheduleEditorPane displaying the actors  contained in the given schedule and in the order given by the schedule. 
 * @param schedule The schedule for the actors to be displayed in the pane.
 */
public SequentialScheduleEditorPane(Schedule schedule){
  super(new BorderLayout());
  _init();
  Iterator firings=schedule.actorIterator();
  while (firings.hasNext()) {
    Object actor=firings.next();
    _listModel.addElement(actor);
  }
}
Program: 73781
Project: 73781
Buggy source:
private void _updateSchedule(SequentialScheduleEditorPane pane){
  Iterator oActors=pane.getOrderedActors().iterator();
  int i=1;
  String newScheduleText=new String("String_Node_Str");
  while (oActors.hasNext()) {
    if (i > 1) {
      newScheduleText+="String_Node_Str";
    }
    Actor oActor=(Actor)oActors.next();
    List<SequenceAttribute> seqAttributes=((Entity)oActor).attributeList(SequenceAttribute.class);
    if (seqAttributes.size() > 0) {
      SequenceAttribute seqAttribute=seqAttributes.get(0);
      seqAttribute.setExpression(Integer.toString(i));
    }
 else {
      try {
        SequenceAttribute seqAttribute=new SequenceAttribute((NamedObj)oActor,uniqueName("String_Node_Str"));
        seqAttribute.setExpression(Integer.toString(i));
      }
 catch (      IllegalActionException e) {
        e.printStackTrace();
      }
catch (      NameDuplicationException e) {
        e.printStackTrace();
      }
    }
    newScheduleText+="String_Node_Str" + oActor.getDisplayName() + "String_Node_Str"+ i+ "String_Node_Str";
    i++;
  }
  newScheduleText+="String_Node_Str";
  scheduleText.setExpression(newScheduleText);
}

Fixed version (ground truth):
private void _updateSchedule(SequentialScheduleEditorPane pane){
  Iterator oActors=pane.getOrderedActors().iterator();
  int i=1;
  StringBuffer newScheduleText=new StringBuffer();
  newScheduleText.append("String_Node_Str");
  while (oActors.hasNext()) {
    if (i > 1) {
      newScheduleText.append("String_Node_Str");
    }
    Actor oActor=(Actor)oActors.next();
    List<SequenceAttribute> seqAttributes=((Entity)oActor).attributeList(SequenceAttribute.class);
    if (seqAttributes.size() > 0) {
      SequenceAttribute seqAttribute=seqAttributes.get(0);
      seqAttribute.setExpression(Integer.toString(i));
    }
 else {
      try {
        SequenceAttribute seqAttribute=new SequenceAttribute((NamedObj)oActor,uniqueName("String_Node_Str"));
        seqAttribute.setExpression(Integer.toString(i));
      }
 catch (      IllegalActionException e) {
        e.printStackTrace();
      }
catch (      NameDuplicationException e) {
        e.printStackTrace();
      }
    }
    newScheduleText.append("String_Node_Str");
    newScheduleText.append(oActor.getDisplayName());
    newScheduleText.append("String_Node_Str");
    newScheduleText.append(i);
    newScheduleText.append("String_Node_Str");
    i++;
  }
  newScheduleText.append("String_Node_Str");
  scheduleText.setExpression(newScheduleText.toString());
}
Program: 73782
Project: 73782
Buggy source:
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList){
  _init();
  _initSources();
  _initSequencedActors(independentList);
  while (!_unsettled.isEmpty()) {
    Actor actor=_selectActor();
    _update(actor);
  }
  Vector<Actor> result=_getResult();
  return result;
}

Fixed version (ground truth):
/** 
 * Estimate a sequenced schedule. This uses a basic Dijkstra algorithm for getting the maximal distances. FIXME: If the graph is cyclic, this method runs forever! Currently this has to (or at least should) be checked before.
 * @param independentList The already present SequenceAttributes for theActors controlled by this scheduler.
 * @return A vector with the ordered actors. Note that the sequence numbersare not changed. This has to be done somewhere else.
 * @exception NotSchedulableException If the schedule is acyclic.
 */
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList){
  _init();
  _initSources();
  _initSequencedActors(independentList);
  while (!_unsettled.isEmpty()) {
    Actor actor=_selectActor();
    _update(actor);
  }
  Vector<Actor> result=_getResult();
  return result;
}
Program: 73783
Project: 73783
Buggy source:
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList) throws NotSchedulableException {
  if (_actorGraph.isAcyclic()) {
    return _estimator.estimateSequencedSchedule(independentList);
  }
 else {
    throw new NotSchedulableException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Estimate a sequenced schedule. Currently only supports basic Dijkstra  algorithm for getting the maximal distances. Thus, it cannot deal with cyclic graphs.
 * @param independentList The already present SequenceAttributes for theActors controlled by this scheduler.
 * @return A vector with the ordered actors. Note that the sequence numbersare not changed. This has to be done somewhere else.
 * @exception NotSchedulableException If the schedule is acyclic.
 */
public Vector<Actor> estimateSequencedSchedule(List<SequenceAttribute> independentList) throws NotSchedulableException {
  if (_actorGraph.isAcyclic()) {
    return _estimator.estimateSequencedSchedule(independentList);
  }
 else {
    throw new NotSchedulableException("String_Node_Str");
  }
}
Program: 73787
Project: 73787
Buggy source:
/** 
 * Return the parents for the current model
 * @return ArrayList<ArrayList<XMLDBModel>> - list of parents models for the current model
 */
public List<List<XMLDBModel>> getParents(){
  return _m_listParents;
}

Fixed version (ground truth):
/** 
 * Return the parents for the current model.
 * @return List of parents models for the current model.
 */
public List<List<XMLDBModel>> getParents(){
  return _listParents;
}
Program: 73788
Project: 73788
Buggy source:
/** 
 * Add the given parent list to the model's parent list.
 * @param list List of parents to be added.
 */
public void addParentList(List<XMLDBModel> list){
  if (_m_listParents == null) {
    _m_listParents=new ArrayList<List<XMLDBModel>>();
  }
  _m_listParents.add(list);
}

Fixed version (ground truth):
/** 
 * Add the given parent list to the model's parent list.
 * @param List of parents to be added.
 */
public void addParentList(List<XMLDBModel> list){
  if (_listParents == null) {
    _listParents=new ArrayList<List<XMLDBModel>>();
  }
  _listParents.add(list);
}
Program: 73789
Project: 73789
Buggy source:
/** 
 * Construct a XMLDBModel instance with the given model name.
 * @param modelName Name for the given model.
 */
public XMLDBModel(String modelName){
  this._m_strModelName=modelName;
}

Fixed version (ground truth):
/** 
 * Construct a XMLDBModel instance with the given model name.
 * @param Name for the given model.
 */
public XMLDBModel(String modelName){
  this._modelName=modelName;
}
Program: 73790
Project: 73790
Buggy source:
/** 
 * Return the model content.
 * @return String - string representation of the model content
 */
public String getModel(){
  return _m_strModel;
}

Fixed version (ground truth):
/** 
 * Return the model content.
 * @return A string representation of the model content.
 */
public String getModel(){
  return _modelContent;
}
Program: 73791
Project: 73791
Buggy source:
/** 
 * Set the parents for the current model
 * @param ArrayList<ArrayList<XMLDBModel>> p_listParents - list of parents for that need to be set as parents for the current model.
 */
public void setParents(List<List<XMLDBModel>> p_listParents){
  _m_listParents=p_listParents;
}

Fixed version (ground truth):
/** 
 * Set the parents for the current model
 * @param List of parents for this model.
 */
public void setParents(List<List<XMLDBModel>> listParents){
  _listParents=listParents;
}
Program: 73792
Project: 73792
Buggy source:
/** 
 * Set the model name
 * @param String p_strModelName - the model name to be set.
 */
public void setModelName(String p_strModelName){
  _m_strModelName=p_strModelName;
}

Fixed version (ground truth):
/** 
 * Set the model name.
 * @param The model name.
 */
public void setModelName(String modelName){
  _modelName=modelName;
}
Program: 73793
Project: 73793
Buggy source:
/** 
 * Set the model content
 * @param String p_strModel - this is the model content to be set.
 */
public void setModel(String p_strModel){
  _m_strModel=p_strModel;
}

Fixed version (ground truth):
/** 
 * Set the model content.
 * @param The model content in xml format.
 */
public void setModel(String modelContent){
  _modelContent=modelContent;
}
Program: 73794
Project: 73794
Buggy source:
/** 
 * Return the is new.
 * @return boolean True or false based on if the model is new or it exists in the database.
 */
public boolean getIsNew(){
  return _m_bIsNew;
}

Fixed version (ground truth):
/** 
 * Return True or false based on if the model is new or it exists in the database.
 * @return True or false based on if the model is new or it exists in the database.
 */
public boolean getIsNew(){
  return _isNew;
}
Program: 73795
Project: 73795
Buggy source:
/** 
 * Return the model name
 * @return string - the model name
 */
public String getModelName(){
  return _m_strModelName;
}

Fixed version (ground truth):
/** 
 * Return the model name.
 * @return The model name.
 */
public String getModelName(){
  return _modelName;
}
Program: 73796
Project: 73796
Buggy source:
/** 
 * Set the isNew variable
 * @param boolean p_bIsNew - variable that holds true or false to set the isNew member variable
 */
public void setIsNew(boolean p_bIsNew){
  _m_bIsNew=p_bIsNew;
}

Fixed version (ground truth):
/** 
 * Set the isNew variable which indicates if the model is in the database or it is new model.
 * @param True or false value to set the isNew member variable.
 */
public void setIsNew(boolean isNew){
  _isNew=isNew;
}
Program: 73797
Project: 73797
Buggy source:
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(super.generateVariableDeclaration());
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(className + "String_Node_Str" + actorName+ "String_Node_Str"+ _eol);
    }
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(className + "String_Node_Str" + actorName+ "String_Node_Str"+ _eol);
    }
  }
  return code.toString();
}
Program: 73798
Project: 73798
Buggy source:
/** 
 * Generate variable initialization for the referenced parameters.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableInitialization() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(super.generateVariableInitialization());
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(actorName + "String_Node_Str" + className+ "String_Node_Str"+ _eol);
      code.append(actorName + "String_Node_Str" + _eol);
    }
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate variable initialization for the referenced parameters.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableInitialization() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableInitialization(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    code.append(_generateVariableInitialization(adapterObject));
  }
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(actorName + "String_Node_Str" + className+ "String_Node_Str"+ _eol);
      code.append(actorName + "String_Node_Str" + _eol);
    }
  }
  return code.toString();
}
Program: 73799
Project: 73799
Buggy source:
/** 
 * Run concept inference and check the values match those trained. This simply looks through the conceptable objects and checks that their resolved concepts match the value contained in the <i>_trainedConcept</i> attribute.  Conceptables without a <i>_trainedConcept</i> attribute are just ignored, and do not cause the test to fail.
 * @exception IllegalActionException If inference fails or the testresolves to the wrong values.
 */
public void test() throws IllegalActionException {
  try {
    workspace().getWriteAccess();
    resetAll();
    invokeSolver();
  }
  finally {
    workspace().doneWriting();
  }
  for (  NamedObj conceptable : getAllConceptableNamedObjs()) {
    StringParameter trained=(StringParameter)conceptable.getAttribute("String_Node_Str");
    if (trained == null) {
      continue;
    }
    String inferred=getResolvedProperty(conceptable).toString();
    if (!inferred.equals(trained.stringValue())) {
      throw new IllegalActionException(conceptable,"String_Node_Str" + conceptable.toString() + '\n'+ "String_Node_Str"+ trained.stringValue()+ "String_Node_Str"+ inferred+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Run concept inference and check the values match those trained. This simply looks through the conceptable objects and checks that their resolved concepts match the value contained in the <i>_trainedConcept</i> attribute.  Conceptables without a <i>_trainedConcept</i> attribute are just ignored, and do not cause the test to fail.
 * @exception IllegalActionException If inference fails or the testresolves to the wrong values.
 */
public void test() throws IllegalActionException {
  try {
    workspace().getWriteAccess();
    resetAll();
    invokeSolver();
  }
  finally {
    workspace().doneWriting();
  }
  for (  NamedObj conceptable : getAllConceptableNamedObjs()) {
    StringParameter trained=(StringParameter)conceptable.getAttribute("String_Node_Str");
    if (trained == null) {
      continue;
    }
    Concept inferredConcept=getResolvedProperty(conceptable);
    if (inferredConcept == null) {
      throw new IllegalActionException(conceptable,"String_Node_Str" + conceptable.toString() + '\n'+ "String_Node_Str"+ trained.stringValue()+ "String_Node_Str");
    }
    String inferred=inferredConcept.toString();
    if (!inferred.equals(trained.stringValue())) {
      throw new IllegalActionException(conceptable,"String_Node_Str" + conceptable.toString() + '\n'+ "String_Node_Str"+ trained.stringValue()+ "String_Node_Str"+ inferred+ "String_Node_Str");
    }
  }
}
Program: 73800
Project: 73800
Buggy source:
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    if (actor instanceof CompositeActor && ((CompositeActor)actor).isOpaque())     code.append(adapterObject.generateVariableDeclaration());
 else     code.append(_generateVariableDeclaration(adapterObject));
  }
  return code.toString();
}
Program: 73801
Project: 73801
Buggy source:
/** 
 * Generate variable initialization for the referenced parameters.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableInitialization() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableInitialization(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    code.append(_generateVariableInitialization(adapterObject));
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate variable initialization for the referenced parameters.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableInitialization() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableInitialization(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    code.append(adapterObject.generateVariableInitialization());
    code.append(_generateVariableInitialization(adapterObject));
  }
  return code.toString();
}
Program: 73802
Project: 73802
Buggy source:
/** 
 * Execute the get models task which basically accesses the  database and returns the model requested as XMLDBModel object
 * @throws DBExecutionException Thrown if there is a problem executing the task.
 * @param task this is the get models task that contain the model name
 * @return XMLDBModel this is the model fetched from the database	
 */
public XMLDBModel executeGetModelsTask(GetModelsTask task) throws DBExecutionException {
  try {
    if (task == null) {
      throw new DBExecutionException("String_Node_Str" + "String_Node_Str");
    }
    XmlDocument dbModel=_xmlContainer.getDocument(_xmlTransaction,task.getModelName());
    XMLDBModel completeXMLDBModel=null;
    if (dbModel != null) {
      completeXMLDBModel=new XMLDBModel();
      completeXMLDBModel.setModelName(dbModel.getName());
      String strCompleteModelBody="String_Node_Str";
      String strReferences=_getModelReferences(dbModel.getName());
      if (strReferences != null && strReferences.length() > 0) {
        Node modelNode=_parseXML(strReferences);
        strCompleteModelBody=_buildCompleteModel(modelNode);
      }
 else {
        strCompleteModelBody=dbModel.getContentAsString();
      }
      completeXMLDBModel.setModel(strCompleteModelBody);
      completeXMLDBModel.setIsNew(false);
      completeXMLDBModel.setParents(null);
    }
    return completeXMLDBModel;
  }
 catch (  XmlException e) {
    throw new DBExecutionException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Execute the get models task which basically accesses the  database and returns the model requested as XMLDBModel object
 * @throws DBExecutionException Thrown if there is a problem executing the task.
 * @param task this is the get models task that contain the model name
 * @return XMLDBModel this is the model fetched from the database	
 */
public XMLDBModel executeGetModelsTask(GetModelsTask task) throws DBExecutionException {
  try {
    if (task == null) {
      throw new DBExecutionException("String_Node_Str" + "String_Node_Str");
    }
    XmlDocument dbModel;
    try {
      dbModel=_xmlContainer.getDocument(_xmlTransaction,task.getModelName());
    }
 catch (    XmlException e) {
      throw new DBExecutionException("String_Node_Str" + "String_Node_Str");
    }
    XMLDBModel completeXMLDBModel=null;
    if (dbModel != null) {
      completeXMLDBModel=new XMLDBModel();
      completeXMLDBModel.setModelName(dbModel.getName());
      String strCompleteModelBody="String_Node_Str";
      String strReferences=_getModelReferences(dbModel.getName());
      if (strReferences != null && strReferences.length() > 0) {
        Node modelNode=_parseXML(strReferences);
        strCompleteModelBody=_buildCompleteModel(modelNode);
      }
 else {
        strCompleteModelBody=dbModel.getContentAsString();
      }
      completeXMLDBModel.setModel(strCompleteModelBody);
      completeXMLDBModel.setIsNew(false);
      completeXMLDBModel.setParents(null);
    }
    return completeXMLDBModel;
  }
 catch (  XmlException e) {
    throw new DBExecutionException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 73803
Project: 73803
Buggy source:
/** 
 */
public ArrayList executeGetAttributesTask(GetAttributesTask task) throws DBExecutionException {
  return null;
}

Fixed version (ground truth):
/** 
 * Get the attributes defined from the database. 
 * @param task The criteria to get the attribute.   
 * @return List of attributes stored in the database.
 * @throws DBExecutionException
 */
public ArrayList executeGetAttributesTask(GetAttributesTask task) throws DBExecutionException {
  return null;
}