コード例 #1
0
  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
コード例 #2
0
  public void sendOffer(fUML.Semantics.Activities.IntermediateActivities.TokenList tokens) {
    // Send an offer from the source to the target.
    // Keep the offered tokens until taken by the target.
    // (Note that any one edge should only be handling either all object
    // tokens or all control tokens.)

    Offer offer = new Offer();

    for (int i = 0; i < tokens.size(); i++) {
      Token token = tokens.getValue(i);
      // Debug.println("[sendOffer] token value = " + token.getValue());
      offer.offeredTokens.addValue(token);
    }

    this.offers.addValue(offer);

    this.target.receiveOffer();
  } // sendOffer