001    // Collection attributes. See section 4.2 in the paper
002    // Reference manual: http://jastadd.org/
003    
004    import java.util.*;
005    aspect Graph {
006      coll Set<Transition> State.transitions() [new HashSet<Transition>()] with add;
007      
008      Transition contributes this
009        when source() != null
010        to State.transitions()
011        for source();
012      
013      syn Set<State> State.successors() {
014        Set<State> result = new HashSet<State>();
015        for (Transition t : transitions()) {
016          if (t.target() != null) result.add(t.target());
017        }
018        return result;
019      }
020    
021    }