Une image contenant texte, signe

Description générée automatiquement

Context Pattern Editor – Occurrence

 

Occurrence

The Occurrence field specifies the recursive behavior of tokens and has the following values:

 

·       None (empty)

·       Zero or More

·       One or More

None

No recursion – only elements at ‘this level’

For example:

{pkg}Package

Captures only the top-level packages of the model

One or More

Represented by a + symbol in the pattern, this occurrence means ‘the element must be there at least once for the pattern to match but could be there more than once’

{pkg}Package+

Recurses through the model and captures all Packages (if they are owned by Packages)

{pkg}Package+,{blk}Block

Recurses through the model and captures all Packages and then captures any top-level Blocks in those Packages

{pkg}Package+,{blk}Block+

Adding a + to the Block would then also capture Blocks under other Blocks recursively.

Zero or More

Represented by a * symbol in the pattern, this makes tokens effectively optional.

For example:

{pkg}Package,{blk}Block,{req}Requirement

Matches top-level Packages and then top-level Blocks in those packages and then matches requirements under those Blocks

 

{pkgPackage},{blk}Block*,{req}Requirement

The addition of * to the Block token makes it optional. This pattern would therefore match requirements at Package level as well as those under Blocks.