Program: 73244
Project: 73244
Buggy source:
/** 
 * For the given controller FSM, set all outputs that are currently unknown to absent if it can be determined to be absent given the current state and possibly partial information about the inputs (some of the inputs may be unknown). If the current state has any refinements that are not FSMs, then return false. It is not safe to assert absent outputs because we have no visibility into what those refinements do with the outputs. This method first explores any FSM refinements of the current state. If those refinements are all FSMs and they are all able to assert that an output is absent, then explore this FSM to determine whether it also can assert that the output is absent. If all the refinements and the specified FSM agree that an output is absent, then this method sets it to absent. Otherwise, it leaves it unknown.
 * @param controller The controller FSM.
 * @return True if after this method is called, any output port is absent.
 * @exception IllegalActionException If something goes wrong.
 */
private boolean _assertAbsentOutputs(FSMActor controller) throws IllegalActionException {
  TypedActor[] refinements=controller._currentState.getRefinement();
  if (refinements != null) {
    for (    Actor refinementActor : refinements) {
      Director refinementDirector=refinementActor.getDirector();
      if (refinementDirector instanceof FSMDirector && refinementDirector != getDirector()) {
        FSMActor refinementController=((FSMDirector)refinementDirector).getController();
        if (!_assertAbsentOutputs(refinementController)) {
          return false;
        }
      }
 else {
        return false;
      }
    }
  }
  Director director=getDirector();
  boolean foundAbsentOutputs=false;
  if (director instanceof FSMDirector) {
    Actor container=(Actor)getContainer();
    List<IOPort> outputs=container.outputPortList();
    if (outputs.size() == 0) {
      return true;
    }
    for (    IOPort port : outputs) {
      IOPort[] refinementPorts=null;
      if (refinements != null) {
        refinementPorts=new IOPort[refinements.length];
        int i=0;
        for (        TypedActor refinement : refinements) {
          refinementPorts[i++]=(IOPort)((Entity)refinement).getPort(port.getName());
        }
      }
      for (int channel=0; channel < port.getWidthInside(); channel++) {
        if (!port.isKnownInside(channel)) {
          boolean channelIsAbsent=true;
          if (refinementPorts != null) {
            for (int i=0; i < refinementPorts.length; i++) {
              if (refinementPorts[i] != null && channel < refinementPorts[i].getWidthInside() && (!refinementPorts[i].isKnownInside(channel) || refinementPorts[i].hasTokenInside(channel))) {
                channelIsAbsent=false;
                break;
              }
            }
          }
          if (!channelIsAbsent) {
            break;
          }
          IOPort controllerPort=(IOPort)controller.getPort(port.getName());
          if (controllerPort != null) {
            channelIsAbsent=controller._isSafeToClear(controllerPort,channel,controller._currentState,false,null);
            if (channelIsAbsent) {
              foundAbsentOutputs=true;
              controllerPort.send(channel,null);
              _debug("String_Node_Str" + port.getName());
            }
          }
        }
 else {
          if (!port.hasTokenInside(channel)) {
            foundAbsentOutputs=true;
          }
        }
      }
    }
  }
 else {
    List<IOPort> outputs=outputPortList();
    for (    IOPort port : outputs) {
      for (int channel=0; channel < port.getWidth(); channel++) {
        if (_isSafeToClear(port,channel,_currentState,false,null)) {
          port.send(channel,null);
          foundAbsentOutputs=true;
        }
      }
    }
  }
  return foundAbsentOutputs;
}

Fixed version (ground truth):
/** 
 * For the given controller FSM, set all outputs that are currently unknown to absent if it can be determined to be absent given the current state and possibly partial information about the inputs (some of the inputs may be unknown). If the current state has any refinements that are not FSMs, then return false. It is not safe to assert absent outputs because we have no visibility into what those refinements do with the outputs. This method first explores any FSM refinements of the current state. If those refinements are all FSMs and they are all able to assert that an output is absent, then explore this FSM to determine whether it also can assert that the output is absent. If all the refinements and the specified FSM agree that an output is absent, then this method sets it to absent. Otherwise, it leaves it unknown.
 * @param controller The controller FSM.
 * @return True if after this method is called, any output port is absent.
 * @exception IllegalActionException If something goes wrong.
 */
private boolean _assertAbsentOutputs(FSMActor controller) throws IllegalActionException {
  TypedActor[] refinements=controller._currentState.getRefinement();
  if (refinements != null) {
    for (    Actor refinementActor : refinements) {
      Director refinementDirector=refinementActor.getDirector();
      if (refinementDirector instanceof FSMDirector && refinementDirector != getDirector()) {
        FSMActor refinementController=((FSMDirector)refinementDirector).getController();
        if (!_assertAbsentOutputs(refinementController)) {
          return false;
        }
      }
 else {
        return false;
      }
    }
  }
  Director director=getDirector();
  boolean foundAbsentOutputs=false;
  if (director instanceof FSMDirector) {
    Actor container=(Actor)getContainer();
    List<IOPort> outputs=container.outputPortList();
    if (outputs.size() == 0) {
      return true;
    }
    for (    IOPort port : outputs) {
      IOPort[] refinementPorts=null;
      if (refinements != null) {
        refinementPorts=new IOPort[refinements.length];
        int i=0;
        for (        TypedActor refinement : refinements) {
          refinementPorts[i++]=(IOPort)((Entity)refinement).getPort(port.getName());
        }
      }
      for (int channel=0; channel < port.getWidthInside(); channel++) {
        if (!port.isKnownInside(channel)) {
          boolean channelIsAbsent=true;
          if (refinementPorts != null) {
            for (int i=0; i < refinementPorts.length; i++) {
              if (refinementPorts[i] != null && channel < refinementPorts[i].getWidthInside() && (!refinementPorts[i].isKnownInside(channel) || refinementPorts[i].hasTokenInside(channel))) {
                channelIsAbsent=false;
                break;
              }
            }
          }
          if (!channelIsAbsent) {
            break;
          }
          IOPort controllerPort=(IOPort)controller.getPort(port.getName());
          if (controllerPort != null) {
            channelIsAbsent=controller._isSafeToClear(controllerPort,channel,controller._currentState,false,null);
            if (channelIsAbsent) {
              foundAbsentOutputs=true;
              controllerPort.send(channel,null);
              if (_debugging) {
                _debug("String_Node_Str" + port.getName() + "String_Node_Str"+ channel);
              }
            }
          }
        }
 else {
          if (!port.hasTokenInside(channel)) {
            foundAbsentOutputs=true;
          }
        }
      }
    }
  }
 else {
    List<IOPort> outputs=outputPortList();
    for (    IOPort port : outputs) {
      for (int channel=0; channel < port.getWidth(); channel++) {
        if (_isSafeToClear(port,channel,_currentState,false,null)) {
          if (_debugging) {
            _debug("String_Node_Str" + port.getName() + "String_Node_Str"+ channel);
          }
          port.send(channel,null);
          foundAbsentOutputs=true;
        }
      }
    }
  }
  return foundAbsentOutputs;
}