Program: 76254
Project: 76254
Buggy source:
/** 
 * Return an Enumeration of the detail schedules. The first element in the Enumeration is the states schedule, then transition schedule, then output schedule, and then event generating schedule. Each schedule is an Enumeration of actors in their topological order. Each schedule can also be accessed by individual getXXSchedule method.
 * @return an Enumeration of sub-schedules.
 * @exception NotSchedulableException either the system constructionis wrong or arithmetic loop exists.
 */
protected Enumeration _schedule() throws NotSchedulableException {
  CTDirector dir=(CTDirector)getContainer();
  if (dir == null) {
    return null;
  }
  CompositeActor ca=(CompositeActor)(dir.getContainer());
  if (ca == null) {
    return null;
  }
  _stateschedule=new LinkedList();
  _transitionschedule=new LinkedList();
  _outputschedule=new LinkedList();
  _statessc=new LinkedList();
  _outputssc=new LinkedList();
  LinkedList _scheList=new LinkedList();
  _classifyActors();
  DirectedAcyclicGraph g=_toArithGraph(ca.deepEntityList());
  DirectedAcyclicGraph gd=_toGraph(dynamicActorList());
  if (!g.isAcyclic()) {
    throw new NotSchedulableException("String_Node_Str");
  }
  int numofdyn=_dynam.size();
  if (numofdyn > 0) {
    Object[] dynactors=_dynam.toArray();
    Object[] xsort=gd.topologicalSort(dynactors);
    for (int i=0; i < xsort.length; i++) {
      Actor a=(Actor)xsort[i];
      _stateschedule.addFirst(a);
      if (a instanceof CTStepSizeControlActor) {
        _statessc.addFirst(a);
      }
    }
    _scheList.addLast(_stateschedule);
    Object[] fx=g.backwardReachableNodes(dynactors);
    Object[] fxsort=g.topologicalSort(fx);
    for (int i=0; i < fxsort.length; i++) {
      Actor a=(Actor)fxsort[i];
      _transitionschedule.addLast(a);
      if (a instanceof CTStepSizeControlActor) {
        _statessc.addFirst(a);
      }
    }
    _scheList.addLast(_transitionschedule);
  }
  int numofsink=_sink.size();
  if (numofsink > 0) {
    Object[] sinkactors=_sink.toArray();
    Object[] gx=g.backwardReachableNodes(sinkactors);
    Object[] gxsort=g.topologicalSort(gx);
    for (int i=0; i < gxsort.length; i++) {
      Actor a=(Actor)gxsort[i];
      _outputschedule.addLast(a);
      if (a instanceof CTStepSizeControlActor) {
        _outputssc.addFirst(a);
      }
    }
    _outputschedule.addAll(_sink);
    _scheList.addLast(_outputschedule);
  }
  return Collections.enumeration(_scheList);
}

Fixed version (ground truth):
/** 
 * Return an Enumeration of the detail schedules. The first element in the Enumeration is the states schedule, then transition schedule, then output schedule, and then event generating schedule. Each schedule is an Enumeration of actors in their topological order. Each schedule can also be accessed by individual getXXSchedule method.
 * @return an Enumeration of sub-schedules.
 * @exception NotSchedulableException either the system constructionis wrong or arithmetic loop exists.
 */
protected Enumeration _schedule() throws NotSchedulableException {
  CTDirector dir=(CTDirector)getContainer();
  if (dir == null) {
    return null;
  }
  CompositeActor ca=(CompositeActor)(dir.getContainer());
  if (ca == null) {
    return null;
  }
  _stateschedule=new LinkedList();
  _transitionschedule=new LinkedList();
  _outputschedule=new LinkedList();
  _statessc=new LinkedList();
  _outputssc=new LinkedList();
  LinkedList _scheList=new LinkedList();
  _classifyActors();
  DirectedAcyclicGraph g=_toArithGraph(ca.deepEntityList());
  DirectedAcyclicGraph gd=_toGraph(dynamicActorList());
  if (!g.isAcyclic()) {
    throw new NotSchedulableException("String_Node_Str");
  }
  int numofdyn=_dynam.size();
  if (numofdyn > 0) {
    Object[] dynactors=_dynam.toArray();
    Object[] xsort=gd.topologicalSort(dynactors);
    for (int i=0; i < xsort.length; i++) {
      Actor a=(Actor)xsort[i];
      _stateschedule.addFirst(a);
      if (a instanceof CTStepSizeControlActor) {
        _statessc.addFirst(a);
      }
    }
    _scheList.addLast(_stateschedule);
    Object[] fx=g.backwardReachableNodes(dynactors);
    Object[] fxsort=g.topologicalSort(fx);
    for (int i=0; i < fxsort.length; i++) {
      Actor a=(Actor)fxsort[i];
      _transitionschedule.addLast(a);
      if (a instanceof CTStepSizeControlActor) {
        _statessc.addFirst(a);
      }
    }
    _scheList.addLast(_transitionschedule);
  }
  int numofsink=_sink.size();
  if (numofsink > 0) {
    Object[] sinkactors=_sink.toArray();
    Object[] gx=g.backwardReachableNodes(sinkactors);
    Object[] gxsort=g.topologicalSort(gx);
    for (int i=0; i < gxsort.length; i++) {
      Actor a=(Actor)gxsort[i];
      _outputschedule.addLast(a);
      if (a instanceof CTStepSizeControlActor) {
        _outputssc.addLast(a);
      }
    }
    for (int i=0; i < sinkactors.length; i++) {
      Actor a=(Actor)sinkactors[i];
      _outputschedule.addLast(a);
      if (a instanceof CTStepSizeControlActor) {
        _outputssc.addLast(a);
      }
    }
    _scheList.addLast(_outputschedule);
  }
  return Collections.enumeration(_scheList);
}