Previous UML Classes Table of Contents UML Packages Next


11.3.6 AddVariableValueAction

StructuredActions


   AddVariableValueAction is a write variable action for adding values to a variable.

*Generalizations

   

    WriteVariableAction (from StructuredActions ) on page 305

*Description

   Variables are potentially multi-valued and ordered, so the action supports specification of insertion points for new values. It also supports the removal of existing values of the variable before the new value is added.

*Attributes

   • isReplaceAll : Boolean [1..1] = false Specifies whether existing values of the variable should be removed before adding the new value.

*Associations

   • insertAt : InputPin [0..1] Gives the position at which to insert a new value or move an existing value in ordered variables. The type is UnlimitedINatural, but the value cannot be zero. This pin is omitted for unordered variables. (Subsets Action::input)

*Constraints

   [1] Actions adding values to ordered variables must have a single input pin for the insertion point with type UnlimitedNatural and multiplicity of 1..1, otherwise the action has no input pin for the insertion point.

   let insertAtPins : Collection = self.insertAt in

   if self.variable.ordering = #unordered

   then insertAtPins->size() = 0

   else let insertAtPin : InputPin = insertAt->asSequence()->first() in

   insertAtPins->size() = 1

   and insertAtPin.type = UnlimitedNatural

   and insertAtPin.multiplicity.is(1,1))

   endif

*Semantics

   If isReplaceAll is true, then the existing values of the variable are removed before the new one added, except if the new value already exists, then it is not removed under this option. If isReplaceAll is false and the variable is unordered and non-unique, then adding an existing value has no effect.

Issue 8150 -add explanation at end for case of all values

   Values of a variable may be ordered or unordered, even if the multiplicity maximum is 1. Adding values to ordered variables requires an insertion point for a new value using the insertAt input pin. The insertion point is a positive integer giving the position to insert the value, or unlimited, to insert at the end. A positive integer less than or equal to the current number of values means to insert the new value at that position in the sequence of existing values, with the integer one meaning the new value will be first in the sequence. A value of unlimited for insertAt means to insert the new value at the end of the sequence. The semantics is undefined for a value of zero or an integer greater than the number of existing values. The insertion point is required for ordered variables and omitted for unordered variables. Reinserting an existing value at a new position in an ordered unique variable moves the value to that position (this works because variable values are sets). The insertion point is ignored when replacing all values.

   The semantics is undefined for adding a value that violates the upper multiplicity of the variable. Removing a value succeeds even when that violates the minimum multiplicity—the same as if the minimum were zero. The modeler must determine when minimum multiplicity of variables should be enforced.

*Notation

   No specific notation

   AddVariableValueAction is introduced to add variable values. isReplaceAll is introduced to replace and add in a single action, with no intermediate states of the variable where only some of the existing values are present.

*Changes from previous UML

   AddVariableValueAction is unchanged from UML 1.5.