A named class

MClasses are global to the model; it means that a MClass is not bound to a specific MModule.

This characteristic helps the reasoning about classes in a program since a single MClass object always denote the same class.

The drawback is that classes (MClass) contain almost nothing by themselves. These do not really have properties nor belong to a hierarchy since the property and the hierarchy of a class depends of the refinement in the modules.

Most services on classes require the precision of a module, and no one can asks what are the super-classes of a class nor what are properties of a class without precising what is the module considered.

For instance, during the typing of a source-file, the module considered is the module of the file. eg. the question is the method foo exists in the class Bar? must be reformulated into is the method foo exists in the class Bar in the current module?

During some global analysis, the module considered may be the main module of the program.

Introduced properties

private var _abstract_loaded: Bool

nitc :: MClass :: _abstract_loaded

Indicate this class was partially loaded (it only has its identifier allocated)
private var _actor: nullable MClass

nitc :: MClass :: _actor

Adding the actor class to a class annotated with "is actor"
private var _arity: Int

nitc :: MClass :: _arity

The number of generic formal parameters
private var _c_name: String

nitc :: MClass :: _c_name

private var _color: Int

nitc :: MClass :: _color

Color for Cohen subtyping test : the absolute position of the id
private var _ftype_cache: nullable ForeignType

nitc :: MClass :: _ftype_cache

private var _full_name: String

nitc :: MClass :: _full_name

The canonical name of the class
private var _has_new_factory: Bool

nitc :: MClass :: _has_new_factory

Is there a new factory to allow the pseudo instantiation?
private var _html_url: String

nitc :: MClass :: _html_url

private var _intro: MClassDef

nitc :: MClass :: _intro

The definition that introduces the class.
private var _intro_mattributes: Array[MAttribute]

nitc :: MClass :: _intro_mattributes

The MAttribute this class introduced
private var _intro_mmethods: Array[MMethod]

nitc :: MClass :: _intro_mmethods

The MMethod this class introduced
private var _intro_mmodule: MModule

nitc :: MClass :: _intro_mmodule

The module that introduce the class
private var _is_abstract: Bool

nitc :: MClass :: _is_abstract

Is self and abstract class?
private var _is_class: Bool

nitc :: MClass :: _is_class

Is self a standard or abstract class kind?
private var _is_enum: Bool

nitc :: MClass :: _is_enum

Is self an enum kind?
private var _is_example: Bool

nitc :: MClass :: _is_example

private var _is_interface: Bool

nitc :: MClass :: _is_interface

Is self an interface kind?
private var _is_test: Bool

nitc :: MClass :: _is_test

private var _kind: MClassKind

nitc :: MClass :: _kind

The kind of the class (interface, abstract class, etc.)
private var _loaded: Bool

nitc :: MClass :: _loaded

True when the class is effectively loaded by the vm, false otherwise
private var _location: Location

nitc :: MClass :: _location

private var _mattributes: Array[MAttribute]

nitc :: MClass :: _mattributes

All MAttribute this class contains
private var _mclass_type: MClassType

nitc :: MClass :: _mclass_type

The principal static type of the class.
private var _mclassdefs: Array[MClassDef]

nitc :: MClass :: _mclassdefs

All class definitions (introduction and refinements)
private var _mmethods: Array[MMethod]

nitc :: MClass :: _mmethods

All MMethod this class contains
private var _mparameters: Array[MParameterType]

nitc :: MClass :: _mparameters

Each generic formal parameters in order.
private var _name: String

nitc :: MClass :: _name

The short name of the class
private var _ordering: Array[MClass]

nitc :: MClass :: _ordering

The linear extension of all superclasses with the prefix rule
private var _position_attributes: Int

nitc :: MClass :: _position_attributes

The position of the class' block in virtual table,
private var _position_methods: Int

nitc :: MClass :: _position_methods

The position of the class' block in attribute table
private var _positions_attributes: HashMap[MClass, Int]

nitc :: MClass :: _positions_attributes

For superclasses which have a non-invariant position, keep their position in attribute table
private var _positions_methods: HashMap[MClass, Int]

nitc :: MClass :: _positions_methods

For superclasses which have a non-invariant position, keep their position in virtual table
private var _prefix: nullable MClass

nitc :: MClass :: _prefix

The chosen prefix for this class.
private var _the_root_init_mmethod: nullable MMethod

nitc :: MClass :: _the_root_init_mmethod

The base init of the class.
private var _visibility: MVisibility

nitc :: MClass :: _visibility

The visibility of the class
private var _vtable: nullable VTable

nitc :: MClass :: _vtable

A reference to the virtual table of this class
fun abstract_loaded: Bool

nitc :: MClass :: abstract_loaded

Indicate this class was partially loaded (it only has its identifier allocated)
protected fun abstract_loaded=(abstract_loaded: Bool)

nitc :: MClass :: abstract_loaded=

Indicate this class was partially loaded (it only has its identifier allocated)
fun actor: nullable MClass

nitc :: MClass :: actor

Adding the actor class to a class annotated with "is actor"
protected fun actor=(actor: nullable MClass)

nitc :: MClass :: actor=

Adding the actor class to a class annotated with "is actor"
private fun allocate_vtable(vm: VirtualMachine)

nitc :: MClass :: allocate_vtable

Allocate a single vtable
fun arity: Int

nitc :: MClass :: arity

The number of generic formal parameters
protected fun arity=(arity: Int)

nitc :: MClass :: arity=

The number of generic formal parameters
protected fun c_name=(c_name: String)

nitc :: MClass :: c_name=

private fun calculate_delta(nb_attributes: Array[Int]): Array[Int]

nitc :: MClass :: calculate_delta

Computes delta for each class
fun collect_accessible_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_accessible_inits

Collect all init methods accessible by self
fun collect_accessible_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_accessible_mattributes

Collect all attributes accessible by self
fun collect_accessible_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_accessible_mmethods

Collect all methods accessible by self
fun collect_accessible_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_accessible_mproperties

Collect all properties accessible by self
fun collect_accessible_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_accessible_vts

Collect all virtual types accessible by self
fun collect_inherited_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_inherited_inits

Collect all init methods inherited by self
fun collect_inherited_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_inherited_mattributes

Collect all attributes inherited by self
fun collect_inherited_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_inherited_mmethods

Collect all methods inherited by self
fun collect_inherited_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_inherited_mproperties

Collect all properties inehrited by self
fun collect_inherited_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_inherited_vts

Collect all virtual types inherited by self
fun collect_intro_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_intro_inits

Collect all init methods introduced in self
fun collect_intro_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_intro_mattributes

Collect all attributes introduced in self
fun collect_intro_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_intro_mmethods

Collect all methods introduced in self
fun collect_intro_mpropdefs(filter: nullable ModelFilter): Set[MPropDef]

nitc :: MClass :: collect_intro_mpropdefs

Collect all property definitions that are introductions in self
fun collect_intro_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_intro_mproperties

Collect all properties introduced in self
fun collect_intro_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_intro_vts

Collect all virtual types introduced in self
fun collect_local_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_local_inits

Collect all init methods introduced and redefined in self
fun collect_local_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_local_mattributes

Collect all attributes introduced and redefined in self
fun collect_local_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_local_mmethods

Collect all methods introduced and redefined in self
fun collect_local_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_local_mproperties

Collect all properties introduced and redefined in self
fun collect_local_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_local_vts

Collect all virtual types introduced or redefined in self
fun collect_mclassdefs(filter: nullable ModelFilter): Set[MClassDef]

nitc :: MClass :: collect_mclassdefs

Collect all class definitions of self
fun collect_redef_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_redef_inits

Collect all init methods redefined in self
fun collect_redef_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_redef_mattributes

Collect all attributes redefined in self
fun collect_redef_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_redef_mmethods

Collect all methods redefined in self
fun collect_redef_mpropdefs(filter: nullable ModelFilter): Set[MPropDef]

nitc :: MClass :: collect_redef_mpropdefs

Collect all propierty definitions that are redefinition in self
fun collect_redef_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_redef_mproperties

Collect all properties redefined in self
fun collect_redef_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_redef_vts

Collect all virtual types redefined in self
fun color: Int

nitc :: MClass :: color

Color for Cohen subtyping test : the absolute position of the id
protected fun color=(color: Int)

nitc :: MClass :: color=

Color for Cohen subtyping test : the absolute position of the id
fun compile_to_java(v: JavaCompilerVisitor)

nitc :: MClass :: compile_to_java

Generate a Java RTClass for a Nit MClass
fun compile_type_table(v: JavaCompilerVisitor)

nitc :: MClass :: compile_type_table

Compile the type table for the MClass
private fun compile_vft(v: JavaCompilerVisitor)

nitc :: MClass :: compile_vft

Compile the virtual function table for the mclass
private fun compute_ftype(v: ExternClassesTypingPhaseModel): nullable ForeignType

nitc :: MClass :: compute_ftype

Type in C of the extern class
private fun compute_identifier(vm: VirtualMachine, ids: Array[Int], offset_methods: Int)

nitc :: MClass :: compute_identifier

Allocate a unique identifier to the class with perfect hashing
private fun create_abstract_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef

nitc :: MClass :: create_abstract_method

This method create an abstract method representation with this MMethodDef an this AMethoddef
private fun create_empty_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef

nitc :: MClass :: create_empty_method

Create method with an empty block
fun ctype: nullable String

nitc :: MClass :: ctype

init defaultinit(intro_mmodule: MModule, name: String, location: Location, parameter_names: nullable Array[String], kind: MClassKind, visibility: MVisibility)

nitc :: MClass :: defaultinit

private fun dfs(v: VirtualMachine, res: Array[MClass]): Array[MClass]

nitc :: MClass :: dfs

A kind of Depth-First-Search for superclasses ordering
fun ditc(mainmodule: MModule): Int

nitc :: MClass :: ditc

Class Depth in Inheritance Tree
fun diti(mainmodule: MModule): Int

nitc :: MClass :: diti

Interface Depth in Inheritance Tree
fun extended_mproperties(filter: ModelFilter): Set[MProperty]

nitc :: MClass :: extended_mproperties

the set of redefition that call to super
private fun fill_vtable(vm: VirtualMachine, table: VTable, cl: MClass)

nitc :: MClass :: fill_vtable

Fill the vtable with local methods for self class
fun ftype: nullable ForeignType

nitc :: MClass :: ftype

Extern type associated to this class according to specialisation
private fun ftype_cache: nullable ForeignType

nitc :: MClass :: ftype_cache

private fun ftype_cache=(ftype_cache: nullable ForeignType)

nitc :: MClass :: ftype_cache=

private fun ftype_computed=(ftype_computed: Bool)

nitc :: MClass :: ftype_computed=

protected fun full_name=(full_name: String)

nitc :: MClass :: full_name=

The canonical name of the class
fun get_mtype(mtype_arguments: Array[MType]): MClassType

nitc :: MClass :: get_mtype

Return a generic type based on the class
private fun get_mtype_cache=(get_mtype_cache: HashMap[Array[MType], MGenericType])

nitc :: MClass :: get_mtype_cache=

fun get_position_attributes(cl: MClass): Int

nitc :: MClass :: get_position_attributes

Return the position of the attribute's block of class cl in self if cl has an invariant position in self,
fun get_position_methods(cl: MClass): Int

nitc :: MClass :: get_position_methods

Return the position of the method's block of class cl in self if cl has an invariant position in self,
fun has_new_factory: Bool

nitc :: MClass :: has_new_factory

Is there a new factory to allow the pseudo instantiation?
fun has_new_factory=(has_new_factory: Bool)

nitc :: MClass :: has_new_factory=

Is there a new factory to allow the pseudo instantiation?
fun in_hierarchy(mmodule: MModule): POSetElement[MClass]

nitc :: MClass :: in_hierarchy

Return the class self in the class hierarchy of the module mmodule.
fun intro: MClassDef

nitc :: MClass :: intro

The definition that introduces the class.
protected fun intro=(intro: MClassDef)

nitc :: MClass :: intro=

The definition that introduces the class.
fun intro_mattributes: Array[MAttribute]

nitc :: MClass :: intro_mattributes

The MAttribute this class introduced
protected fun intro_mattributes=(intro_mattributes: Array[MAttribute])

nitc :: MClass :: intro_mattributes=

The MAttribute this class introduced
fun intro_mmethods: Array[MMethod]

nitc :: MClass :: intro_mmethods

The MMethod this class introduced
protected fun intro_mmethods=(intro_mmethods: Array[MMethod])

nitc :: MClass :: intro_mmethods=

The MMethod this class introduced
fun intro_mmodule: MModule

nitc :: MClass :: intro_mmodule

The module that introduce the class
protected fun intro_mmodule=(intro_mmodule: MModule)

nitc :: MClass :: intro_mmodule=

The module that introduce the class
fun is_abstract: Bool

nitc :: MClass :: is_abstract

Is self and abstract class?
protected fun is_abstract=(is_abstract: Bool)

nitc :: MClass :: is_abstract=

Is self and abstract class?
fun is_class: Bool

nitc :: MClass :: is_class

Is self a standard or abstract class kind?
protected fun is_class=(is_class: Bool)

nitc :: MClass :: is_class=

Is self a standard or abstract class kind?
fun is_enum: Bool

nitc :: MClass :: is_enum

Is self an enum kind?
protected fun is_enum=(is_enum: Bool)

nitc :: MClass :: is_enum=

Is self an enum kind?
private fun is_equal(filter: ModelFilter): Bool

nitc :: MClass :: is_equal

equals contain as redifinition than introduction
protected fun is_example=(is_example: Bool)

nitc :: MClass :: is_example=

private fun is_extender(filter: ModelFilter): Bool

nitc :: MClass :: is_extender

extenders contain more introduction than redefinitions
fun is_interface: Bool

nitc :: MClass :: is_interface

Is self an interface kind?
protected fun is_interface=(is_interface: Bool)

nitc :: MClass :: is_interface=

Is self an interface kind?
private fun is_overrider(filter: ModelFilter): Bool

nitc :: MClass :: is_overrider

overriders contain more definitions than introductions
private fun is_pure_extender(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_extender

pure extenders contain only introductions
private fun is_pure_overrider(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_overrider

pure overriders contain only redefinitions
private fun is_pure_replacer(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_replacer

pure replacers never call to super in its redefinitions
private fun is_pure_specializer(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_specializer

pure specializers always call to super in its redefinitions
private fun is_replacer(filter: ModelFilter): Bool

nitc :: MClass :: is_replacer

replacers have less redefinitions that call super than not calling it
private fun is_specializer(filter: ModelFilter): Bool

nitc :: MClass :: is_specializer

specializers have more redefinitions that call super than not calling it
fun kind: MClassKind

nitc :: MClass :: kind

The kind of the class (interface, abstract class, etc.)
protected fun kind=(kind: MClassKind)

nitc :: MClass :: kind=

The kind of the class (interface, abstract class, etc.)
fun loaded: Bool

nitc :: MClass :: loaded

True when the class is effectively loaded by the vm, false otherwise
protected fun loaded=(loaded: Bool)

nitc :: MClass :: loaded=

True when the class is effectively loaded by the vm, false otherwise
protected fun location=(location: Location)

nitc :: MClass :: location=

private fun make_vt(vm: VirtualMachine, explicit: Bool)

nitc :: MClass :: make_vt

Allocates a VTable for this class and gives it an id
fun mattributes: Array[MAttribute]

nitc :: MClass :: mattributes

All MAttribute this class contains
protected fun mattributes=(mattributes: Array[MAttribute])

nitc :: MClass :: mattributes=

All MAttribute this class contains
fun mclass_type: MClassType

nitc :: MClass :: mclass_type

The principal static type of the class.
protected fun mclass_type=(mclass_type: MClassType)

nitc :: MClass :: mclass_type=

The principal static type of the class.
fun mclassdefs: Array[MClassDef]

nitc :: MClass :: mclassdefs

All class definitions (introduction and refinements)
protected fun mclassdefs=(mclassdefs: Array[MClassDef])

nitc :: MClass :: mclassdefs=

All class definitions (introduction and refinements)
fun mmethods: Array[MMethod]

nitc :: MClass :: mmethods

All MMethod this class contains
protected fun mmethods=(mmethods: Array[MMethod])

nitc :: MClass :: mmethods=

All MMethod this class contains
fun moved_class_attributes(vm: VirtualMachine, current_class: MClass, offset: Int)

nitc :: MClass :: moved_class_attributes

This method is called when current_class class is moved in attribute table of self
fun moved_class_methods(vm: VirtualMachine, current_class: MClass, offset: Int)

nitc :: MClass :: moved_class_methods

This method is called when current_class class is moved in virtual table of self
fun mparameters: Array[MParameterType]

nitc :: MClass :: mparameters

Each generic formal parameters in order.
protected fun mparameters=(mparameters: Array[MParameterType])

nitc :: MClass :: mparameters=

Each generic formal parameters in order.
protected fun name=(name: String)

nitc :: MClass :: name=

The short name of the class
protected fun nitdoc_breadcrumbs=(nitdoc_breadcrumbs: Array[MEntity])

nitc :: MClass :: nitdoc_breadcrumbs=

fun ordering: Array[MClass]

nitc :: MClass :: ordering

The linear extension of all superclasses with the prefix rule
protected fun ordering=(ordering: Array[MClass])

nitc :: MClass :: ordering=

The linear extension of all superclasses with the prefix rule
fun overriden_mproperties(filter: ModelFilter): Set[MProperty]

nitc :: MClass :: overriden_mproperties

the set of redefition that do not call to super
fun position_attributes: Int

nitc :: MClass :: position_attributes

The position of the class' block in virtual table,
protected fun position_attributes=(position_attributes: Int)

nitc :: MClass :: position_attributes=

The position of the class' block in virtual table,
fun position_methods: Int

nitc :: MClass :: position_methods

The position of the class' block in attribute table
protected fun position_methods=(position_methods: Int)

nitc :: MClass :: position_methods=

The position of the class' block in attribute table
fun positions_attributes: HashMap[MClass, Int]

nitc :: MClass :: positions_attributes

For superclasses which have a non-invariant position, keep their position in attribute table
protected fun positions_attributes=(positions_attributes: HashMap[MClass, Int])

nitc :: MClass :: positions_attributes=

For superclasses which have a non-invariant position, keep their position in attribute table
fun positions_methods: HashMap[MClass, Int]

nitc :: MClass :: positions_methods

For superclasses which have a non-invariant position, keep their position in virtual table
protected fun positions_methods=(positions_methods: HashMap[MClass, Int])

nitc :: MClass :: positions_methods=

For superclasses which have a non-invariant position, keep their position in virtual table
fun prefix: nullable MClass

nitc :: MClass :: prefix

The chosen prefix for this class.
protected fun prefix=(prefix: nullable MClass)

nitc :: MClass :: prefix=

The chosen prefix for this class.
private fun rt_name: String

nitc :: MClass :: rt_name

Runtime name
private fun set_offsets(vm: VirtualMachine, explicit: Bool)

nitc :: MClass :: set_offsets

Set the offsets for the properties introduced by self class
protected fun setup_parameter_names(parameter_names: nullable Array[String])

nitc :: MClass :: setup_parameter_names

Initialize mparameters from their names.
fun signature_to_s: String

nitc :: MClass :: signature_to_s

A string version of the signature a generic class.
private fun superclasses_ordering(v: VirtualMachine): Array[MClass]

nitc :: MClass :: superclasses_ordering

Order superclasses of self
fun the_root_init_mmethod: nullable MMethod

nitc :: MClass :: the_root_init_mmethod

The base init of the class.
protected fun the_root_init_mmethod=(the_root_init_mmethod: nullable MMethod)

nitc :: MClass :: the_root_init_mmethod=

The base init of the class.
fun try_intro: nullable MClassDef

nitc :: MClass :: try_intro

The definition that introduces the class or null if not yet known.
private fun update_positions(offset_attributes: Int, offset_methods: Int)

nitc :: MClass :: update_positions

Update the positions of this class
protected fun visibility=(visibility: MVisibility)

nitc :: MClass :: visibility=

The visibility of the class
fun vtable: nullable VTable

nitc :: MClass :: vtable

A reference to the virtual table of this class
protected fun vtable=(vtable: nullable VTable)

nitc :: MClass :: vtable=

A reference to the virtual table of this class

Redefined properties

redef type SELF: MClass

nitc $ MClass :: SELF

Type of this instance, automatically specialized in every class
redef fun c_name: String

nitc $ MClass :: c_name

A fully-qualified C-like identifier of this model entity.
redef fun collect_ancestors(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: model_collect $ MClass :: collect_ancestors

Collect all ancestors of self
redef fun collect_children(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: model_collect $ MClass :: collect_children

Collect all direct children of self
redef fun collect_descendants(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: model_collect $ MClass :: collect_descendants

Collect all descendants of self
redef fun collect_linearization(mainmodule: MModule): nullable Array[MEntity]

nitc :: model_collect $ MClass :: collect_linearization

Collect self linearization anchored on mainmodule
redef fun collect_modifiers: Array[String]

nitc :: model_collect $ MClass :: collect_modifiers

Collect modifier keywords like redef, private etc
redef fun collect_parents(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: model_collect $ MClass :: collect_parents

Collect all direct parents of self
redef fun core_serialize_to(v: Serializer)

nitc :: json_model $ MClass :: core_serialize_to

Actual serialization of self to serializer
redef fun cs_icon(no_color: nullable Bool): String

nitc :: term_model $ MClass :: cs_icon

Text icon to be displayed in front of the entity
redef fun cs_signature(no_color: nullable Bool): String

nitc :: term_model $ MClass :: cs_signature

Returns self signature formatted for console.
redef fun css_classes: Array[String]

nitc :: html_model $ MClass :: css_classes

CSS classes used to decorate self
redef fun ctype: nullable String

nitc :: extern_classes $ MClass :: ctype

redef fun examples: Array[MExample]

nitc :: model_examples $ MClass :: examples

Examples found for self
redef fun full_name: String

nitc $ MClass :: full_name

The canonical name of the class
redef fun href(v: NitlightVisitor): nullable String

nitc :: nitlight $ MClass :: href

redef fun html_icon: BSIcon

nitc :: html_model $ MClass :: html_icon

An icon representative of the mentity
redef fun html_namespace: Template

nitc :: html_model $ MClass :: html_namespace

Returns full_name decorated with HTML links
redef fun html_signature(short: nullable Bool): Template

nitc :: html_model $ MClass :: html_signature

Returns the MEntity signature decorated with HTML
redef fun html_url: String

nitc :: static_html $ MClass :: html_url

The MEntity URL in the HTML output
redef fun html_url=(html_url: String)

nitc :: static_html $ MClass :: html_url=

The MEntity URL in the HTML output
redef init init

nitc $ MClass :: init

redef fun is_example: Bool

nitc :: model_examples $ MClass :: is_example

Is self existing for an example purpose?
redef fun is_test: Bool

nitc $ MClass :: is_test

Is self created for unit testing purpose?
redef fun is_test=(is_test: Bool)

nitc $ MClass :: is_test=

Is self created for unit testing purpose?
redef fun json_namespace: JsonNamespace

nitc :: json_model $ MClass :: json_namespace

Return self.full_name as an object that can be serialized to json.
redef fun location: Location

nitc $ MClass :: location

The origin of the definition.
redef fun mdoc_or_fallback: nullable MDoc

nitc $ MClass :: mdoc_or_fallback

The documentation associated to the entity or their main nested entity.
redef fun mentity_kind_rank: Int

nitc :: model_index $ MClass :: mentity_kind_rank

Compare MEntity class kind
redef fun model: Model

nitc $ MClass :: model

A Model Entity has a direct link to its model
redef fun name: String

nitc $ MClass :: name

The short name of the class
redef fun nitdoc_breadcrumbs: Array[MEntity]

nitc :: static_base $ MClass :: nitdoc_breadcrumbs

MEntities composing the breadcrumbs of a nitdoc page
redef fun to_dot_node: DotNode

nitc :: commands_graph $ MClass :: to_dot_node

Return self as a DotNode
redef fun to_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode

nitc :: neo $ MClass :: to_node

Build a NeoNode representing self.
redef fun to_s: String

nitc $ MClass :: to_s

Alias for name
redef fun tpl_class(model: UMLModel): Writable

nitc :: uml_class $ MClass :: tpl_class

Generates a dot-compatible Writable UML Class diagram from self
redef fun visibility: MVisibility

nitc $ MClass :: visibility

The visibility of the class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type MENTITY: SELF

nitc :: MEntity :: MENTITY

FIXME used to bypass RTA limitation on type resolution
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _abstract_loaded: Bool

nitc :: MClass :: _abstract_loaded

Indicate this class was partially loaded (it only has its identifier allocated)
private var _actor: nullable MClass

nitc :: MClass :: _actor

Adding the actor class to a class annotated with "is actor"
private var _arity: Int

nitc :: MClass :: _arity

The number of generic formal parameters
private var _c_name: String

nitc :: MClass :: _c_name

private var _color: Int

nitc :: MClass :: _color

Color for Cohen subtyping test : the absolute position of the id
private var _css_classes: Array[String]

nitc :: MEntity :: _css_classes

CSS classes used to decorate self
private var _deprecation: nullable MDeprecationInfo

nitc :: MEntity :: _deprecation

Is the entity deprecated?
private var _examples: Array[MExample]

nitc :: MEntity :: _examples

Examples found for self
private var _ftype_cache: nullable ForeignType

nitc :: MClass :: _ftype_cache

private var _full_name: String

nitc :: MClass :: _full_name

The canonical name of the class
private var _has_new_factory: Bool

nitc :: MClass :: _has_new_factory

Is there a new factory to allow the pseudo instantiation?
private var _html_full_name: String

nitc :: MEntity :: _html_full_name

The MEntity full_name escaped for HTML
private var _html_id: String

nitc :: MEntity :: _html_id

The MEntity unique ID in the HTML output
private var _html_name: String

nitc :: MEntity :: _html_name

The MEntity name escaped for HTML
private var _html_url: String

nitc :: MEntity :: _html_url

The MEntity URL in the HTML output
private var _html_url: String

nitc :: MClass :: _html_url

private var _html_url: String

nitc :: MEntity :: _html_url

private var _intro: MClassDef

nitc :: MClass :: _intro

The definition that introduces the class.
private var _intro_mattributes: Array[MAttribute]

nitc :: MClass :: _intro_mattributes

The MAttribute this class introduced
private var _intro_mmethods: Array[MMethod]

nitc :: MClass :: _intro_mmethods

The MMethod this class introduced
private var _intro_mmodule: MModule

nitc :: MClass :: _intro_mmodule

The module that introduce the class
private var _is_abstract: Bool

nitc :: MClass :: _is_abstract

Is self and abstract class?
private var _is_broken: Bool

nitc :: MEntity :: _is_broken

The indication that the entity did not pass some semantic verifications.
private var _is_class: Bool

nitc :: MClass :: _is_class

Is self a standard or abstract class kind?
private var _is_enum: Bool

nitc :: MClass :: _is_enum

Is self an enum kind?
private var _is_example: Bool

nitc :: MClass :: _is_example

private var _is_fictive: Bool

nitc :: MEntity :: _is_fictive

Is self created for internal purpose?
private var _is_interface: Bool

nitc :: MClass :: _is_interface

Is self an interface kind?
private var _is_test: Bool

nitc :: MClass :: _is_test

private var _is_test: Bool

nitc :: MEntity :: _is_test

Is self created for unit testing purpose?
private var _kind: MClassKind

nitc :: MClass :: _kind

The kind of the class (interface, abstract class, etc.)
private var _loaded: Bool

nitc :: MClass :: _loaded

True when the class is effectively loaded by the vm, false otherwise
private var _location: Location

nitc :: MClass :: _location

private var _mattributes: Array[MAttribute]

nitc :: MClass :: _mattributes

All MAttribute this class contains
private var _mclass_type: MClassType

nitc :: MClass :: _mclass_type

The principal static type of the class.
private var _mclassdefs: Array[MClassDef]

nitc :: MClass :: _mclassdefs

All class definitions (introduction and refinements)
private var _mdoc: nullable MDoc

nitc :: MEntity :: _mdoc

The documentation associated to the entity
private var _mexample: nullable MExample

nitc :: MEntity :: _mexample

Return this entity as a MExample
private var _mmethods: Array[MMethod]

nitc :: MClass :: _mmethods

All MMethod this class contains
private var _mparameters: Array[MParameterType]

nitc :: MClass :: _mparameters

Each generic formal parameters in order.
private var _name: String

nitc :: MClass :: _name

The short name of the class
private var _ordering: Array[MClass]

nitc :: MClass :: _ordering

The linear extension of all superclasses with the prefix rule
private var _position_attributes: Int

nitc :: MClass :: _position_attributes

The position of the class' block in virtual table,
private var _position_methods: Int

nitc :: MClass :: _position_methods

The position of the class' block in attribute table
private var _positions_attributes: HashMap[MClass, Int]

nitc :: MClass :: _positions_attributes

For superclasses which have a non-invariant position, keep their position in attribute table
private var _positions_methods: HashMap[MClass, Int]

nitc :: MClass :: _positions_methods

For superclasses which have a non-invariant position, keep their position in virtual table
private var _prefix: nullable MClass

nitc :: MClass :: _prefix

The chosen prefix for this class.
private var _the_root_init_mmethod: nullable MMethod

nitc :: MClass :: _the_root_init_mmethod

The base init of the class.
private var _visibility: MVisibility

nitc :: MClass :: _visibility

The visibility of the class
private var _vtable: nullable VTable

nitc :: MClass :: _vtable

A reference to the virtual table of this class
fun abstract_loaded: Bool

nitc :: MClass :: abstract_loaded

Indicate this class was partially loaded (it only has its identifier allocated)
protected fun abstract_loaded=(abstract_loaded: Bool)

nitc :: MClass :: abstract_loaded=

Indicate this class was partially loaded (it only has its identifier allocated)
protected fun accept_json_serializer(v: JsonSerializer)

serialization :: Serializable :: accept_json_serializer

Refinable service to customize the serialization of this class to JSON
protected fun accept_msgpack_attribute_counter(v: AttributeCounter)

serialization :: Serializable :: accept_msgpack_attribute_counter

Hook to customize the behavior of the AttributeCounter
protected fun accept_msgpack_serializer(v: MsgPackSerializer)

serialization :: Serializable :: accept_msgpack_serializer

Hook to customize the serialization of this class to MessagePack
fun actor: nullable MClass

nitc :: MClass :: actor

Adding the actor class to a class annotated with "is actor"
protected fun actor=(actor: nullable MClass)

nitc :: MClass :: actor=

Adding the actor class to a class annotated with "is actor"
private fun add_doc_to_infobox(res: HInfoBox)

nitc :: MEntity :: add_doc_to_infobox

Append an entry for the doc in the given infobox
protected fun add_to_bundle(bundle: NativeBundle, key: JavaString)

serialization :: Serializable :: add_to_bundle

Called by []= to dynamically choose the appropriate method according
private fun allocate_vtable(vm: VirtualMachine)

nitc :: MClass :: allocate_vtable

Allocate a single vtable
fun api_url: String

nitc :: MEntity :: api_url

URL to self within the JSON api.
fun arity: Int

nitc :: MClass :: arity

The number of generic formal parameters
protected fun arity=(arity: Int)

nitc :: MClass :: arity=

The number of generic formal parameters
abstract fun c_name: String

nitc :: MEntity :: c_name

A fully-qualified C-like identifier of this model entity.
protected fun c_name=(c_name: String)

nitc :: MClass :: c_name=

private fun calculate_delta(nb_attributes: Array[Int]): Array[Int]

nitc :: MClass :: calculate_delta

Computes delta for each class
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun collect_accessible_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_accessible_inits

Collect all init methods accessible by self
fun collect_accessible_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_accessible_mattributes

Collect all attributes accessible by self
fun collect_accessible_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_accessible_mmethods

Collect all methods accessible by self
fun collect_accessible_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_accessible_mproperties

Collect all properties accessible by self
fun collect_accessible_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_accessible_vts

Collect all virtual types accessible by self
fun collect_ancestors(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_ancestors

Collect self ancestors (direct and indirect)
abstract fun collect_children(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_children

Collect self children (direct descendants)
fun collect_descendants(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_descendants

Collect self descendants (direct and direct)
fun collect_inherited_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_inherited_inits

Collect all init methods inherited by self
fun collect_inherited_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_inherited_mattributes

Collect all attributes inherited by self
fun collect_inherited_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_inherited_mmethods

Collect all methods inherited by self
fun collect_inherited_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_inherited_mproperties

Collect all properties inehrited by self
fun collect_inherited_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_inherited_vts

Collect all virtual types inherited by self
fun collect_intro_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_intro_inits

Collect all init methods introduced in self
fun collect_intro_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_intro_mattributes

Collect all attributes introduced in self
fun collect_intro_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_intro_mmethods

Collect all methods introduced in self
fun collect_intro_mpropdefs(filter: nullable ModelFilter): Set[MPropDef]

nitc :: MClass :: collect_intro_mpropdefs

Collect all property definitions that are introductions in self
fun collect_intro_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_intro_mproperties

Collect all properties introduced in self
fun collect_intro_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_intro_vts

Collect all virtual types introduced in self
fun collect_linearization(mainmodule: MModule): nullable Array[MEntity]

nitc :: MEntity :: collect_linearization

Collect self linearization anchored on mainmodule
fun collect_local_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_local_inits

Collect all init methods introduced and redefined in self
fun collect_local_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_local_mattributes

Collect all attributes introduced and redefined in self
fun collect_local_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_local_mmethods

Collect all methods introduced and redefined in self
fun collect_local_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_local_mproperties

Collect all properties introduced and redefined in self
fun collect_local_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_local_vts

Collect all virtual types introduced or redefined in self
fun collect_mclassdefs(filter: nullable ModelFilter): Set[MClassDef]

nitc :: MClass :: collect_mclassdefs

Collect all class definitions of self
fun collect_modifiers: Array[String]

nitc :: MEntity :: collect_modifiers

Collect modifier keywords like redef, private etc
abstract fun collect_parents(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_parents

Collect self parents (direct ancestors)
fun collect_redef_inits(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_redef_inits

Collect all init methods redefined in self
fun collect_redef_mattributes(filter: nullable ModelFilter): Set[MAttribute]

nitc :: MClass :: collect_redef_mattributes

Collect all attributes redefined in self
fun collect_redef_mmethods(filter: nullable ModelFilter): Set[MMethod]

nitc :: MClass :: collect_redef_mmethods

Collect all methods redefined in self
fun collect_redef_mpropdefs(filter: nullable ModelFilter): Set[MPropDef]

nitc :: MClass :: collect_redef_mpropdefs

Collect all propierty definitions that are redefinition in self
fun collect_redef_mproperties(filter: nullable ModelFilter): Set[MProperty]

nitc :: MClass :: collect_redef_mproperties

Collect all properties redefined in self
fun collect_redef_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp]

nitc :: MClass :: collect_redef_vts

Collect all virtual types redefined in self
fun color: Int

nitc :: MClass :: color

Color for Cohen subtyping test : the absolute position of the id
fun color: String

nitc :: MEntity :: color

protected fun color=(color: Int)

nitc :: MClass :: color=

Color for Cohen subtyping test : the absolute position of the id
fun compile_to_java(v: JavaCompilerVisitor)

nitc :: MClass :: compile_to_java

Generate a Java RTClass for a Nit MClass
fun compile_type_table(v: JavaCompilerVisitor)

nitc :: MClass :: compile_type_table

Compile the type table for the MClass
private fun compile_vft(v: JavaCompilerVisitor)

nitc :: MClass :: compile_vft

Compile the virtual function table for the mclass
private fun complete_mdoc: nullable MDoc

nitc :: MEntity :: complete_mdoc

Doc to use in completion
private fun complete_name: String

nitc :: MEntity :: complete_name

Actual name used in completion
private fun compute_ftype(v: ExternClassesTypingPhaseModel): nullable ForeignType

nitc :: MClass :: compute_ftype

Type in C of the extern class
private fun compute_identifier(vm: VirtualMachine, ids: Array[Int], offset_methods: Int)

nitc :: MClass :: compute_identifier

Allocate a unique identifier to the class with perfect hashing
protected fun const_color=(const_color: String)

nitc :: MEntity :: const_color=

fun core_serialize_to(serializer: Serializer)

serialization :: Serializable :: core_serialize_to

Actual serialization of self to serializer
private fun create_abstract_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef

nitc :: MClass :: create_abstract_method

This method create an abstract method representation with this MMethodDef an this AMethoddef
abstract fun create_ast_representation(astbuilder: nullable ASTBuilder): ANode

nitc :: MEntity :: create_ast_representation

Build a ANode from self
private fun create_empty_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef

nitc :: MClass :: create_empty_method

Create method with an empty block
fun cs_comment(no_color: nullable Bool): nullable String

nitc :: MEntity :: cs_comment

Returns the comment of this MEntity formatted for console.
fun cs_declaration(no_color: nullable Bool): String

nitc :: MEntity :: cs_declaration

Returns the complete MEntity declaration (modifiers + name + signature).
fun cs_full_name(no_color: nullable Bool): String

nitc :: MEntity :: cs_full_name

Returns self.full_name formatted for console
fun cs_icon(no_color: nullable Bool): String

nitc :: MEntity :: cs_icon

Text icon to be displayed in front of the entity
fun cs_list_item(no_color: nullable Bool): String

nitc :: MEntity :: cs_list_item

Returns self as a list element that can be displayed in console.
fun cs_location(no_color: nullable Bool): String

nitc :: MEntity :: cs_location

Source code location of this MEntity formatted for console
fun cs_short_comment(no_color: nullable Bool): nullable String

nitc :: MEntity :: cs_short_comment

Returns the comment of this MEntity formatted for console.
fun cs_signature(no_color: nullable Bool): String

nitc :: MEntity :: cs_signature

Returns self signature formatted for console.
fun cs_source_code: String

nitc :: MEntity :: cs_source_code

Source code associated to this MEntity.
fun css_classes: Array[String]

nitc :: MEntity :: css_classes

CSS classes used to decorate self
protected fun css_classes=(css_classes: Array[String])

nitc :: MEntity :: css_classes=

CSS classes used to decorate self
fun ctype: nullable String

nitc :: MClass :: ctype

init defaultinit(intro_mmodule: MModule, name: String, location: Location, parameter_names: nullable Array[String], kind: MClassKind, visibility: MVisibility)

nitc :: MClass :: defaultinit

fun deprecation: nullable MDeprecationInfo

nitc :: MEntity :: deprecation

Is the entity deprecated?
fun deprecation=(deprecation: nullable MDeprecationInfo)

nitc :: MEntity :: deprecation=

Is the entity deprecated?
private fun dfs(v: VirtualMachine, res: Array[MClass]): Array[MClass]

nitc :: MClass :: dfs

A kind of Depth-First-Search for superclasses ordering
fun ditc(mainmodule: MModule): Int

nitc :: MClass :: ditc

Class Depth in Inheritance Tree
fun diti(mainmodule: MModule): Int

nitc :: MClass :: diti

Interface Depth in Inheritance Tree
fun examples: Array[MExample]

nitc :: MEntity :: examples

Examples found for self
protected fun examples=(examples: Array[MExample])

nitc :: MEntity :: examples=

Examples found for self
fun extended_mproperties(filter: ModelFilter): Set[MProperty]

nitc :: MClass :: extended_mproperties

the set of redefition that call to super
private fun fill_vtable(vm: VirtualMachine, table: VTable, cl: MClass)

nitc :: MClass :: fill_vtable

Fill the vtable with local methods for self class
init from_deserializer(deserializer: Deserializer)

serialization :: Serializable :: from_deserializer

Create an instance of this class from the deserializer
fun ftype: nullable ForeignType

nitc :: MClass :: ftype

Extern type associated to this class according to specialisation
private fun ftype_cache: nullable ForeignType

nitc :: MClass :: ftype_cache

private fun ftype_cache=(ftype_cache: nullable ForeignType)

nitc :: MClass :: ftype_cache=

private fun ftype_computed=(ftype_computed: Bool)

nitc :: MClass :: ftype_computed=

abstract fun full_name: String

nitc :: MEntity :: full_name

A fully-qualified name of this model entity.
protected fun full_name=(full_name: String)

nitc :: MClass :: full_name=

The canonical name of the class
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_mtype(mtype_arguments: Array[MType]): MClassType

nitc :: MClass :: get_mtype

Return a generic type based on the class
private fun get_mtype_cache=(get_mtype_cache: HashMap[Array[MType], MGenericType])

nitc :: MClass :: get_mtype_cache=

fun get_position_attributes(cl: MClass): Int

nitc :: MClass :: get_position_attributes

Return the position of the attribute's block of class cl in self if cl has an invariant position in self,
fun get_position_methods(cl: MClass): Int

nitc :: MClass :: get_position_methods

Return the position of the method's block of class cl in self if cl has an invariant position in self,
fun has_new_factory: Bool

nitc :: MClass :: has_new_factory

Is there a new factory to allow the pseudo instantiation?
fun has_new_factory=(has_new_factory: Bool)

nitc :: MClass :: has_new_factory=

Is there a new factory to allow the pseudo instantiation?
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun hierarchy_poset(mainmodule: MModule, filter: nullable ModelFilter): POSet[MENTITY]

nitc :: MEntity :: hierarchy_poset

Build a poset representing self in it's own hierarchy
private fun href(v: NitlightVisitor): nullable String

nitc :: MEntity :: href

fun html_declaration: Template

nitc :: MEntity :: html_declaration

Returns the complete MEntity declaration decorated with HTML
fun html_full_name: String

nitc :: MEntity :: html_full_name

The MEntity full_name escaped for HTML
protected fun html_full_name=(html_full_name: String)

nitc :: MEntity :: html_full_name=

The MEntity full_name escaped for HTML
fun html_icon: BSIcon

nitc :: MEntity :: html_icon

An icon representative of the mentity
fun html_id: String

nitc :: MEntity :: html_id

The MEntity unique ID in the HTML output
protected fun html_id=(html_id: String)

nitc :: MEntity :: html_id=

The MEntity unique ID in the HTML output
fun html_name: String

nitc :: MEntity :: html_name

The MEntity name escaped for HTML
protected fun html_name=(html_name: String)

nitc :: MEntity :: html_name=

The MEntity name escaped for HTML
abstract fun html_namespace: Template

nitc :: MEntity :: html_namespace

Returns full_name decorated with HTML links
fun html_signature(short: nullable Bool): Template

nitc :: MEntity :: html_signature

Returns the MEntity signature decorated with HTML
fun html_url: String

nitc :: MEntity :: html_url

The MEntity URL in the HTML output
protected fun html_url=(html_url: String)

nitc :: MEntity :: html_url=

The MEntity URL in the HTML output
fun in_hierarchy(mmodule: MModule): POSetElement[MClass]

nitc :: MClass :: in_hierarchy

Return the class self in the class hierarchy of the module mmodule.
abstract fun infobox(v: HtmlightVisitor): HInfoBox

nitc :: HInfoBoxable :: infobox

An new infobox documenting the entity
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun intro: MClassDef

nitc :: MClass :: intro

The definition that introduces the class.
protected fun intro=(intro: MClassDef)

nitc :: MClass :: intro=

The definition that introduces the class.
fun intro_mattributes: Array[MAttribute]

nitc :: MClass :: intro_mattributes

The MAttribute this class introduced
protected fun intro_mattributes=(intro_mattributes: Array[MAttribute])

nitc :: MClass :: intro_mattributes=

The MAttribute this class introduced
fun intro_mmethods: Array[MMethod]

nitc :: MClass :: intro_mmethods

The MMethod this class introduced
protected fun intro_mmethods=(intro_mmethods: Array[MMethod])

nitc :: MClass :: intro_mmethods=

The MMethod this class introduced
fun intro_mmodule: MModule

nitc :: MClass :: intro_mmodule

The module that introduce the class
protected fun intro_mmodule=(intro_mmodule: MModule)

nitc :: MClass :: intro_mmodule=

The module that introduce the class
fun is_abstract: Bool

nitc :: MClass :: is_abstract

Is self and abstract class?
protected fun is_abstract=(is_abstract: Bool)

nitc :: MClass :: is_abstract=

Is self and abstract class?
fun is_broken: Bool

nitc :: MEntity :: is_broken

The indication that the entity did not pass some semantic verifications.
fun is_broken=(is_broken: Bool)

nitc :: MEntity :: is_broken=

The indication that the entity did not pass some semantic verifications.
fun is_class: Bool

nitc :: MClass :: is_class

Is self a standard or abstract class kind?
protected fun is_class=(is_class: Bool)

nitc :: MClass :: is_class=

Is self a standard or abstract class kind?
fun is_enum: Bool

nitc :: MClass :: is_enum

Is self an enum kind?
protected fun is_enum=(is_enum: Bool)

nitc :: MClass :: is_enum=

Is self an enum kind?
private fun is_equal(filter: ModelFilter): Bool

nitc :: MClass :: is_equal

equals contain as redifinition than introduction
fun is_example: Bool

nitc :: MEntity :: is_example

Is self existing for an example purpose?
protected fun is_example=(is_example: Bool)

nitc :: MClass :: is_example=

private fun is_extender(filter: ModelFilter): Bool

nitc :: MClass :: is_extender

extenders contain more introduction than redefinitions
fun is_fictive: Bool

nitc :: MEntity :: is_fictive

Is self created for internal purpose?
fun is_fictive=(is_fictive: Bool)

nitc :: MEntity :: is_fictive=

Is self created for internal purpose?
fun is_interface: Bool

nitc :: MClass :: is_interface

Is self an interface kind?
protected fun is_interface=(is_interface: Bool)

nitc :: MClass :: is_interface=

Is self an interface kind?
private fun is_overrider(filter: ModelFilter): Bool

nitc :: MClass :: is_overrider

overriders contain more definitions than introductions
private fun is_pure_extender(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_extender

pure extenders contain only introductions
private fun is_pure_overrider(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_overrider

pure overriders contain only redefinitions
private fun is_pure_replacer(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_replacer

pure replacers never call to super in its redefinitions
private fun is_pure_specializer(filter: ModelFilter): Bool

nitc :: MClass :: is_pure_specializer

pure specializers always call to super in its redefinitions
private fun is_replacer(filter: ModelFilter): Bool

nitc :: MClass :: is_replacer

replacers have less redefinitions that call super than not calling it
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_specializer(filter: ModelFilter): Bool

nitc :: MClass :: is_specializer

specializers have more redefinitions that call super than not calling it
fun is_test: Bool

nitc :: MEntity :: is_test

Is self created for unit testing purpose?
fun is_test=(is_test: Bool)

nitc :: MEntity :: is_test=

Is self created for unit testing purpose?
private fun jname: String

nitc :: MEntity :: jname

A Java compatible name for self
abstract fun json_namespace: JsonNamespace

nitc :: MEntity :: json_namespace

Return self.full_name as an object that can be serialized to json.
fun kind: MClassKind

nitc :: MClass :: kind

The kind of the class (interface, abstract class, etc.)
protected fun kind=(kind: MClassKind)

nitc :: MClass :: kind=

The kind of the class (interface, abstract class, etc.)
fun linkto(v: HtmlightVisitor): HTMLTag

nitc :: MEntity :: linkto

A HTML version of to_s with hyper-links.
fun linkto_text(v: HtmlightVisitor, text: String): HTMLTag

nitc :: MEntity :: linkto_text

Link to the self with a specific text.
fun loaded: Bool

nitc :: MClass :: loaded

True when the class is effectively loaded by the vm, false otherwise
protected fun loaded=(loaded: Bool)

nitc :: MClass :: loaded=

True when the class is effectively loaded by the vm, false otherwise
fun location: Location

nitc :: MEntity :: location

The origin of the definition.
protected fun location=(location: Location)

nitc :: MClass :: location=

private fun make_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode

nitc :: MEntity :: make_node

Make a new NeoNode based on mentity.
private fun make_vt(vm: VirtualMachine, explicit: Bool)

nitc :: MClass :: make_vt

Allocates a VTable for this class and gives it an id
fun mattributes: Array[MAttribute]

nitc :: MClass :: mattributes

All MAttribute this class contains
protected fun mattributes=(mattributes: Array[MAttribute])

nitc :: MClass :: mattributes=

All MAttribute this class contains
fun mclass_type: MClassType

nitc :: MClass :: mclass_type

The principal static type of the class.
protected fun mclass_type=(mclass_type: MClassType)

nitc :: MClass :: mclass_type=

The principal static type of the class.
fun mclassdefs: Array[MClassDef]

nitc :: MClass :: mclassdefs

All class definitions (introduction and refinements)
protected fun mclassdefs=(mclassdefs: Array[MClassDef])

nitc :: MClass :: mclassdefs=

All class definitions (introduction and refinements)
fun mdoc: nullable MDoc

nitc :: MEntity :: mdoc

The documentation associated to the entity
fun mdoc=(mdoc: nullable MDoc)

nitc :: MEntity :: mdoc=

The documentation associated to the entity
fun mdoc_or_fallback: nullable MDoc

nitc :: MEntity :: mdoc_or_fallback

The documentation associated to the entity or their main nested entity.
private fun mentity_kind_rank: Int

nitc :: MEntity :: mentity_kind_rank

Compare MEntity class kind
fun mexample: nullable MExample

nitc :: MEntity :: mexample

Return this entity as a MExample
protected fun mexample=(mexample: nullable MExample)

nitc :: MEntity :: mexample=

Return this entity as a MExample
fun mmethods: Array[MMethod]

nitc :: MClass :: mmethods

All MMethod this class contains
protected fun mmethods=(mmethods: Array[MMethod])

nitc :: MClass :: mmethods=

All MMethod this class contains
abstract fun model: Model

nitc :: MEntity :: model

A Model Entity has a direct link to its model
fun moved_class_attributes(vm: VirtualMachine, current_class: MClass, offset: Int)

nitc :: MClass :: moved_class_attributes

This method is called when current_class class is moved in attribute table of self
fun moved_class_methods(vm: VirtualMachine, current_class: MClass, offset: Int)

nitc :: MClass :: moved_class_methods

This method is called when current_class class is moved in virtual table of self
fun mparameters: Array[MParameterType]

nitc :: MClass :: mparameters

Each generic formal parameters in order.
protected fun mparameters=(mparameters: Array[MParameterType])

nitc :: MClass :: mparameters=

Each generic formal parameters in order.
protected fun msgpack_extra_array_items: Int

serialization :: Serializable :: msgpack_extra_array_items

Hook to request a larger than usual metadata array
abstract fun name: String

nitc :: MEntity :: name

The short (unqualified) name of this model entity.
protected fun name=(name: String)

nitc :: MClass :: name=

The short name of the class
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
abstract fun nitdoc_breadcrumbs: Array[MEntity]

nitc :: MEntity :: nitdoc_breadcrumbs

MEntities composing the breadcrumbs of a nitdoc page
protected fun nitdoc_breadcrumbs=(nitdoc_breadcrumbs: Array[MEntity])

nitc :: MClass :: nitdoc_breadcrumbs=

intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun ordering: Array[MClass]

nitc :: MClass :: ordering

The linear extension of all superclasses with the prefix rule
protected fun ordering=(ordering: Array[MClass])

nitc :: MClass :: ordering=

The linear extension of all superclasses with the prefix rule
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun overriden_mproperties(filter: ModelFilter): Set[MProperty]

nitc :: MClass :: overriden_mproperties

the set of redefition that do not call to super
fun position_attributes: Int

nitc :: MClass :: position_attributes

The position of the class' block in virtual table,
protected fun position_attributes=(position_attributes: Int)

nitc :: MClass :: position_attributes=

The position of the class' block in virtual table,
fun position_methods: Int

nitc :: MClass :: position_methods

The position of the class' block in attribute table
protected fun position_methods=(position_methods: Int)

nitc :: MClass :: position_methods=

The position of the class' block in attribute table
fun positions_attributes: HashMap[MClass, Int]

nitc :: MClass :: positions_attributes

For superclasses which have a non-invariant position, keep their position in attribute table
protected fun positions_attributes=(positions_attributes: HashMap[MClass, Int])

nitc :: MClass :: positions_attributes=

For superclasses which have a non-invariant position, keep their position in attribute table
fun positions_methods: HashMap[MClass, Int]

nitc :: MClass :: positions_methods

For superclasses which have a non-invariant position, keep their position in virtual table
protected fun positions_methods=(positions_methods: HashMap[MClass, Int])

nitc :: MClass :: positions_methods=

For superclasses which have a non-invariant position, keep their position in virtual table
fun prefix: nullable MClass

nitc :: MClass :: prefix

The chosen prefix for this class.
protected fun prefix=(prefix: nullable MClass)

nitc :: MClass :: prefix=

The chosen prefix for this class.
fun ratings(config: NitwebConfig, user: nullable String): JsonObject

nitc :: MEntity :: ratings

Get the ratings of a mentity
fun ratings_by_dimension(config: NitwebConfig, dimension: String, user: nullable String): JsonObject

nitc :: MEntity :: ratings_by_dimension

Get the ratings of a dimension
private fun rt_name: String

nitc :: MClass :: rt_name

Runtime name
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun serialize_msgpack(plain: nullable Bool): Bytes

serialization :: Serializable :: serialize_msgpack

Serialize self to MessagePack bytes
fun serialize_to(serializer: Serializer)

serialization :: Serializable :: serialize_to

Serialize self to serializer
fun serialize_to_json(plain: nullable Bool, pretty: nullable Bool): String

serialization :: Serializable :: serialize_to_json

Serialize self to JSON
private fun serialize_to_or_delay(v: Serializer)

serialization :: Serializable :: serialize_to_or_delay

Accept references or force direct serialization (using serialize_to)
private fun set_offsets(vm: VirtualMachine, explicit: Bool)

nitc :: MClass :: set_offsets

Set the offsets for the properties introduced by self class
protected fun setup_parameter_names(parameter_names: nullable Array[String])

nitc :: MClass :: setup_parameter_names

Initialize mparameters from their names.
fun signature_to_s: String

nitc :: MClass :: signature_to_s

A string version of the signature a generic class.
private fun source_url(url_pattern: nullable String): String

nitc :: MEntity :: source_url

Render a HTML link for the MEntity location
private fun superclasses_ordering(v: VirtualMachine): Array[MClass]

nitc :: MClass :: superclasses_ordering

Order superclasses of self
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun the_root_init_mmethod: nullable MMethod

nitc :: MClass :: the_root_init_mmethod

The base init of the class.
protected fun the_root_init_mmethod=(the_root_init_mmethod: nullable MMethod)

nitc :: MClass :: the_root_init_mmethod=

The base init of the class.
fun to_dot_node: DotNode

nitc :: MEntity :: to_dot_node

Return self as a DotNode
fun to_json: String

serialization :: Serializable :: to_json

Serialize self to plain JSON
fun to_json_ref: MEntityRef

nitc :: MEntity :: to_json_ref

Return a new MEntityRef to self.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

private fun to_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode

nitc :: MEntity :: to_node

Build a NeoNode representing self.
fun to_pretty_json: String

serialization :: Serializable :: to_pretty_json

Serialize self to plain pretty JSON
fun to_s: String

core :: Object :: to_s

User readable representation of self.
abstract fun tpl_class(model: UMLModel): Writable

nitc :: MEntity :: tpl_class

Generates a dot-compatible Writable UML Class diagram from self
abstract fun tpl_module(model: UMLModel): Writable

nitc :: MEntity :: tpl_module

Builds a dot UML package diagram entity from self
fun try_intro: nullable MClassDef

nitc :: MClass :: try_intro

The definition that introduces the class or null if not yet known.
private fun update_positions(offset_attributes: Int, offset_methods: Int)

nitc :: MClass :: update_positions

Update the positions of this class
fun visibility: MVisibility

nitc :: MEntity :: visibility

The visibility of the MEntity.
protected fun visibility=(visibility: MVisibility)

nitc :: MClass :: visibility=

The visibility of the class
fun visit_all(v: ModelVisitor)

nitc :: MEntity :: visit_all

Call v.enter_visit on all nested entities.
fun vtable: nullable VTable

nitc :: MClass :: vtable

A reference to the virtual table of this class
protected fun vtable=(vtable: nullable VTable)

nitc :: MClass :: vtable=

A reference to the virtual table of this class
fun web_url: String

nitc :: MEntity :: web_url

URL to self within the web interface.
private fun write_doc(model: Model, mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_doc

private fun write_extra_doc(model: Model, mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_extra_doc

Extra auto documentation to append to the stream
private fun write_location(mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_location

Location (file and line when available) of related declarations
package_diagram nitc::MClass MClass nitc::MEntity MEntity nitc::MClass->nitc::MEntity nitc::HInfoBoxable HInfoBoxable nitc::MEntity->nitc::HInfoBoxable serialization::Serializable Serializable nitc::MEntity->serialization::Serializable ...nitc::HInfoBoxable ... ...nitc::HInfoBoxable->nitc::HInfoBoxable ...serialization::Serializable ... ...serialization::Serializable->serialization::Serializable

Ancestors

interface HInfoBoxable

nitc :: HInfoBoxable

Model entity or whatever that can produce an infobox
interface Object

core :: Object

The root of the class hierarchy.
interface Serializable

serialization :: Serializable

Instances of this class can be passed to Serializer::serialize

Parents

abstract class MEntity

nitc :: MEntity

A named and possibly documented entity in the model.

Class definitions

nitc $ MClass
# A named class
#
# `MClass`es are global to the model; it means that a `MClass` is not bound
# to a specific `MModule`.
#
# This characteristic helps the reasoning about classes in a program since a
# single `MClass` object always denote the same class.
#
# The drawback is that classes (`MClass`) contain almost nothing by themselves.
# These do not really have properties nor belong to a hierarchy since the property and the
# hierarchy of a class depends of the refinement in the modules.
#
# Most services on classes require the precision of a module, and no one can asks what are
# the super-classes of a class nor what are properties of a class without precising what is
# the module considered.
#
# For instance, during the typing of a source-file, the module considered is the module of the file.
# eg. the question *is the method `foo` exists in the class `Bar`?* must be reformulated into
# *is the method `foo` exists in the class `Bar` in the current module?*
#
# During some global analysis, the module considered may be the main module of the program.
class MClass
	super MEntity

	# The module that introduce the class
	#
	# While classes are not bound to a specific module,
	# the introducing module is used for naming and visibility.
	var intro_mmodule: MModule

	# The short name of the class
	# In Nit, the name of a class cannot evolve in refinements
	redef var name

	redef var location

	# The canonical name of the class
	#
	# It is the name of the class prefixed by the full_name of the `intro_mmodule`
	# Example: `"owner::module::MyClass"`
	redef var full_name is lazy do
		return "{self.intro_mmodule.namespace_for(visibility)}::{name}"
	end

	redef var c_name is lazy do
		return "{intro_mmodule.c_namespace_for(visibility)}__{name.to_cmangle}"
	end

	# The number of generic formal parameters
	# 0 if the class is not generic
	var arity: Int is noinit

	# Each generic formal parameters in order.
	# is empty if the class is not generic
	var mparameters = new Array[MParameterType]

	# A string version of the signature a generic class.
	#
	# eg. `Map[K: nullable Object, V: nullable Object]`
	#
	# If the class in non generic the name is just given.
	#
	# eg. `Object`
	fun signature_to_s: String
	do
		if arity == 0 then return name
		var res = new FlatBuffer
		res.append name
		res.append "["
		for i in [0..arity[ do
			if i > 0 then res.append ", "
			res.append mparameters[i].name
			res.append ": "
			res.append intro.bound_mtype.arguments[i].to_s
		end
		res.append "]"
		return res.to_s
	end

	# Initialize `mparameters` from their names.
	protected fun setup_parameter_names(parameter_names: nullable Array[String]) is
		autoinit
	do
		if parameter_names == null then
			self.arity = 0
		else
			self.arity = parameter_names.length
		end

		# Create the formal parameter types
		if arity > 0 then
			assert parameter_names != null
			var mparametertypes = new Array[MParameterType]
			for i in [0..arity[ do
				var mparametertype = new MParameterType(self, i, parameter_names[i])
				mparametertypes.add(mparametertype)
			end
			self.mparameters = mparametertypes
			var mclass_type = new MGenericType(self, mparametertypes)
			self.mclass_type = mclass_type
			self.get_mtype_cache[mparametertypes] = mclass_type
		else
			self.mclass_type = new MClassType(self)
		end
	end

	# The kind of the class (interface, abstract class, etc.)
	#
	# In Nit, the kind of a class cannot evolve in refinements.
	var kind: MClassKind

	# The visibility of the class
	#
	# In Nit, the visibility of a class cannot evolve in refinements.
	redef var visibility

	init
	do
		intro_mmodule.intro_mclasses.add(self)
		var model = intro_mmodule.model
		model.mclasses_by_name.add_one(name, self)
		model.mclasses.add(self)
	end

	redef fun model do return intro_mmodule.model

	# All class definitions (introduction and refinements)
	var mclassdefs = new Array[MClassDef]

	# Alias for `name`
	redef fun to_s do return self.name

	# The definition that introduces the class.
	#
	# Warning: such a definition may not exist in the early life of the object.
	# In this case, the method will abort.
	#
	# Use `try_intro` instead.
	var intro: MClassDef is noinit

	# The definition that introduces the class or `null` if not yet known.
	#
	# SEE: `intro`
	fun try_intro: nullable MClassDef do
		if isset _intro then return _intro else return null
	end

	# Return the class `self` in the class hierarchy of the module `mmodule`.
	#
	# SEE: `MModule::flatten_mclass_hierarchy`
	# REQUIRE: `mmodule.has_mclass(self)`
	fun in_hierarchy(mmodule: MModule): POSetElement[MClass]
	do
		return mmodule.flatten_mclass_hierarchy[self]
	end

	# The principal static type of the class.
	#
	# For non-generic class, `mclass_type` is the only `MClassType` based
	# on self.
	#
	# For a generic class, the arguments are the formal parameters.
	# i.e.: for the class `Array[E:Object]`, the `mclass_type` is `Array[E]`.
	# If you want `Array[Object]`, see `MClassDef::bound_mtype`.
	#
	# For generic classes, the mclass_type is also the way to get a formal
	# generic parameter type.
	#
	# To get other types based on a generic class, see `get_mtype`.
	#
	# ENSURE: `mclass_type.mclass == self`
	var mclass_type: MClassType is noinit

	# Return a generic type based on the class
	# Is the class is not generic, then the result is `mclass_type`
	#
	# REQUIRE: `mtype_arguments.length == self.arity`
	fun get_mtype(mtype_arguments: Array[MType]): MClassType
	do
		assert mtype_arguments.length == self.arity
		if self.arity == 0 then return self.mclass_type
		var res = get_mtype_cache.get_or_null(mtype_arguments)
		if res != null then return res
		res = new MGenericType(self, mtype_arguments)
		self.get_mtype_cache[mtype_arguments.to_a] = res
		return res
	end

	private var get_mtype_cache = new HashMap[Array[MType], MGenericType]

	# Is there a `new` factory to allow the pseudo instantiation?
	var has_new_factory = false is writable

	# Is `self` a standard or abstract class kind?
	var is_class: Bool is lazy do return kind == concrete_kind or kind == abstract_kind

	# Is `self` an interface kind?
	var is_interface: Bool is lazy do return kind == interface_kind

	# Is `self` an enum kind?
	var is_enum: Bool is lazy do return kind == enum_kind

	# Is `self` and abstract class?
	var is_abstract: Bool is lazy do return kind == abstract_kind

	redef var is_test is lazy do return intro.is_test

	redef fun mdoc_or_fallback
	do
		# Don’t use `intro.mdoc_or_fallback` because it would create an infinite
		# recursion.
		return intro.mdoc
	end
end
src/model/model.nit:412,1--625,3

nitc :: nitni_base $ MClass
redef class MClass
	fun ctype: nullable String
	do
		assert kind == extern_kind
		return "void*"
	end
end
src/nitni/nitni_base.nit:158,1--164,3

nitc :: modelize_property $ MClass
redef class MClass
	# The base init of the class.
	#
	# TODO: merge with `root_init` and `ModelBuilder::the_root_init_mmethod` if possible
	var the_root_init_mmethod: nullable MMethod = null
end
src/modelize/modelize_property.nit:522,1--527,3

nitc :: model_examples $ MClass
redef class MClass
	redef var is_example is lazy do return intro.is_example

	redef fun examples do
		var res = super
		for mclassdef in mclassdefs do
			for example in mclassdef.examples do
				if not res.has(example) then res.add example
			end
		end
		return res
	end
end
src/model/model_examples.nit:91,1--103,3

nitc :: neo $ MClass
redef class MClass
	redef fun to_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode do
		if nodes.has_key(self) then return nodes[self]
		var node = super
		node["kind"] = kind.to_s
		node["visibility"] = visibility.to_s
		if not mparameters.is_empty then
			var parameter_names = new Array[String]
			for p in mparameters do parameter_names.add(p.name)
			node["parameter_names"] = new JsonArray.from(parameter_names)
		end
		node.out_edges.add(new NeoEdge(node, "CLASSTYPE", mclass_type.to_node(nodes, model_name)))
		return node
	end
end
src/neo.nit:733,1--747,3

nitc :: actors_injection_phase $ MClass
redef class MClass
	# Adding the actor class to a class annotated with "is actor"
	var actor: nullable MClass = null
end
src/frontend/actors_injection_phase.nit:111,1--114,3

nitc :: virtual_machine $ MClass
redef class MClass
	# A reference to the virtual table of this class
	var vtable: nullable VTable

	# True when the class is effectively loaded by the vm, false otherwise
	var loaded: Bool = false

	# Indicate this class was partially loaded (it only has its identifier allocated)
	var abstract_loaded: Bool = false

	# Color for Cohen subtyping test : the absolute position of the id
	# of this class in virtual tables
	var color: Int

	# For superclasses which have a non-invariant position, keep their position in attribute table
	var positions_attributes: HashMap[MClass, Int] = new HashMap[MClass, Int]

	# For superclasses which have a non-invariant position, keep their position in virtual table
	var positions_methods: HashMap[MClass, Int] = new HashMap[MClass, Int]

	# The position of the class' block in virtual table,
	# the position is set to -1 when the invariant position is no longer satisfied
	var position_attributes: Int

	# The position of the class' block in attribute table
	# the position is set to -1 when the invariant position is no longer satisfied
	var position_methods: Int

	# The chosen prefix for this class.
	# The prefix is the direct superclass which has the most properties,
	# this class will stay at its usual position in virtual table and attribute table
	var prefix: nullable MClass

	# The linear extension of all superclasses with the prefix rule
	var ordering: Array[MClass]

	# The `MAttribute` this class introduced
	var intro_mattributes = new Array[MAttribute]

	# The `MMethod` this class introduced
	var intro_mmethods = new Array[MMethod]

	# All `MAttribute` this class contains
	var mattributes = new Array[MAttribute]

	# All `MMethod` this class contains
	var mmethods = new Array[MMethod]

	# Allocates a VTable for this class and gives it an id
	# * `vm` The currently executed VirtualMachine
	# * `explicit` Indicate if this class was directly instantiated (i.e. not indirectly loaded)
	private fun make_vt(vm: VirtualMachine, explicit: Bool)
	do
		# `ordering` contains the order of superclasses for virtual tables
		ordering = superclasses_ordering(vm)
		ordering.remove(self)

		var ids = new Array[Int]
		var nb_methods = new Array[Int]
		var nb_attributes = new Array[Int]

		# Absolute offset of attribute from the beginning of the attributes table
		var offset_attributes = 0

		# Absolute offset of method from the beginning of the methods table,
		# is initialize to 3 because the first position is empty in the virtual table
		# and the second and third are respectively class id and delta
		var offset_methods = 3

		var parent
		var prefix_index = ordering.index_of(prefix.as(not null))
		for i in [0..ordering.length[ do
			parent = ordering[i]

			# Get the number of introduced methods and attributes for this class
			var methods = parent.intro_mmethods.length
			var attributes = parent.intro_mattributes.length

			# Updates `mmethods` and `mattributes`
			mmethods.add_all(parent.intro_mmethods)
			mattributes.add_all(parent.intro_mattributes)

			ids.push(parent.vtable.id)
			nb_methods.push(methods)
			nb_attributes.push(attributes)

			# If the class is in the suffix part of the order
			if i > prefix_index then
				moved_class_attributes(vm, ordering[i], offset_attributes)
				moved_class_methods(vm, ordering[i], offset_methods)
			end

			offset_attributes += attributes
			offset_methods += methods
			offset_methods += 2 # Because each block starts with an id and the delta
		end

		# Update the positions of the class
		update_positions(offset_attributes, offset_methods)

		ordering.add(self)

		# Compute the identifier with Perfect Hashing
		compute_identifier(vm, ids, offset_methods)

		# Update caches and offsets of methods and attributes for this class
		# If the loading was explicit, the virtual table will be allocated and filled
		set_offsets(vm, explicit)

		if not explicit then
			# Just init the C-pointer to NULL to avoid errors
			vtable.internal_vtable = vm.memory_manager.null_ptr
		end
	end

	# Allocate a unique identifier to the class with perfect hashing
	# * `vm` The currently executed VirtualMachine
	# * `ids` Array of superclasses identifiers
	# * `offset_methods : Offset from the beginning of the table of the group of methods
	private fun compute_identifier(vm: VirtualMachine, ids: Array[Int], offset_methods: Int)
	do
		vtable = new VTable
		var idc = new Array[Int]

		# Give an identifier to the class and put it inside the virtual table
		vtable.mask = vm.ph.pnand(ids, 1, idc) - 1
		vtable.id = idc[0]
		vtable.classname = name

		# Set the color for subtyping tests in SST of this class
		color = offset_methods - 2

		# Indicate the class has its identifier computed
		abstract_loaded = true
	end

	# Update the positions of this class
	# * `offset_attributes` The offset of the block of attributes of this class
	# * `offset_methods` The offset of the block of methods of this class
	private fun update_positions(offset_attributes: Int, offset_methods: Int)
	do
		# Recopy the position tables of the prefix in `self`
		for key, value in prefix.positions_methods do
			positions_methods[key] = value
		end

		for key, value in prefix.positions_attributes do
			positions_attributes[key] = value
		end

		# Save the offsets of self class
		position_attributes = offset_attributes
		position_methods = offset_methods
	end

	# Set the offsets for the properties introduced by `self` class
	# * `vm` The currently executed VirtualMachine
	# * `explicit` Indicate if this class was explicitly loaded
	private fun set_offsets(vm: VirtualMachine, explicit: Bool)
	do
		# Fixing offsets for self attributes and methods
		var relative_offset_attr = 0
		var relative_offset_meth = 0

		# Update `intro_mmethods` and `intro_mattributes`
		# For each MClassdef this MClass has
		for classdef in mclassdefs do
			# For each property this MClassdef introduce
			for p in classdef.intro_mproperties do
				# Collect properties and fixing offsets
				if p isa MMethod then
					p.offset = relative_offset_meth
					relative_offset_meth += 1

					intro_mmethods.add(p)
				end
				if p isa MAttribute then
					p.offset = relative_offset_attr
					relative_offset_attr += 1

					intro_mattributes.add(p)
				end
			end
		end

		# Updates caches with introduced attributes of `self` class
		mattributes.add_all(intro_mattributes)
		mmethods.add_all(intro_mmethods)

		if explicit then allocate_vtable(vm)
	end

	# Allocate a single vtable
	# * `vm` The currently executed VirtualMachine
	private fun allocate_vtable(vm: VirtualMachine)
	do
		var ids = new Array[Int]
		var nb_methods_total = new Array[Int]
		var nb_attributes_total = new Array[Int]

		for cl in ordering do
			ids.add(cl.vtable.id)
			nb_methods_total.add(cl.intro_mmethods.length)
			nb_attributes_total.add(cl.intro_mattributes.length)
		end

		# Calculate the delta to prepare object structure
		var deltas = calculate_delta(nb_attributes_total)
		vtable.internal_vtable = vm.memory_manager.init_vtable(ids, nb_methods_total, deltas, vtable.mask)

		# The virtual table now needs to be filled with pointer to methods
		for cl in ordering do
			fill_vtable(vm, vtable.as(not null), cl)
		end

		loaded = true
	end

	# Fill the vtable with local methods for `self` class
	# * `vm` Current instance of the VirtualMachine
	# * `table` the table of self class, will be filled with its methods
	# * `cl` The class which introduced the methods
	private fun fill_vtable(vm: VirtualMachine, table: VTable, cl: MClass)
	do
		var methods = new Array[MMethodDef]
		for m in cl.intro_mmethods do
			# `propdef` is the most specific implementation for this MMethod
			var propdef = m.lookup_first_definition(vm.mainmodule, self.intro.bound_mtype)
			methods.push(propdef)
		end

		# Call a method in C to put propdefs of self methods in the vtables
		vm.memory_manager.put_methods(vtable.internal_vtable, vtable.mask, cl.vtable.id, methods)
	end

	# Computes delta for each class
	# A delta represents the offset for this group of attributes in the object
	# *`nb_attributes` : number of attributes for each class (classes are linearized from Object to current)
	# * return deltas for each class
	private fun calculate_delta(nb_attributes: Array[Int]): Array[Int]
	do
		var deltas = new Array[Int]

		var total = 0
		for nb in nb_attributes do
			deltas.push(total)
			total += nb
		end

		return deltas
	end

	# Order superclasses of self
	# Return the order of superclasses in runtime structures of this class
	private fun superclasses_ordering(v: VirtualMachine): Array[MClass]
	do
		var superclasses = new Array[MClass]

		# Add all superclasses of `self`
		superclasses.add_all(self.in_hierarchy(v.mainmodule).greaters)

		var res = new Array[MClass]
		if superclasses.length > 1 then
			# Starting at self
			var ordering = self.dfs(v, res)

			return ordering
		else
			# There is no super-class, self is Object
			prefix = self
			return superclasses
		end
	end

	# A kind of Depth-First-Search for superclasses ordering
	# *`v` : the current executed instance of VirtualMachine
	# * `res` : Result Array, ie current superclasses ordering
	private fun dfs(v: VirtualMachine, res: Array[MClass]): Array[MClass]
	do
		# Add this class at the beginning
		res.insert(self, 0)

		var direct_parents = self.in_hierarchy(v.mainmodule).direct_greaters.to_a

		if direct_parents.length > 1 then
			# Prefix represents the class which has the most properties
			# we try to choose it in first to reduce the number of potential recompilations
			var prefix = null
			var max = -1
			for cl in direct_parents do
				# If we never have visited this class
				if not res.has(cl) then
					var properties_length = cl.mmethods.length + cl.mattributes.length
					if properties_length > max then
						max = properties_length
						prefix = cl
					end
				end
			end

			if prefix != null then
				if self.prefix == null then self.prefix = prefix

				# Add the prefix class ordering at the beginning of our sequence
				var prefix_res = new Array[MClass]
				prefix_res = prefix.dfs(v, prefix_res)

				# Then we recurse on other classes
				for cl in direct_parents do
					if cl != prefix then
						res = new Array[MClass]
						res = cl.dfs(v, res)

						for cl_res in res do
							if not prefix_res.has(cl_res) then prefix_res.push(cl_res)
						end
					end
				end
				res = prefix_res
			end

			res.push(self)
		else
			if direct_parents.length > 0 then
				if prefix == null then prefix = direct_parents.first

				res = direct_parents.first.dfs(v, res)
			end
		end

		if not res.has(self) then res.push(self)

		return res
	end

	# This method is called when `current_class` class is moved in virtual table of `self`
	# *`vm` Running instance of the virtual machine
	# *`current_class` The class which was moved in `self` structures
	# *`offset` The offset of block of methods of `current_class` in `self`
	fun moved_class_methods(vm: VirtualMachine, current_class: MClass, offset: Int)
	do
		# `current_class` was moved in `self` method table
		if current_class.position_methods > 0 then
			# The invariant position is no longer satisfied
			current_class.positions_methods[current_class] = current_class.position_methods
			current_class.position_methods = - current_class.position_methods
		else
			# The class has already several positions and an update is needed
			current_class.positions_methods[current_class] = -current_class.positions_methods[current_class]

			for sub in ordering do
				if sub == current_class then continue

				var super_id = current_class.vtable.id
				var mask = sub.vtable.mask
				vm.load_class(sub)

				if vm.inter_is_subtype_ph(super_id, mask, sub.vtable.internal_vtable) then
					if not sub.positions_methods.has_key(current_class) then
						sub.positions_methods[current_class] = current_class.position_methods
					else
						var old_position = sub.positions_methods[current_class]
						if old_position > 0 then
							# Indicate this class can not used anymore single inheritance implementation
							sub.positions_methods[current_class] = - old_position
						end
					end
				end
			end
		end

		# Save the position of `current_class` in `self`
		positions_methods[current_class] = offset
	end

	# This method is called when `current_class` class is moved in attribute table of `self`
	# *`vm` Running instance of the virtual machine
	# *`current_class` The class which was moved in `self` structures
	# *`offset` The offset of block of attributes of `current_class` in `self`
	fun moved_class_attributes(vm: VirtualMachine, current_class: MClass, offset: Int)
	do
		# `current_class` was moved in `self` attribute table
		if not current_class.positions_attributes.has_key(current_class) then
			# The invariant position is no longer satisfied
			current_class.positions_attributes[current_class] = current_class.position_attributes
			current_class.position_attributes = - current_class.position_attributes
		else
			# The class has already several positions and an update is needed
			current_class.positions_attributes[current_class] = - current_class.positions_attributes[current_class]

			for sub in ordering do
				if sub == current_class then continue

				var super_id = current_class.vtable.id
				var mask = sub.vtable.mask
				vm.load_class(sub)

				if vm.inter_is_subtype_ph(super_id, mask, sub.vtable.internal_vtable) then
					if not sub.positions_methods.has_key(current_class) then
						sub.positions_attributes[current_class] = current_class.position_attributes
					else
						var old_position = sub.positions_attributes[current_class]
						if old_position > 0 then
							# Indicate this class can not used anymore single inheritance implementation
							sub.positions_attributes[current_class] = - old_position
						end
					end
				end
			end
		end

		# Save the position of `current_class` in `self`
		positions_attributes[current_class] = offset
	end

	# Return the position of the method's block of class `cl` in `self` if `cl` has an invariant position in self,
	# Otherwise return a negative position
	fun get_position_methods(cl: MClass): Int
	do
		# The class has an invariant position in all subclasses
		if cl.position_methods > 0 then return cl.position_methods

		# The position has an invariant position for this class and its subclasses only
		if positions_methods.has_key(cl) then
			var pos = positions_methods[cl]
			if pos > 0 then return pos
			return -1
		end

		# No invariant position at all, the caller must use a multiple inheritance implementation
		return -1
	end

	# Return the position of the attribute's block of class `cl` in `self` if `cl` has an invariant position in self,
	# Otherwise return a negative position
	fun get_position_attributes(cl: MClass): Int
	do
		# The class has an invariant position in all subclasses
		if cl.position_attributes > 0 then return cl.position_attributes

		# The position has an invariant position for this class and its subclasses only
		if positions_attributes.has_key(cl) then
			var pos = positions_attributes[cl]
			if pos > 0 then return pos
			return -1
		end

		# No invariant position at all, the caller must use a multiple inheritance implementation
		return -1
	end
end
src/vm/virtual_machine.nit:408,1--858,3

nitc :: extern_classes $ MClass
redef class MClass
	private var ftype_cache: nullable ForeignType = null
	private var ftype_computed = false

	# Extern type associated to this class according to specialisation
	fun ftype: nullable ForeignType do return ftype_cache

	redef fun ctype do return ftype_cache.ctype

	# Type in C of the extern class
	# If not defined in the intro of this class will look in super-classes
	# FIXME this only supports type definition at intro, extend to superclasses by redef
	private fun compute_ftype(v: ExternClassesTypingPhaseModel): nullable ForeignType
	do
		if ftype_computed then return ftype_cache
		if kind != extern_kind then return null

		# base case
		if name == "Pointer" then
			ftype_cache = new ForeignType
			ftype_computed = true
			return ftype_cache
		end

		var ftype = intro.ftype
		if ftype == null then
			var ftype_b: nullable ForeignType = null # FIXME hack to circumvent bug where ftype is typed null

			# look in super classes
			for s in in_hierarchy(intro_mmodule).direct_greaters do
				var super_ftype = s.compute_ftype(v)
				if super_ftype != null then
					if ftype_b == null then
						ftype_b = super_ftype
						continue
					else
						# detect conflict
						if super_ftype != ftype_b then
							v.toolcontext.error(null, "FFI Error: extern type conflict in `{self}`.")
							return null
						end
					end
				end
			end

			ftype = ftype_b
		end

		ftype_cache = ftype
		ftype_computed = true
		return ftype
	end
end
src/ffi/extern_classes.nit:84,1--136,3

nitc :: contracts $ MClass
redef class MClass

	# This method create an abstract method representation with this MMethodDef an this AMethoddef
	private fun create_abstract_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef
	do
		# new methoddef definition
		var m_def = new MMethodDef(mclassdef, mproperty, v.current_location)
		# set the signature
		if msignature != null then m_def.msignature = msignature.clone
		# set the abstract flag
		m_def.is_abstract = true
		# Build the new node method
		var n_def = v.ast_builder.make_method(null,null,m_def,n_signature,null,null,null,null)
		# Define the location of the new method for corresponding of the actual method
		n_def.location = v.current_location
		# Association new npropdef to mpropdef
		v.toolcontext.modelbuilder.unsafe_add_mpropdef2npropdef(m_def,n_def)
		return n_def
	end

	# Create method with an empty block
	# the `mproperty` i.e the global property definition. The mclassdef to set where the method is declared and it's model `msignature` and ast `n_signature` signature
	private fun create_empty_method(v: ContractsVisitor, mproperty: MMethod, mclassdef: MClassDef, msignature: nullable MSignature, n_signature: ASignature): AMethPropdef
	do
		var n_def = create_abstract_method(v, mproperty, mclassdef, msignature, n_signature)
		n_def.mpropdef.is_abstract = false
		n_def.n_block = v.ast_builder.make_block
		return n_def
	end
end
src/contracts.nit:576,1--605,3

nitc :: model_collect $ MClass
redef class MClass

	redef fun collect_modifiers do return intro.collect_modifiers

	redef fun collect_linearization(mainmodule) do
		var mclassdefs = self.mclassdefs.to_a
		mainmodule.linearize_mclassdefs(mclassdefs)
		return mclassdefs
	end

	# 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

	# Collect all direct parents of `self`
	redef fun collect_parents(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).direct_greaters do
			if mclass == self then continue
			if filter == null or filter.accept_mentity(mclass) then res.add mclass
		end
		return res
	end

	# Collect all direct children of `self`
	redef fun collect_children(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).direct_smallers do
			if mclass == self then continue
			if filter == null or filter.accept_mentity(mclass) then res.add mclass
		end
		return res
	end

	# 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

	# Collect all class definitions of `self`
	fun collect_mclassdefs(filter: nullable ModelFilter): Set[MClassDef] do
		var res = new HashSet[MClassDef]
		for mclassdef in mclassdefs do
			if filter == null or filter.accept_mentity(mclassdef) then res.add mclassdef
		end
		return res
	end

	# Collect all property definitions that are introductions in `self`
	fun collect_intro_mpropdefs(filter: nullable ModelFilter): Set[MPropDef] do
		var set = new HashSet[MPropDef]
		for mclassdef in mclassdefs do
			for mpropdef in mclassdef.mpropdefs do
				if not mpropdef.is_intro then continue
				if filter == null or filter.accept_mentity(mpropdef) then set.add(mpropdef)
			end
		end
		return set
	end

	# Collect all properties introduced in `self`
	fun collect_intro_mproperties(filter: nullable ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		for mclassdef in mclassdefs do
			for mprop in mclassdef.intro_mproperties do
				if filter == null or filter.accept_mentity(mprop) then set.add(mprop)
			end
		end
		return set
	end

	# Collect all propierty definitions that are redefinition in `self`
	fun collect_redef_mpropdefs(filter: nullable ModelFilter): Set[MPropDef] do
		var set = new HashSet[MPropDef]
		for mclassdef in mclassdefs do
			for mpropdef in mclassdef.mpropdefs do
				if mpropdef.is_intro then continue
				if filter == null or filter.accept_mentity(mpropdef) then set.add(mpropdef)
			end
		end
		return set
	end

	# Collect all properties redefined in `self`
	fun collect_redef_mproperties(filter: nullable ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		for mclassdef in mclassdefs do
			for mpropdef in mclassdef.mpropdefs do
				if mpropdef.mproperty.intro_mclassdef.mclass == self then continue
				if filter == null or filter.accept_mentity(mpropdef) then
					set.add(mpropdef.mproperty)
				end
			end
		end
		return set
	end

	# Collect all properties introduced and redefined in `self`
	fun collect_local_mproperties(filter: nullable ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		set.add_all collect_intro_mproperties(filter)
		set.add_all collect_redef_mproperties(filter)
		return set
	end

	# Collect all properties inehrited by `self`
	fun collect_inherited_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		for parent in collect_parents(mainmodule, filter) do
			set.add_all(parent.collect_intro_mproperties(filter))
			set.add_all(parent.collect_inherited_mproperties(mainmodule, filter))
		end
		return set
	end

	# Collect all properties accessible by `self`
	#
	# This include introduced, redefined, inherited properties.
	fun collect_accessible_mproperties(mainmodule: MModule, filter: nullable ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		set.add_all(collect_intro_mproperties(filter))
		set.add_all(collect_redef_mproperties(filter))
		set.add_all(collect_inherited_mproperties(mainmodule, filter))
		return set
	end

	# Collect all methods introduced in `self`
	fun collect_intro_mmethods(filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_intro_mproperties(filter) do
			if mproperty isa MMethod then res.add(mproperty)
		end
		return res
	end

	# Collect all methods redefined in `self`
	fun collect_redef_mmethods(filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_redef_mproperties(filter) do
			if mproperty isa MMethod then res.add(mproperty)
		end
		return res
	end

	# Collect all methods introduced and redefined in `self`
	fun collect_local_mmethods(filter: nullable ModelFilter): Set[MMethod] do
		var set = new HashSet[MMethod]
		set.add_all collect_intro_mmethods(filter)
		set.add_all collect_redef_mmethods(filter)
		return set
	end

	# Collect all methods inherited by `self`
	fun collect_inherited_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_inherited_mproperties(mainmodule, filter) do
			if mproperty isa MMethod then res.add(mproperty)
		end
		return res
	end

	# Collect all methods accessible by `self`
	#
	# This include introduced, redefined, inherited methods.
	fun collect_accessible_mmethods(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod] do
		var set = new HashSet[MMethod]
		set.add_all(collect_intro_mmethods(filter))
		set.add_all(collect_redef_mmethods(filter))
		set.add_all(collect_inherited_mmethods(mainmodule, filter))
		return set
	end

	# Collect all attributes introduced in `self`
	fun collect_intro_mattributes(filter: nullable ModelFilter): Set[MAttribute] do
		var res = new HashSet[MAttribute]
		for mproperty in collect_intro_mproperties(filter) do
			if mproperty isa MAttribute then res.add(mproperty)
		end
		return res
	end

	# Collect all attributes redefined in `self`
	fun collect_redef_mattributes(filter: nullable ModelFilter): Set[MAttribute] do
		var res = new HashSet[MAttribute]
		for mproperty in collect_redef_mproperties(filter) do
			if mproperty isa MAttribute then res.add(mproperty)
		end
		return res
	end

	# Collect all attributes introduced and redefined in `self`
	fun collect_local_mattributes(filter: nullable ModelFilter): Set[MAttribute] do
		var set = new HashSet[MAttribute]
		set.add_all collect_intro_mattributes(filter)
		set.add_all collect_redef_mattributes(filter)
		return set
	end

	# Collect all attributes inherited by `self`
	fun collect_inherited_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute] do
		var res = new HashSet[MAttribute]
		for mproperty in collect_inherited_mproperties(mainmodule, filter) do
			if mproperty isa MAttribute then res.add(mproperty)
		end
		return res
	end

	# Collect all attributes accessible by `self`
	#
	# This include introduced, redefined, inherited mattributes.
	fun collect_accessible_mattributes(mainmodule: MModule, filter: nullable ModelFilter): Set[MAttribute] do
		var set = new HashSet[MAttribute]
		set.add_all(collect_intro_mattributes(filter))
		set.add_all(collect_redef_mattributes(filter))
		set.add_all(collect_inherited_mattributes(mainmodule, filter))
		return set
	end

	# Collect all init methods introduced in `self`
	fun collect_intro_inits(filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_intro_mmethods(filter) do
			if mproperty.is_init then res.add(mproperty)
		end
		return res
	end

	# Collect all init methods redefined in `self`
	fun collect_redef_inits(filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_redef_mmethods(filter) do
			if mproperty.is_init then res.add(mproperty)
		end
		return res
	end

	# Collect all init methods introduced and redefined in `self`
	fun collect_local_inits(filter: nullable ModelFilter): Set[MMethod] do
		var set = new HashSet[MMethod]
		set.add_all collect_intro_inits(filter)
		set.add_all collect_redef_inits(filter)
		return set
	end

	# Collect all init methods inherited by `self`
	fun collect_inherited_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod] do
		var res = new HashSet[MMethod]
		for mproperty in collect_inherited_mmethods(mainmodule, filter) do
			if mproperty.is_init then res.add(mproperty)
		end
		return res
	end

	# Collect all init methods accessible by `self`
	#
	# This include introduced, redefined, inherited inits.
	fun collect_accessible_inits(mainmodule: MModule, filter: nullable ModelFilter): Set[MMethod] do
		var set = new HashSet[MMethod]
		set.add_all(collect_intro_inits(filter))
		set.add_all(collect_redef_inits(filter))
		set.add_all(collect_inherited_inits(mainmodule, filter))
		return set
	end

	# Collect all virtual types introduced in `self`
	fun collect_intro_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp] do
		var res = new HashSet[MVirtualTypeProp]
		for mproperty in collect_intro_mproperties(filter) do
			if mproperty isa MVirtualTypeProp then res.add(mproperty)
		end
		return res
	end

	# Collect all virtual types redefined in `self`
	fun collect_redef_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp] do
		var res = new HashSet[MVirtualTypeProp]
		for mproperty in collect_intro_mproperties(filter) do
			if mproperty isa MVirtualTypeProp then res.add(mproperty)
		end
		return res
	end

	# Collect all virtual types introduced or redefined in `self`
	fun collect_local_vts(filter: nullable ModelFilter): Set[MVirtualTypeProp] do
		var set = new HashSet[MVirtualTypeProp]
		set.add_all collect_intro_vts(filter)
		set.add_all collect_redef_vts(filter)
		return set
	end

	# Collect all virtual types inherited by `self`
	fun collect_inherited_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp] do
		var res = new HashSet[MVirtualTypeProp]
		for mproperty in collect_inherited_mproperties(mainmodule, filter) do
			if mproperty isa MVirtualTypeProp then res.add(mproperty)
		end
		return res
	end

	# Collect all virtual types accessible by `self`
	#
	# This include introduced, redefined, inherited virtual types.
	fun collect_accessible_vts(mainmodule: MModule, filter: nullable ModelFilter): Set[MVirtualTypeProp] do
		var set = new HashSet[MVirtualTypeProp]
		for mproperty in collect_accessible_mproperties(mainmodule, filter) do
			if mproperty isa MVirtualTypeProp then set.add mproperty
		end
		return set
	end
end
src/model/model_collect.nit:642,1--966,3

nitc :: java_compiler $ MClass
redef class MClass

	# Runtime name
	private fun rt_name: String do return "RTClass_{intro_mmodule.jname}_{jname}"

	# Generate a Java RTClass for a Nit MClass
	fun compile_to_java(v: JavaCompilerVisitor) do
		v.add("public class {rt_name} extends RTClass \{")
		v.add("  protected static RTClass instance;")
		v.add("  private {rt_name}() \{")
		v.add("    this.class_name = \"{name}\";")
		compile_vft(v)
		compile_type_table(v)
		v.add("  \}")
		v.add("  public static RTClass get{rt_name}() \{")
		v.add("    if(instance == null) \{")
		v.add("      instance = new {rt_name}();")
		v.add("    \}")
		v.add("    return instance;")
		v.add("  \}")
		v.add("\}")
	end

	# Compile the virtual function table for the mclass
	private fun compile_vft(v: JavaCompilerVisitor) do
		# TODO handle generics
		if mclass_type.need_anchor then return
		var mclassdefs = mclass_type.collect_mclassdefs(v.compiler.mainmodule).to_a
		v.compiler.mainmodule.linearize_mclassdefs(mclassdefs)

		var mainmodule = v.compiler.mainmodule
		for mclassdef in mclassdefs.reversed do
			for mprop in mclassdef.intro_mproperties do
				var mpropdef = mprop.lookup_first_definition(mainmodule, intro.bound_mtype)
				if not mpropdef isa MMethodDef then continue
				var rt_name = mpropdef.rt_name
				v.add("this.vft.put(\"{mprop.full_name}\", {rt_name}.get{rt_name}());")

				# fill super next definitions
				while mpropdef.has_supercall do
					var prefix = mpropdef.full_name
					mpropdef = mpropdef.lookup_next_definition(mainmodule, intro.bound_mtype)
					rt_name = mpropdef.rt_name
					v.add("this.vft.put(\"{prefix}\", {rt_name}.get{rt_name}());")
				end
			end
		end
	end

	# Compile the type table for the MClass
	fun compile_type_table(v: JavaCompilerVisitor) do
		for pclass in in_hierarchy(v.compiler.mainmodule).greaters do
			if pclass == self then
				v.add("supers.put(\"{pclass.jname}\", this);")
			else
				v.add("supers.put(\"{pclass.jname}\", {pclass.rt_name}.get{pclass.rt_name}());")
			end
		end
	end
end
src/compiler/java_compiler.nit:1330,1--1389,3

nitc :: inheritance_metrics $ MClass
redef class MClass

	# Class Depth in Inheritance Tree
	#
	# Following the longest path composed only of extends edges from self to Object
	fun ditc(mainmodule: MModule): Int do
		if in_hierarchy(mainmodule).direct_greaters.is_empty then
			return 0
		end
		var min = -1
		for p in in_hierarchy(mainmodule).direct_greaters do
			if p.kind != abstract_kind and p.kind != concrete_kind and p.kind != extern_kind then continue
			var d = p.ditc(mainmodule) + 1
			if min == -1 or d < min then
				min = d
			end
		end
		if min == -1 then min = 0
		return min
	end

	# Interface Depth in Inheritance Tree
	#
	# Following the longest path composed only of implements edges from self to Object
	fun diti(mainmodule: MModule): Int do
		if in_hierarchy(mainmodule).direct_greaters.is_empty then
			return 0
		end
		var min = -1
		for p in in_hierarchy(mainmodule).direct_greaters do
			if p.kind != interface_kind then continue
			var d = p.diti(mainmodule) + 1
			if min == -1 or d < min then
				min = d
			end
		end
		if min == -1 then min = 0
		return min
	end
end
src/metrics/inheritance_metrics.nit:507,1--546,3

nitc :: mendel_metrics $ MClass
redef class MClass
	# the set of redefition that call to super
	fun extended_mproperties(filter: ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		for mclassdef in mclassdefs do
			for mpropdef in mclassdef.mpropdefs do
				if not filter.accept_mentity(mpropdef) then continue
				if not mpropdef.has_supercall then continue
				if mpropdef.mproperty.intro_mclassdef.mclass != self then set.add(mpropdef.mproperty)
			end
		end
		return set
	end

	# the set of redefition that do not call to super
	fun overriden_mproperties(filter: ModelFilter): Set[MProperty] do
		var set = new HashSet[MProperty]
		for mclassdef in mclassdefs do
			for mpropdef in mclassdef.mpropdefs do
				if not filter.accept_mentity(mpropdef) then continue
				if mpropdef.has_supercall then continue
				if mpropdef.mproperty.intro_mclassdef.mclass != self then set.add(mpropdef.mproperty)
			end
		end
		return set
	end

	# pure overriders contain only redefinitions
	private fun is_pure_overrider(filter: ModelFilter): Bool do
		var news = collect_intro_mproperties(filter).length
		var locs = collect_local_mproperties(filter).length
		if news == 0 and locs > 0 then return true
		return false
	end

	# overriders contain more definitions than introductions
	private fun is_overrider(filter: ModelFilter): Bool do
		var rdfs = collect_redef_mproperties(filter).length
		var news = collect_intro_mproperties(filter).length
		var locs = collect_local_mproperties(filter).length
		if rdfs >= news and locs > 0 then return true
		return false
	end

	# pure extenders contain only introductions
	private fun is_pure_extender(filter: ModelFilter): Bool do
		var rdfs = collect_redef_mproperties(filter).length
		var locs = collect_local_mproperties(filter).length
		if rdfs == 0 and locs > 0 then return true
		return false
	end

	# extenders contain more introduction than redefinitions
	private fun is_extender(filter: ModelFilter): Bool do
		var rdfs = collect_redef_mproperties(filter).length
		var news = collect_intro_mproperties(filter).length
		var locs = collect_local_mproperties(filter).length
		if news > rdfs and locs > 0 then return true
		return false
	end

	# pure specializers always call to super in its redefinitions
	private fun is_pure_specializer(filter: ModelFilter): Bool do
		var ovrs = overriden_mproperties(filter).length
		var rdfs = collect_redef_mproperties(filter).length
		if ovrs == 0 and rdfs > 0 then return true
		return false
	end

	# specializers have more redefinitions that call super than not calling it
	private fun is_specializer(filter: ModelFilter): Bool do
		var spcs = extended_mproperties(filter).length
		var ovrs = overriden_mproperties(filter).length
		var rdfs = collect_redef_mproperties(filter).length
		if spcs > ovrs and rdfs > 0 then return true
		return false
	end

	# pure replacers never call to super in its redefinitions
	private fun is_pure_replacer(filter: ModelFilter): Bool do
		var spcs = extended_mproperties(filter).length
		var rdfs = collect_redef_mproperties(filter).length
		if spcs == 0 and rdfs > 0 then return true
		return false
	end

	# replacers have less redefinitions that call super than not calling it
	private fun is_replacer(filter: ModelFilter): Bool do
		var spcs = extended_mproperties(filter).length
		var ovrs = overriden_mproperties(filter).length
		var rdfs = collect_redef_mproperties(filter).length
		if ovrs > spcs and rdfs > 0 then return true
		return false
	end

	# equals contain as redifinition than introduction
	private fun is_equal(filter: ModelFilter): Bool do
		var spcs = extended_mproperties(filter).length
		var ovrs = overriden_mproperties(filter).length
		var rdfs = collect_redef_mproperties(filter).length
		if spcs == ovrs and rdfs > 0 then return true
		return false
	end
end
src/metrics/mendel_metrics.nit:257,1--360,3

nitc :: term_model $ MClass
redef class MClass
	redef fun cs_icon(no_color) do return intro.cs_icon(no_color)
	redef fun cs_signature(no_color) do return intro.cs_signature(no_color)
end
src/doc/templates/term_model.nit:148,1--151,3

nitc :: uml_class $ MClass
redef class MClass

	redef fun tpl_class(model) do
		var name = name.escape_to_dot
		var t = new Template
		t.add "{name} [\n label = \"\{"
		if kind == abstract_kind then
			t.add "abstract\\n{name}"
		else if kind == interface_kind then
			t.add "interface\\n{name}"
		else
			t.add "{name}"
		end
		if arity > 0 then
			t.add "["
			t.add mparameters.first.name
			for i in [1 .. mparameters.length[ do
				t.add ", "
				t.add mparameters[i].name
			end
			t.add "]"
		end
		t.add "|"
		var props = collect_intro_mproperties(model.filter)
		for i in props do
			if not i isa MAttribute then continue
			t.add i.tpl_class(model)
			t.add "\\l"
		end
		t.add "|"
		for i in props do
			if not i isa MMethod then continue
			t.add i.tpl_class(model)
			t.add "\\l"
		end
		t.add "\}\"\n]\n"
		var g = in_hierarchy(model.mainmodule).direct_greaters
		for i in g do
			if not model.filter.accept_mentity(i) then continue
			t.add "{i.name} -> {name} [dir=back"
			if i.kind == interface_kind then
				t.add " arrowtail=open style=dashed"
			else
				t.add " arrowtail=empty"
			end
			t.add "];\n"
		end
		return t
	end

end
src/uml/uml_class.nit:52,1--102,3

nitc :: model_index $ MClass
redef class MClass
	redef fun mentity_kind_rank do return 4
end
src/model/model_index.nit:658,1--660,3

nitc :: nitlight $ MClass
redef class MClass
	redef fun href(v)
	do
		# Because we only have code, just link to the introduction
		return intro.href(v)
	end
end
src/nitlight.nit:51,1--57,3

nitc :: html_model $ MClass
redef class MClass
	redef fun html_icon do return new BSIcon("stop", css_classes)
	redef fun html_signature(short) do return intro.html_signature(short)
	redef fun css_classes do return super + [visibility.to_s]

	redef fun html_namespace do
		var mgroup = intro_mmodule.mgroup
		var tpl = new Template
		if mgroup != null then
			tpl.add mgroup.mpackage.html_namespace
			tpl.add " :: "
		end
		tpl.add "<span>"
		tpl.add html_link
		tpl.add "</span>"
		return tpl
	end
end
src/doc/templates/html_model.nit:134,1--151,3

nitc :: commands_graph $ MClass
redef class MClass
	redef fun to_dot_node do
		var node = super
		node["shape"] = "box"
		return node
	end
end
src/doc/commands/commands_graph.nit:393,1--399,3

nitc :: json_model $ MClass
redef class MClass
	redef fun core_serialize_to(v) do
		super

		if mparameters.not_empty then
			v.serialize_attribute("mparameters", mparameters)
		end
	end

	redef fun json_namespace do
		var ns = new JsonNamespace
		ns.add_all intro_mmodule.ns_for(visibility)
		ns.add "::"
		ns.add to_json_ref
		return ns
	end
end
src/doc/templates/json_model.nit:149,1--165,3

nitc :: static_base $ MClass
redef class MClass
	redef var nitdoc_breadcrumbs is lazy do
		return intro_mmodule.nitdoc_breadcrumbs + [self]
	end
end
src/doc/static/static_base.nit:273,1--277,3

nitc :: static_html $ MClass
redef class MClass
	redef var html_url is lazy do return "class_{super}"
end
src/doc/static/static_html.nit:388,1--390,3

nitc :: api_metrics $ MClass
redef class MClass
	redef fun collect_metrics(h) do
		var mclass_metrics = h.mclasses_metrics
		mclass_metrics.collect(new HashSet[MClass].from([self]))

		var metrics = new JsonObject
		metrics["mclass"] = mclass_metrics
		return metrics
	end
end
src/doc/api/api_metrics.nit:141,1--150,3