/** * Excludes the given GraphElementClass and all its subclasses. * * @param processed marks already processed Elements. * @param currentGraphElementClass the GraphElementClass to exclude. */ private void excludeGraphElementClass( LocalBooleanGraphMarker processed, VertexClass currentGraphElementClass) { processed.mark(currentGraphElementClass); includes.removeMark(currentGraphElementClass); for (SpecializesVertexClass_superVertexClass current : currentGraphElementClass.getSpecializesVertexClass_superVertexClassIncidences()) { VertexClass superclass = (VertexClass) current.getThat(); excludeGraphElementClass(processed, superclass); } }
/** * Checks if a VertexClass should be excluded. * * @param processed marks already processed elements. * @param currentVertexClass the VertexClass to check. * @return true if the given VertexClass should be excluded */ private boolean isVertexClassExcluded( LocalBooleanGraphMarker processed, VertexClass currentVertexClass) { if (processed.isMarked(currentVertexClass) || !currentVertexClass.is_abstract()) { return !includes.isMarked(currentVertexClass); } processed.mark(currentVertexClass); if (!includes.isMarked(currentVertexClass)) { // abstract and already excluded return false; } for (SpecializesVertexClass_superVertexClass current : currentVertexClass.getSpecializesVertexClass_superVertexClassIncidences()) { if (!isVertexClassExcluded(processed, (VertexClass) current.getThat())) { // at least one subclass is not excluded return false; } } // all subclasses are excluded or is abstract leaf (which should not // occur) return true; }