UnionBehavior

The UnionBehavior operator denotes either one or the other behavior, semantically creating the union of the traces of its operand behaviors.

Syntax Definition

UnionBehavior ::= Behavior | Behavior .

Remarks

The offered signature is the union of the offered signatures of the operands.

Example

The following Cord code shows the use of the UnionBehavior operator. This code is extracted from the stand-alone Operators sample (see Finding the Code Samples).

machine Party() : PartyActivities
{
    (
        (Dance; Sing) | (Eat; Drink)
    );
    KeepPartying?
}

The UnionBehavior operator builds the union of its operands' behavior paths. The possible behavior paths of machine Party are:

1.

Dance then Sing then end or KeepPartying

2.

Eat then Drink then end or KeepPartying

Notice that there are two accepting states before and after KeepPartying. The example also shows use of the Tight SequencingBehavior operator (;), the Option RepetitionBehavior operator (?), and the GroupingBehavior.

See Also

Reference

Machine
CordScript

Concepts

Cord Syntax Definition

Other Resources

Cord Scripting Language