Collect self ancestors (direct and indirect)

The concept of ancestor is abstract at this stage.

Property definitions

nitc :: model_collect $ MEntity :: collect_ancestors
	# Collect `self` ancestors (direct and indirect)
	#
	# The concept of ancestor is abstract at this stage.
	fun collect_ancestors(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY] do
		var done = new HashSet[MENTITY]
		var todo = new Array[MENTITY]

		todo.add_all collect_parents(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_parents(mainmodule, filter)
		end
		return done
	end
src/model/model_collect.nit:61,2--76,4

nitc :: model_collect $ MClass :: collect_ancestors
	# Collect all ancestors of `self`
	redef fun collect_ancestors(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).greaters 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:652,2--661,4

nitc :: model_collect $ MModule :: collect_ancestors
	# Collect all modules directly imported by `self`
	redef fun collect_ancestors(mainmodule, filter) do
		var res = new HashSet[MENTITY]
		for mentity in in_importation.greaters 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:479,2--487,4