/** sets the incomingTransitions to the given list of incomingTransitions. * A copy of the collection is made. Also the destination of all the transitions * in the given list will be set to this node. * In case there was an arriving transitions list present, these transition's * destination will be nulled. */ public void setIncomingTransitions(List<TransitionImpl> incomingTransitions) { if (this.incomingTransitions!=null) { for (TransitionImpl removedTransition: this.incomingTransitions) { removedTransition.setDestination(null); } } if (incomingTransitions!=null) { this.incomingTransitions = new ArrayList<TransitionImpl>(incomingTransitions); for (TransitionImpl addedTransition: incomingTransitions) { addedTransition.setDestination(this); } } else { this.incomingTransitions = null; } }
/** * adds the given transition as an arriving transition to this node. * Also the source of the transition is set to this node. * @return the added transition. * @throws NullPointerException if transition is null. */ public Transition addIncomingTransition(TransitionImpl transition) { transition.setDestination(this); if (incomingTransitions==null) { incomingTransitions = new ArrayList<TransitionImpl>(); } incomingTransitions.add(transition); return transition; }
/** removes the given transition if it is contained in the arriving * transitions of this node. If this transition was actually removed, * its destination pointer is nulled. * @return true if a transition was removed. */ public boolean removeIncomingTransition(TransitionImpl transition) { if ( (transition!=null) && (incomingTransitions!=null) && (incomingTransitions.remove(transition)) ) { transition.setDestination(null); if (incomingTransitions.isEmpty()) { incomingTransitions = null; } return true; } return false; }
public void resolve() { NodeImpl destination = (NodeImpl) processDefinition.findNode(destinationName); if (destination==null) { throw new PvmException("couldn't find destination node '"+destinationName+"' for transition "+transition); } destination.addIncomingTransition(transition); transition.setDestination(destination); } }