How to display a specific element of the tree

By defaut, uses to_s

Subclasses should redefine this method to provide a specific output

Property definitions

ordered_tree $ OrderedTree :: display
	# How to display a specific element of the tree
	# By defaut, uses `to_s`
	#
	# Subclasses should redefine this method to provide a specific output
	fun display(e: E): String do return e.to_s
lib/ordered_tree/ordered_tree.nit:196,2--200,43

nitc $ ProjTree :: display
	redef fun display(o)
	do
		if o isa MGroup then
			if opt_paths then
				return o.filepath.as(not null)
			else
				var d = ""
				if o.mdoc != null then
					if tc.opt_no_color.value then
						d = ": {o.mdoc.content.first}"
					else
						d = ": {o.mdoc.content.first.green}"
					end
				end
				if tc.opt_no_color.value then
					return "{o.name}{d} ({o.filepath.to_s})"
				else
					return "{o.name}{d} ({o.filepath.yellow})"
				end
			end
		else if o isa MModule then
			if opt_paths then
				return o.filepath.as(not null)
			else
				var d = ""
				var dd = ""
				if o.mdoc != null then
					if tc.opt_no_color.value then
						d = ": {o.mdoc.content.first}"
					else
						d = ": {o.mdoc.content.first.green}"
					end
				end
				if not o.in_importation.direct_greaters.is_empty then
					var ms = new Array[String]
					for m in o.in_importation.direct_greaters do
						if m.mgroup.mpackage == o.mgroup.mpackage then
							ms.add m.name
						else
							ms.add m.full_name
						end
					end
					if tc.opt_no_color.value then
						dd = " ({ms.join(" ")})"
					else
						dd = " ({ms.join(" ")})".light_gray
					end
				end
				if tc.opt_no_color.value then
					return "{o.name.bold}{d} ({o.filepath.to_s}){dd}"
				else
					return "{o.name.bold}{d} ({o.filepath.yellow}){dd}"
				end
			end
		else
			abort
		end
	end
src/nitls.nit:30,2--87,4

nitc $ MPackageTree :: display
	redef fun display(a) do
		if a isa MGroup then
			if a.parent == null then return "{a.mpackage.name} ({a.filepath or else "?"})"
			return a.name + " (group)"
		else if a isa MModule then
			return a.name
		else
			abort
		end
	end
src/model/model_viz.nit:28,2--37,4

nitc $ ASTDump :: display
	redef fun display(n)
	do
		return "{n.class_name} {n.dump_info(self)} @{n.location}"
	end
src/parser/parser_nodes.nit:236,2--239,4