public void fire(fUML.Semantics.Activities.IntermediateActivities.TokenList incomingTokens) { // Create forked tokens for all incoming tokens and offer them on all // outgoing edges. if (this.node == null) { Debug.println("[fire] Anonymous fork node."); } else { Debug.println("[fire] Fork node " + this.node.name + "..."); } ActivityEdgeInstanceList outgoingEdges = this.outgoingEdges; int outgoingEdgeCount = outgoingEdges.size(); TokenList forkedTokens = new TokenList(); for (int i = 0; i < incomingTokens.size(); i++) { Token token = incomingTokens.getValue(i); ForkedToken forkedToken = new ForkedToken(); forkedToken.baseToken = token; forkedToken.remainingOffersCount = outgoingEdgeCount; forkedToken.baseTokenIsWithdrawn = false; forkedTokens.addValue(forkedToken); } this.addTokens(forkedTokens); this.sendOffers(forkedTokens); } // fire
public static void enqueue(Execution execution) { if (notStarted()) { start(execution); } else { Debug.println("[enqueue] execution = " + execution); executionQueue.add(execution); } }
private void run() { while (queue.size() > 0) { Execution execution = queue.get(0); queue.remove(0); if (execution.context.getTypes().size() > 0) { Debug.println("[run] execution = " + execution); execution.execute(); } } }