Program: 73515
Project: 73515
Buggy source:
/** 
 * Calculates the deadline for each channel in each input port within the composite actor governed by this Ptides director. Deadlines are calculated with only model time delays, not worst-case-execution-times (WCET).
 * @exception IllegalActionException when ports that are both input/output ports exist.
 */
protected void _calculateDeadline() throws IllegalActionException {
  HashMap portDeadlines=new HashMap<IOPort,SuperdenseDependency>();
  for (  Actor actor : (List<Actor>)(((TypedCompositeActor)getContainer()).deepEntityList())) {
    for (    TypedIOPort inputPort : (List<TypedIOPort>)(actor.inputPortList())) {
      portDeadlines.put(inputPort,SuperdenseDependency.OPLUS_IDENTITY);
    }
    for (    TypedIOPort outputPort : (List<TypedIOPort>)(actor.outputPortList())) {
      portDeadlines.put(outputPort,SuperdenseDependency.OPLUS_IDENTITY);
    }
  }
  for (  TypedIOPort outputPort : (List<TypedIOPort>)(((Actor)getContainer()).outputPortList())) {
    SuperdenseDependency startDelay=SuperdenseDependency.OTIMES_IDENTITY;
    portDeadlines.put(outputPort,startDelay);
  }
  for (  TypedIOPort startPort : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).outputPortList())) {
    HashMap localPortDeadlines=new HashMap<IOPort,SuperdenseDependency>(portDeadlines);
    PriorityQueue distQueue=new PriorityQueue<PortDependency>();
    distQueue.add(new PortDependency(startPort,(SuperdenseDependency)localPortDeadlines.get(startPort)));
    while (!distQueue.isEmpty()) {
      PortDependency portDependency=(PortDependency)distQueue.remove();
      IOPort port=portDependency.port;
      SuperdenseDependency prevDependency=(SuperdenseDependency)portDependency.dependency;
      Actor actor=(Actor)port.getContainer();
      if (port.isInput() && port.isOutput()) {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
      if (actor != getContainer()) {
        if (port.isOutput()) {
          Collection<IOPort> inputs=_finiteDependentPorts(port);
          for (          IOPort inputPort : inputs) {
            SuperdenseDependency minimumDelay=(SuperdenseDependency)_getDependency(inputPort,port);
            SuperdenseDependency modelTime=(SuperdenseDependency)prevDependency.oTimes(minimumDelay);
            if (((SuperdenseDependency)localPortDeadlines.get(inputPort)).compareTo(modelTime) > 0) {
              localPortDeadlines.put(inputPort,modelTime);
              distQueue.add(new PortDependency(inputPort,modelTime));
            }
          }
        }
 else {
          for (          IOPort sourcePort : (List<IOPort>)port.sourcePortList()) {
            if (sourcePort.getContainer() != getContainer()) {
              if (((SuperdenseDependency)localPortDeadlines.get(sourcePort)).compareTo(prevDependency) > 0) {
                localPortDeadlines.put(sourcePort,prevDependency);
                distQueue.add(new PortDependency(sourcePort,prevDependency));
              }
            }
          }
        }
      }
 else       if (port == startPort) {
        for (        IOPort sourcePort : (List<IOPort>)port.deepInsidePortList()) {
          if (sourcePort.getContainer() != getContainer()) {
            if (((SuperdenseDependency)localPortDeadlines.get(sourcePort)).compareTo(prevDependency) > 0) {
              localPortDeadlines.put(sourcePort,prevDependency);
              distQueue.add(new PortDependency(sourcePort,prevDependency));
            }
          }
        }
      }
    }
    portDeadlines=localPortDeadlines;
  }
  for (  IOPort port : (Set<IOPort>)(portDeadlines.keySet())) {
    if (port.isInput()) {
      SuperdenseDependency dependency=(SuperdenseDependency)(portDeadlines.get(port));
      _setDeadline(port,dependency);
    }
  }
}

Fixed version (ground truth):
/** 
 * Calculate the deadline for each channel in each input port within the composite actor governed by this Ptides director. Deadlines are calculated with only model time delays, not worst-case-execution-times (WCET).
 * @exception IllegalActionException when ports that are both input/output ports exist.
 */
protected void _calculateDeadline() throws IllegalActionException {
  HashMap portDeadlines=new HashMap<IOPort,SuperdenseDependency>();
  for (  Actor actor : (List<Actor>)(((TypedCompositeActor)getContainer()).deepEntityList())) {
    for (    TypedIOPort inputPort : (List<TypedIOPort>)(actor.inputPortList())) {
      portDeadlines.put(inputPort,SuperdenseDependency.OPLUS_IDENTITY);
    }
    for (    TypedIOPort outputPort : (List<TypedIOPort>)(actor.outputPortList())) {
      portDeadlines.put(outputPort,SuperdenseDependency.OPLUS_IDENTITY);
    }
  }
  for (  TypedIOPort outputPort : (List<TypedIOPort>)(((Actor)getContainer()).outputPortList())) {
    SuperdenseDependency startDelay=SuperdenseDependency.OTIMES_IDENTITY;
    portDeadlines.put(outputPort,startDelay);
  }
  for (  TypedIOPort startPort : (List<TypedIOPort>)(((TypedCompositeActor)getContainer()).outputPortList())) {
    HashMap localPortDeadlines=new HashMap<IOPort,SuperdenseDependency>(portDeadlines);
    PriorityQueue distQueue=new PriorityQueue<PortDependency>();
    distQueue.add(new PortDependency(startPort,(SuperdenseDependency)localPortDeadlines.get(startPort)));
    while (!distQueue.isEmpty()) {
      PortDependency portDependency=(PortDependency)distQueue.remove();
      IOPort port=portDependency.port;
      SuperdenseDependency prevDependency=(SuperdenseDependency)portDependency.dependency;
      Actor actor=(Actor)port.getContainer();
      if (port.isInput() && port.isOutput()) {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
      if (actor != getContainer()) {
        if (port.isOutput()) {
          Collection<IOPort> inputs=_finiteDependentPorts(port);
          for (          IOPort inputPort : inputs) {
            SuperdenseDependency minimumDelay=(SuperdenseDependency)_getDependency(inputPort,port);
            SuperdenseDependency modelTime=(SuperdenseDependency)prevDependency.oTimes(minimumDelay);
            if (((SuperdenseDependency)localPortDeadlines.get(inputPort)).compareTo(modelTime) > 0) {
              localPortDeadlines.put(inputPort,modelTime);
              distQueue.add(new PortDependency(inputPort,modelTime));
            }
          }
        }
 else {
          for (          IOPort sourcePort : (List<IOPort>)port.sourcePortList()) {
            if (sourcePort.getContainer() != getContainer()) {
              if (((SuperdenseDependency)localPortDeadlines.get(sourcePort)).compareTo(prevDependency) > 0) {
                localPortDeadlines.put(sourcePort,prevDependency);
                distQueue.add(new PortDependency(sourcePort,prevDependency));
              }
            }
          }
        }
      }
 else       if (port == startPort) {
        for (        IOPort sourcePort : (List<IOPort>)port.deepInsidePortList()) {
          if (sourcePort.getContainer() != getContainer()) {
            if (((SuperdenseDependency)localPortDeadlines.get(sourcePort)).compareTo(prevDependency) > 0) {
              localPortDeadlines.put(sourcePort,prevDependency);
              distQueue.add(new PortDependency(sourcePort,prevDependency));
            }
          }
        }
      }
    }
    portDeadlines=localPortDeadlines;
  }
  for (  IOPort port : (Set<IOPort>)(portDeadlines.keySet())) {
    if (port.isInput()) {
      SuperdenseDependency dependency=(SuperdenseDependency)(portDeadlines.get(port));
      _setDeadline(port,dependency);
    }
  }
}