Program: 74865
Project: 74865
Buggy source:
/** 
 * Return true if all actors that were fired in the current iteration report that the step size is accurate.
 * @return True if the current step is accurate.
 */
public boolean isStepSizeAccurate(){
  boolean result=true;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      if (!((ContinuousStepSizeController)actor).isStepSizeAccurate()) {
        return false;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Iterator insideActors=((CompositeActor)actor).deepEntityList().iterator();
      while (insideActors.hasNext()) {
        Actor insideActor=(Actor)insideActors.next();
        if (insideActor instanceof ContinuousStepSizeController) {
          if (!((ContinuousStepSizeController)insideActor).isStepSizeAccurate()) {
            result=false;
            break;
          }
        }
      }
    }
  }
  ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
  if (enclosingDirector == null) {
    _lastDistanceToBoundary=0.0;
    _distanceToBoundary=0.0;
    return result;
  }
  try {
    FSMActor controller=getController();
    State currentState=controller.currentState();
    List preemptiveEnabledTransitions=controller._checkTransition(currentState.preemptiveTransitionList());
    if (preemptiveEnabledTransitions.size() != 0) {
      if (_debugging && _verbose) {
        _debug("String_Node_Str");
      }
    }
    List nonpreemptiveEnabledTransitions=controller._checkTransition(currentState.nonpreemptiveTransitionList());
    if (nonpreemptiveEnabledTransitions.size() != 0) {
      if (_debugging && _verbose) {
        _debug("String_Node_Str");
      }
    }
    Transition preemptiveTrWithEvent=_checkEvent(currentState.preemptiveTransitionList());
    if (preemptiveTrWithEvent != null) {
      if (_debugging) {
        _debug("String_Node_Str" + preemptiveTrWithEvent.getGuardExpression());
      }
    }
    Transition nonPreemptiveTrWithEvent=_checkEvent(currentState.nonpreemptiveTransitionList());
    if (nonPreemptiveTrWithEvent != null) {
      if (_debugging) {
        _debug("String_Node_Str" + nonPreemptiveTrWithEvent.getGuardExpression());
      }
    }
    double errorTolerance=enclosingDirector.getErrorTolerance();
    if ((preemptiveEnabledTransitions.size() == 0) && (nonpreemptiveEnabledTransitions.size() == 0) && (preemptiveTrWithEvent == null)&& (nonPreemptiveTrWithEvent == null)) {
      _lastDistanceToBoundary=0.0;
      _distanceToBoundary=0.0;
      return result;
    }
 else {
      Transition enabledTransition=null;
      _distanceToBoundary=Double.MIN_VALUE;
      Iterator iterator=preemptiveEnabledTransitions.iterator();
      while (iterator.hasNext()) {
        Transition transition=(Transition)iterator.next();
        RelationList relationList=transition.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=transition;
        }
      }
      iterator=nonpreemptiveEnabledTransitions.iterator();
      while (iterator.hasNext()) {
        Transition transition=(Transition)iterator.next();
        RelationList relationList=transition.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=transition;
        }
      }
      if (preemptiveTrWithEvent != null) {
        RelationList relationList=preemptiveTrWithEvent.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=preemptiveTrWithEvent;
        }
      }
      if (nonPreemptiveTrWithEvent != null) {
        RelationList relationList=nonPreemptiveTrWithEvent.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=nonPreemptiveTrWithEvent;
        }
      }
      if (_debugging && _verbose) {
        _debug("String_Node_Str" + enabledTransition.getGuardExpression() + "String_Node_Str"+ _distanceToBoundary);
      }
      if (_distanceToBoundary < errorTolerance) {
        _distanceToBoundary=0.0;
        _lastDistanceToBoundary=0.0;
        return result;
      }
 else {
        return false;
      }
    }
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(throwable);
  }
}

Fixed version (ground truth):
/** 
 * Return true if all actors that were fired in the current iteration report that the step size is accurate.
 * @return True if the current step is accurate.
 */
public boolean isStepSizeAccurate(){
  boolean result=true;
  _lastDistanceToBoundary=0.0;
  _distanceToBoundary=0.0;
  Iterator actors=_actorsFired.iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    if (actor instanceof ContinuousStepSizeController) {
      if (!((ContinuousStepSizeController)actor).isStepSizeAccurate()) {
        return false;
      }
    }
 else     if (actor instanceof CompositeActor) {
      Director director=actor.getDirector();
      if (director instanceof ContinuousStepSizeController) {
        if (!((ContinuousStepSizeController)director).isStepSizeAccurate()) {
          return false;
        }
      }
    }
  }
  ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
  if (enclosingDirector == null) {
    return result;
  }
  try {
    FSMActor controller=getController();
    State currentState=controller.currentState();
    List preemptiveEnabledTransitions=controller._checkTransition(currentState.preemptiveTransitionList());
    if (preemptiveEnabledTransitions.size() != 0) {
      if (_debugging && _verbose) {
        _debug("String_Node_Str");
      }
    }
    List nonpreemptiveEnabledTransitions=controller._checkTransition(currentState.nonpreemptiveTransitionList());
    if (nonpreemptiveEnabledTransitions.size() != 0) {
      if (_debugging && _verbose) {
        _debug("String_Node_Str");
      }
    }
    Transition preemptiveTrWithEvent=_checkEvent(currentState.preemptiveTransitionList());
    if (preemptiveTrWithEvent != null) {
      if (_debugging) {
        _debug("String_Node_Str" + preemptiveTrWithEvent.getGuardExpression());
      }
    }
    Transition nonPreemptiveTrWithEvent=_checkEvent(currentState.nonpreemptiveTransitionList());
    if (nonPreemptiveTrWithEvent != null) {
      if (_debugging) {
        _debug("String_Node_Str" + nonPreemptiveTrWithEvent.getGuardExpression());
      }
    }
    double errorTolerance=enclosingDirector.getErrorTolerance();
    if ((preemptiveEnabledTransitions.size() == 0) && (nonpreemptiveEnabledTransitions.size() == 0) && (preemptiveTrWithEvent == null)&& (nonPreemptiveTrWithEvent == null)) {
      _lastDistanceToBoundary=0.0;
      _distanceToBoundary=0.0;
      return result;
    }
 else {
      Transition enabledTransition=null;
      _distanceToBoundary=Double.MIN_VALUE;
      Iterator iterator=preemptiveEnabledTransitions.iterator();
      while (iterator.hasNext()) {
        Transition transition=(Transition)iterator.next();
        RelationList relationList=transition.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=transition;
        }
      }
      iterator=nonpreemptiveEnabledTransitions.iterator();
      while (iterator.hasNext()) {
        Transition transition=(Transition)iterator.next();
        RelationList relationList=transition.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=transition;
        }
      }
      if (preemptiveTrWithEvent != null) {
        RelationList relationList=preemptiveTrWithEvent.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=preemptiveTrWithEvent;
        }
      }
      if (nonPreemptiveTrWithEvent != null) {
        RelationList relationList=nonPreemptiveTrWithEvent.getRelationList();
        double distanceToBoundary=relationList.maximumDifference();
        if (distanceToBoundary > _distanceToBoundary) {
          _distanceToBoundary=distanceToBoundary;
          _lastDistanceToBoundary=relationList.getPreviousMaximumDistance();
          enabledTransition=nonPreemptiveTrWithEvent;
        }
      }
      if (_debugging && _verbose) {
        _debug("String_Node_Str" + enabledTransition.getGuardExpression() + "String_Node_Str"+ _distanceToBoundary);
      }
      if (_distanceToBoundary < errorTolerance) {
        _distanceToBoundary=0.0;
        _lastDistanceToBoundary=0.0;
        return result;
      }
 else {
        return false;
      }
    }
  }
 catch (  Throwable throwable) {
    throw new InternalErrorException(throwable);
  }
}