Object Sets

It is possible to group objects into groups (sets) and then perform actions and tests on all members of the set.

Declaration:

1) Simple Object Set

ObjectSet : set-name [ {obj1,obj2,...objn} ]

where the optional construct {obj1,obj2,...objn} initialises the set with the listed objects

An object can be dynamically inserted in (removed from) a declared set. This is achieved by executing the following 3 instructions :

insert object-name in set-name

remove object-name from set-name

removeAll from set-name

2) Union Set

It is possible to define an Object Set, which is union of other Object Sets. This is achieved by using a key-word ‘union’ in the declaration of the Object Set:

ObjectSet : set-name union {set-name1,set-name2,...set-namen}

A couple of notes:

  1. At the moment, an Union Set can not be a member of another Union Set. Declaration of a Union Set is static as far as its composition in terms of the Object Sets is concerned. It is however dynamic as far as its composition in terms of the Objects is concerned See note2.
  2. inserting/removing objects directly into/from Union Set is not permitted as it is not very meaningful. This is because an object can belong to more than one Simple Object Set in the union. The results of insert/remove operations performed directly on the Simple Object Sets contained there in are faithfully reflected in the object contents of the Union Set. In particular, when an Object O is removed/inserted from/into Simple Object Set S, it is then removed/inserted from/into Union Set U depending on whether O also belongs to any other Object Set in the union. Also, all the other Union Sets, which contain Object Set S, are treated in a similar fashion.

Usage in simple conditions

( any_in set-name in_state {state-list} )

( all_in set-name in_state {state-list} )

( set-name empty )

  1. In the above not_in_state and not_empty are also valid.
  2. these simple conditions can be part of any composite condition.

Usage in DO instruction

do action-name all_in set-name

Examples

do SWITCH-ON all_in POWER-SUPPLIES