Dump of Nit model into hypertext human-readable format.

Introduced classes

Redefined classes

redef class Sys

nitc :: model_hyperdoc $ Sys

The main class of the program.
redef class ToolContext

nitc :: model_hyperdoc $ ToolContext

Global context for tools

All class definitions

redef class Sys

nitc :: model_hyperdoc $ Sys

The main class of the program.
redef class ToolContext

nitc :: model_hyperdoc $ ToolContext

Global context for tools
package_diagram nitc::model_hyperdoc model_hyperdoc nitc::metrics_base metrics_base nitc::model_hyperdoc->nitc::metrics_base nitc::modelbuilder modelbuilder nitc::metrics_base->nitc::modelbuilder csv csv nitc::metrics_base->csv counter counter nitc::metrics_base->counter ...nitc::modelbuilder ... ...nitc::modelbuilder->nitc::modelbuilder ...csv ... ...csv->csv ...counter ... ...counter->counter nitc::metrics metrics nitc::metrics->nitc::model_hyperdoc nitc::nitmetrics nitmetrics nitc::nitmetrics->nitc::metrics nitc::api_metrics api_metrics nitc::api_metrics->nitc::metrics nitc::nitmetrics... ... nitc::nitmetrics...->nitc::nitmetrics nitc::api_metrics... ... nitc::api_metrics...->nitc::api_metrics

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module caching

serialization :: caching

Services for caching serialization engines
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module console

console :: console

Defines some ANSI Terminal Control Escape Sequences.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module counter

counter :: counter

Simple numerical statistical analysis and presentation
module csv

csv :: csv

CSV document handling.
module digraph

graph :: digraph

Implementation of directed graphs, also called digraphs.
module engine_tools

serialization :: engine_tools

Advanced services for serialization engines
module environ

core :: environ

Access to the environment variables of the process
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module ini

ini :: ini

Read and write INI configuration files
module inspect

serialization :: inspect

Refine Serializable::inspect to show more useful information
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module kernel

core :: kernel

Most basic classes and methods.
module lexer

nitc :: lexer

Lexer and its tokens.
module lexer_work

nitc :: lexer_work

Internal algorithm and data structures for the Nit lexer
module list

core :: list

This module handle double linked lists
module loader

nitc :: loader

Loading of Nit source files
module location

nitc :: location

Nit source-file and locations in source-file
module math

core :: math

Mathematical operations
module mdoc

nitc :: mdoc

Documentation of model entities
module meta

meta :: meta

Simple user-defined meta-level to manipulate types of instances as object.
module mmodule

nitc :: mmodule

modules and module hierarchies in the metamodel
module model

nitc :: model

Classes, types and properties
module model_base

nitc :: model_base

The abstract concept of model and related common things
module modelbuilder_base

nitc :: modelbuilder_base

Load nit source files and build the associated model
module more_collections

more_collections :: more_collections

Highly specific, but useful, collections-related classes.
module mpackage

nitc :: mpackage

Modelisation of a Nit package
module native

core :: native

Native structures for text and bytes
module nitpm_shared

nitc :: nitpm_shared

Services related to the Nit package manager
module numeric

core :: numeric

Advanced services for Numeric types
module opts

opts :: opts

Management of options on the command line
module ordered_tree

ordered_tree :: ordered_tree

Manipulation and presentation of ordered trees.
module parser

nitc :: parser

Parser.
module parser_nodes

nitc :: parser_nodes

AST nodes of the Nit language
module parser_prod

nitc :: parser_prod

Production AST nodes full definition.
module parser_work

nitc :: parser_work

Internal algorithm and data structures for the Nit parser
module phase

nitc :: phase

Phases of the processing of nit programs
module poset

poset :: poset

Pre order sets and partial order set (ie hierarchies)
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module serialization

serialization :: serialization

General serialization services
module serialization_core

serialization :: serialization_core

Abstract services to serialize Nit objects to different formats
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module stream

core :: stream

Input and output streams of characters
module tables

nitc :: tables

Module that interfaces the parsing tables.
module template

template :: template

Basic template system
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module toolcontext

nitc :: toolcontext

Common command-line tool infrastructure than handle options and error messages
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O
module version

nitc :: version

This file was generated by git-gen-version.sh

Parents

module metrics_base

nitc :: metrics_base

Helpers for various statistics tools.

Children

module metrics

nitc :: metrics

Various statistics about Nit models and programs

Descendants

module a_star-m

a_star-m

module api

nitc :: api

Components required to build a web server about the nit model.
module nitmetrics

nitc :: nitmetrics

A program that collects various metrics on nit programs and libraries
module nitweb

nitc :: nitweb

Runs a webserver based on nitcorn that render things from model.
# Dump of Nit model into hypertext human-readable format.
module model_hyperdoc

import metrics_base

redef class ToolContext
	var model_hyperdoc_phase: Phase = new ModelHyperdocPhase(self, null)
end

private class ModelHyperdocPhase
	super Phase
	redef fun process_mainmodule(mainmodule, given_mmodules)
	do
		if not toolcontext.opt_generate_hyperdoc.value and not toolcontext.opt_all.value then return
		generate_model_hyperdoc(toolcontext, toolcontext.modelbuilder.model)
	end
end

# Genetate a HTML file for the model.
# The generated file contains the description of each entity of the model
fun generate_model_hyperdoc(toolcontext: ToolContext, model: Model)
do
	var buf = new FlatBuffer
	buf.append("<html>\n<body>\n")
	buf.append("<h1>Model</h1>\n")

	buf.append("<h2>Packages</h2>\n")
	for mpackage in model.mpackages do
		buf.append("<h3 id='package-{mpackage}'>Package {mpackage}</h3>\n")
		buf.append("<dl>\n")
		buf.append("<dt>groups</dt>\n")
		for x in mpackage.mgroups do
			buf.append("<dd>{linkto(x)}</dd>\n")
		end
		buf.append("</dl>\n")
	end

	buf.append("<h2>Groups</h2>\n")
	for mpackage in model.mpackages do
		for mgroup in mpackage.mgroups do
			buf.append("<h3 id='group-{mgroup}'>Group {mgroup}</h3>\n")
			buf.append("<dl>\n")
			buf.append("<dt>package</dt>\n")
			buf.append("<dd>{linkto(mpackage)}</dd>\n")
			buf.append("<dt>filepath</dt>\n")
			buf.append("<dd>{mgroup.filepath.to_s}</dd>\n")
			var p = mgroup.parent
			if p != null then
				buf.append("<dt>parent group</dt>\n")
				buf.append("<dd>{linkto(p)}</dd>\n")
			end
			buf.append("<dt>nested groups</dt>\n")
			for x in mgroup.in_nesting.direct_smallers do
				buf.append("<dd>{linkto(x)}</dd>\n")
			end
			buf.append("<dt>modules</dt>\n")
			for x in mgroup.mmodules do
				buf.append("<dd>{linkto(x)}</dd>\n")
			end
		end
		buf.append("</dl>\n")
	end

	buf.append("<h2>Modules</h2>\n")
	for mmodule in model.mmodules do
		buf.append("<h3 id='module-{mmodule}'>{mmodule}</h3>\n")
		buf.append("<dl>\n")
		buf.append("<dt>group</dt>\n")
		var grp = mmodule.mgroup
		if grp != null then buf.append("<dd>{linkto(grp)}</dd>\n")
		buf.append("<dt>direct import</dt>\n")
		for x in mmodule.in_importation.direct_greaters do
			buf.append("<dd>{linkto(x)}</dd>\n")
		end
		buf.append("<dt>direct clients</dt>\n")
		for x in mmodule.in_importation.direct_smallers do
			buf.append("<dd>{linkto(x)}</dd>\n")
		end
		buf.append("<dt>introduced classes</dt>\n")
		for x in mmodule.mclassdefs do
			if not x.is_intro then continue
			buf.append("<dd>{linkto(x.mclass)} by {linkto(x)}</dd>\n")
		end
		buf.append("<dt>refined classes</dt>\n")
		for x in mmodule.mclassdefs do
			if x.is_intro then continue
			buf.append("<dd>{linkto(x.mclass)} by {linkto(x)}</dd>\n")
		end
		buf.append("</dl>\n")
	end
	buf.append("<h2>Classes</h2>\n")
	for mclass in model.mclasses do
		buf.append("<h3 id='class-{mclass}'>{mclass}</h3>\n")
		buf.append("<dl>\n")
		buf.append("<dt>module of introduction</dt>\n")
		buf.append("<dd>{linkto(mclass.intro_mmodule)}</dd>\n")
		buf.append("<dt>class definitions</dt>\n")
		for x in mclass.mclassdefs do
			buf.append("<dd>{linkto(x)} in {linkto(x.mmodule)}</dd>\n")
		end
		buf.append("</dl>\n")
	end
	buf.append("<h2>Class Definitions</h2>\n")
	for mclass in model.mclasses do
		for mclassdef in mclass.mclassdefs do
			buf.append("<h3 id='classdef-{mclassdef}'>{mclassdef}</h3>\n")
			buf.append("<dl>\n")
			buf.append("<dt>module</dt>\n")
			buf.append("<dd>{linkto(mclassdef.mmodule)}</dd>\n")
			buf.append("<dt>class</dt>\n")
			buf.append("<dd>{linkto(mclassdef.mclass)}</dd>\n")
			buf.append("<dt>direct refinements</dt>\n")
			for x in mclassdef.in_hierarchy.direct_greaters do
				if x.mclass != mclass then continue
				buf.append("<dd>{linkto(x)} in {linkto(x.mmodule)}</dd>\n")
			end
			buf.append("<dt>direct refinemees</dt>\n")
			for x in mclassdef.in_hierarchy.direct_smallers do
				if x.mclass != mclass then continue
				buf.append("<dd>{linkto(x)} in {linkto(x.mmodule)}</dd>\n")
			end
			buf.append("<dt>direct superclasses</dt>\n")
			for x in mclassdef.supertypes do
				buf.append("<dd>{linkto(x.mclass)} by {x}</dd>\n")
			end
			buf.append("<dt>introduced properties</dt>\n")
			for x in mclassdef.mpropdefs do
				if not x.is_intro then continue
				buf.append("<dd>{linkto(x.mproperty)} by {linkto(x)}</dd>\n")
			end
			buf.append("<dt>redefined properties</dt>\n")
			for x in mclassdef.mpropdefs do
				if x.is_intro then continue
				buf.append("<dd>{linkto(x.mproperty)} by {linkto(x)}</dd>\n")
			end
			buf.append("</dl>\n")
		end
	end
	buf.append("<h2>Properties</h2>\n")
	for mprop in model.mproperties do
		buf.append("<h3 id='property-{mprop}'>{mprop}</h3>\n")
		buf.append("<dl>\n")
		buf.append("<dt>module of introdcution</dt>\n")
		buf.append("<dd>{linkto(mprop.intro_mclassdef.mmodule)}</dd>\n")
		buf.append("<dt>class of introduction</dt>\n")
		buf.append("<dd>{linkto(mprop.intro_mclassdef.mclass)}</dd>\n")
		buf.append("<dt>class definition of introduction</dt>\n")
		buf.append("<dd>{linkto(mprop.intro_mclassdef)}</dd>\n")
		buf.append("<dt>property definitions</dt>\n")
		for x in mprop.mpropdefs do
			buf.append("<dd>{linkto(x)} in {linkto(x.mclassdef)}</dd>\n")
		end
		buf.append("</dl>\n")
	end
	buf.append("<h2>Property Definitions</h2>\n")
	for mprop in model.mproperties do
		for mpropdef in mprop.mpropdefs do
			buf.append("<h3 id='propdef-{mpropdef}'>{mpropdef}</h3>\n")
			buf.append("<dl>\n")
			buf.append("<dt>module</dt>\n")
			buf.append("<dd>{linkto(mpropdef.mclassdef.mmodule)}</dd>\n")
			buf.append("<dt>class</dt>\n")
			buf.append("<dd>{linkto(mpropdef.mclassdef.mclass)}</dd>\n")
			buf.append("<dt>class definition</dt>\n")
			buf.append("<dd>{linkto(mpropdef.mclassdef)}</dd>\n")
			buf.append("<dt>super definitions</dt>\n")
			for x in mpropdef.mproperty.lookup_super_definitions(mpropdef.mclassdef.mmodule, mpropdef.mclassdef.bound_mtype) do
				buf.append("<dd>{linkto(x)} in {linkto(x.mclassdef)}</dd>\n")
			end
		end
	end
	buf.append("</body></html>\n")
	var f = new FileWriter.open(toolcontext.output_dir.join_path("model.html"))
	f.write(buf.to_s)
	f.close
end

private fun linkto(o: Object): String
do
	if o isa MPackage then
		return "<a href='#package-{o}'>{o}</a>"
	else if o isa MGroup then
		return "<a href='#group-{o}'>{o}</a>"
	else if o isa MModule then
		return "<a href='#module-{o}'>{o}</a>"
	else if o isa MClass then
		return "<a href='#class-{o}'>{o}</a>"
	else if o isa MClassDef then
		return "<a href='#classdef-{o}'>{o}</a>"
	else if o isa MProperty then
		return "<a href='#property-{o}'>{o}</a>"
	else if o isa MPropDef then
		return "<a href='#propdef-{o}'>{o}</a>"
	else
		print "cannot linkto {o.class_name}"
		abort
	end
end
src/metrics/model_hyperdoc.nit:17,1--214,3