Class BreadthConceptHierarchyIterator

  • All Implemented Interfaces:
    Iterable<SAbstractConcept>, Iterator<SAbstractConcept>

    public class BreadthConceptHierarchyIterator
    extends Object
    implements Iterable<SAbstractConcept>, Iterator<SAbstractConcept>
    Iterates hierarchy of concepts, breadth-first. Iterator doesn't support removals. Return values are not unique, e.g. if an interface is implemented by few concepts, it is reported several times. Wrap with UniqueIterator if necessary. Given ConceptA implements I1, I2 and ConceptB extends ConceptA implements I3, I4; Interface I3 extends I5; Interface I5 extends I1; and ConceptB as starting point, yields: { ConceptB, I3, I4 } - level 0 for ConceptB, { ConceptA, I1, I2 } - level 1 from ConceptA , { I5 } level 1 from I3, {I1} - level 2 from I5. Note, this class is similar to org.jetbrains.mps.openapi.language.SConceptUtil, except for explicit walk algorithm and OOP-friendly style.