Package org.jetbrains.mps.util
Class DepthFirstConceptIterator
- java.lang.Object
-
- org.jetbrains.mps.util.DepthFirstConceptIterator
-
- All Implemented Interfaces:
Iterable<SAbstractConcept>
,Iterator<SAbstractConcept>
public class DepthFirstConceptIterator extends Object implements Iterable<SAbstractConcept>, Iterator<SAbstractConcept>
Traverse hierarchy ofSConcepts
for a given concept (inclusive), visiting super-concepts first then super-interfaces in an order they were specified in super-concepts (breadth-like). FIXME make it truly breadth-first, for interface concepts as well. 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, the order would be ConceptB, ConceptA, I3, I4, I1, I2, I5, I1 Note, same concept may appear few times in this iterator, no unique filtering is done. UseUniqueIterator
if necessary. FIXME functionality of this class shall get exposed from SConcept API (likely, in addition to public iterator not to limit to single iteration approach, i.e. depth or breadth first).
-
-
Constructor Summary
Constructors Constructor Description DepthFirstConceptIterator(SAbstractConcept start)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Iterator<SAbstractConcept>
iterator()
SAbstractConcept
next()
void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
DepthFirstConceptIterator
public DepthFirstConceptIterator(@NotNull SAbstractConcept start)
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<SAbstractConcept>
-
next
public SAbstractConcept next()
- Specified by:
next
in interfaceIterator<SAbstractConcept>
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<SAbstractConcept>
-
iterator
@NotNull public Iterator<SAbstractConcept> iterator()
- Specified by:
iterator
in interfaceIterable<SAbstractConcept>
-
-