public void setName(String name) { // if there is no source node associated with this transition if (source==null) { // it s just a setter this.name = name; } else { // otherwise // make sure the source node's leavingTransitionsMap remains up to date if (this.name!=null) { source.removeOutgoingTransition(this); } this.name = name; if (name!=null) { source.addOutgoingTransition(this); } } }
public TransitionImpl createOutgoingTransition(String transitionName) { // create a new transition TransitionImpl transition = new TransitionImpl(); transition.setName(transitionName); // wire it between the source and destination addOutgoingTransition(transition); // if there is no default transition yet if (defaultTransition==null) { // make this the default outgoing transition defaultTransition = transition; } return transition; }