Limited collection attributes

Issue #125 new
Jesper Öqvist created an issue

It would be useful if one could limit a collection attribute so that it excludes contributions from specific subtrees.

Say for example that we have the collection attribute wornHats that collects hats worn by different agents in a world:

coll Collection<Hat> World.wornHats()
  [new LinkedList<Hat>()]
  with add
  root World;

Agent contributes myHat()
  when hasHat()
  to World.hats()
  for world();

We have two agents: Cat and Person, as well as three entities: Car, Train and Boat. People and cats can wear hats in cars and trains, but not boats. Due to the wind on a boat the hat can not be worn, only carried. So it would be useful if we can somehow exclude all boats from the collection traversal:

World.wornHats() excludes Boat;

This has the additional advantage of possibly lower collection time since fewer nodes will be searched.

Comments (4)

  1. Log in to comment