GroupingBehavior
With Cord GroupingBehavior, enveloping a behavior in parentheses overrides the binding priorities of operators and builds an aggregate behavior.
Syntax Definition
GroupingBehavior ::= ( Behavior ) .
Example
The following Cord code shows the use of GroupingBehavior. This code is extracted from the stand-alone Operators
sample (see Finding the Code Samples).
// On a non-party day, one can either Eat then Drink, or one can Fast.
// In both of these paths, the day ends by optionally going to Sleep.
machine NoParty() : RegularActivities
{
(
(Eat; Drink)
|
Fast
);
Sleep?
}
In machine NoParty
, GroupingBehavior is used to group the tightly sequenced Eat
and Drink
behaviors into one aggregate behavior. An outer envelope of GroupingBehavior is used to group the aggregate composition of Eat
, Drink
and Fast
which is tightly sequenced with the optional Sleep
behavior. As mentioned, the example shows use of the Tight SequencingBehavior operator (;), the Option RepetitionBehavior operator (?), and the UnionBehavior operator (|).