if(node.state.getFirstTransition() == null) {
// If the node contains no transition (probably if it is at the end of a rule), then
// ignore externalNode. We will draw only a link from node to nextNode.
} else {
// Find the transition that points to the external rule ref
FATransition t = node.state.getTransitionToExternalStateRule(nextState.enclosingRule.name);
if(t == null) {
System.err.println("[GGraphGroup] No transition to external state "+nextState.stateNumber+"["+nextState.enclosingRule.name+"] - using first transition by default");
t = node.state.getFirstTransition();
}
externalNode = findNodeForStateNumber(t.target.stateNumber);
}
}
if(externalNode == null) {
// Add the link between node and nextNode, ignore externalNode because it doesn't exist
elements.add(GPathElement.createElement(node));
elements.add(GPathElement.createLink(node, nextNode));
} else {
elements.add(GPathElement.createElement(node));
// Add the link between node and externalNode.
FATransition t = node.state.getTransitionToStateNumber(externalNode.state.stateNumber);
elements.add(GPathElement.createElement(node.getLink(t)));
elements.add(GPathElement.createElement(externalNode));
// Add the link between externalNode and nextNode
elements.add(GPathElement.createLink(externalNode, nextNode));