A basic collection operator
- Last Updated: March 24, 2022
- 1 minute read
- Corticon
- Version 6.3
- Documentation
As an example, use the ->size operator (see
the Rule Language Guide for more about this operator). This
operator returns the number of elements in the collection that it follows in a rule
expression. Using the collection from Visualizing a Collection of Pilots:
aircraft.pilot -> size
returns the value of 2. In the expression:
aircraft.crewSize = aircraft.pilot -> size
crewSize (assumed to be an attribute of
Aircraft) is assigned the value of 2.
Corticon Studio requires that all rules containing collection operators use unique aliases to represent the collections. Using aliases to represent collections is described in greater detail in this chapter. A more accurate expression of the previous rule becomes:
plane.pilot -> size
or
plane.crewsize = plane.pilot -> size
where plane is an alias for the collection
of pilots on aircraft.