private Set < ClassDescriptor > computeKnownSubtypes ( ClassDescriptor classDescriptor ) throws ClassNotFoundException { LinkedList < ClassVertex > workList = new LinkedList <> ( ) ; ClassVertex startVertex = resolveClassVertex ( classDescriptor ) ; workList . addLast ( startVertex ) ; Set < ClassDescriptor > result = new HashSet <> ( ) ; while ( ! workList . isEmpty ( ) ) { ClassVertex current = workList . removeFirst ( ) ; if ( result . contains ( current . getClassDescriptor ( ) ) ) { // Already added this class continue ; } // Add class to the result result . add ( current . getClassDescriptor ( ) ) ; // Add all known subtype vertices to the work list Iterator < InheritanceEdge > i = graph . incomingEdgeIterator ( current ) ; while ( i . hasNext ( ) ) { InheritanceEdge edge = i . next ( ) ; workList . addLast ( edge . getSource ( ) ) ; } } return new HashSet <> ( result ) ; }
Compute set of known subtypes of class named by given ClassDescriptor .