1. OMG Issue

FUML — An action can consume more tokens from a pin than the allowed multiplicity upper bound

  • Key: FUML-4
  • Legacy Issue Number: 13310
  • Status: closed  
  • Source: Model Driven Solutions ( Ed Seidewitz)
  • Summary:

    Specification: Semantics of a Foundation Subset for Executable UML Models, FTF – Beta 1 (ptc/08-11-03)

    Sections: (ObjectNodeActivation), (ActionActivation), (OutputPinActivation), (PinActivation)


    When an action fires, all offered tokens are accepted on all input pins (because the default object flow weight for fUML is “*”). However, an action cannot consume more tokens from an input pin than the multiplicity upper bound for that pin. Any additional tokens remain on the pin, the intent being that they can be consumed if and when the action fires again.

    However, currently the ActionActivation::getTokens operation (used to get values from the tokens on an input pin) uses the ActivityNodeActivation::takeTokens operation inherited by InputPin. This operation returns all the tokens on the pin and clears them from the pin, without respecting the multiplicity upper bound. As a result, the ActionActivation::getTokens operation does not respect this upper bound either.

    Proposed resolution:

    Add the following operation to ObjectNodeActivation:

    ObjectNodeActivation::takeUnofferedTokens(): Token[*]

    // Take the next set of unoffered tokens to be offered from this node activation and return them.

    TokenList tokens = this.getUnofferedTokens();

    for (int i = 0; i < tokens.size(); i++)

    { Token token = tokens.getValue(i); token.withdraw(); }

    return tokens;

    (Note: The getUnofferedTokens operation returns a number of tokens equal to the result of the countUnofferedTokens operation. This is overridden in InputPin to limit the count to at most the multiplicity upper bound.)

    In ActionActivation::getTokens, replace the call to getTokens with a call to getUnofferedTokens.

    Add the following operation to OutputPinActivation (overriding the inherited operation):

    OutputPinActivation::fire(incomingTokens: Token[*])

    // Add incoming tokens and send offers on outgoing edges.



    In PinActivation::fire, remove the call to this.sendUnofferedTokens.

    (Note: The change to not automatically send the tokens from an input pin is necessary to avoid having the tokens marked as sent before they are read by an action that is not a structured activity node. An input pin can only have outgoing flows if it is an input pin of a structured activity node anyway, so the sending of offers from input pins should be handled in the semantics of structured activity nodes. This will be addressed in a separate, related issue on structured activity node activations.)

  • Reported: FUML 1.0b1 — Tue, 20 Jan 2009 05:00 GMT
  • Disposition: Resolved — FUML 1.0b2
  • Disposition Summary:

    Change the code as proposed

  • Updated: Fri, 6 Mar 2015 20:58 GMT