nitc :: MEntity :: collect_descendants
self
descendants (direct and direct)The concept of descendant is abstract at this stage.
# Collect `self` descendants (direct and direct)
#
# The concept of descendant is abstract at this stage.
fun collect_descendants(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY] do
var done = new HashSet[MENTITY]
var todo = new Array[MENTITY]
todo.add_all collect_children(mainmodule, filter)
while todo.not_empty do
var mentity = todo.pop
if mentity == self or done.has(mentity) then continue
done.add mentity
todo.add_all mentity.collect_children(mainmodule, filter)
end
return done
end
src/model/model_collect.nit:88,2--103,4
# Collect all descendants of `self`
redef fun collect_descendants(mainmodule, filter) do
var res = new HashSet[MENTITY]
if not mainmodule.flatten_mclass_hierarchy.has(self) then return res
for mclass in in_hierarchy(mainmodule).smallers do
if mclass == self then continue
if filter == null or filter.accept_mentity(mclass) then res.add mclass
end
return res
end
src/model/model_collect.nit:685,2--694,4
# Collect all module descendants of `self` (direct and transitive imports)
redef fun collect_descendants(mainmodule, filter) do
var res = new HashSet[MENTITY]
for mentity in in_importation.smallers do
if mentity == self then continue
if filter == null or filter.accept_mentity(mentity) then res.add mentity
end
return res
end
src/model/model_collect.nit:509,2--517,4