A MModuleData where multiples values could be set on a single module

a-la MultiHashMap

Introduced properties

fun lookup_joined_values(mmodule: MModule, min_visibility: MVisibility): Sequence[E]

nitc :: MModuleMultiData :: lookup_joined_values

like lookup_all_values but return a big concatenated sequence (instead of a sequence of array)

Redefined properties

redef type SELF: MModuleMultiData[E]

nitc $ MModuleMultiData :: SELF

Type of this instance, automatically specialized in every class
redef fun [](mmodule: MModule): nullable Array[E]

nitc $ MModuleMultiData :: []

Instead of null return an empty array usable

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 SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun [](mmodule: MModule): nullable E

nitc :: MModuleData :: []

The value locally defined in mmodule.
fun []=(mmodule: MModule, value: nullable E)

nitc :: MModuleData :: []=

Set the value locally defined in mmodule.
private var _defs: HashMap[MModule, E]

nitc :: MModuleData :: _defs

private var _model: Model

nitc :: MModuleData :: _model

The model associated with the data
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.
private fun defs: HashMap[MModule, E]

nitc :: MModuleData :: defs

private fun defs=(defs: HashMap[MModule, E])

nitc :: MModuleData :: defs=

fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun has_mmodule(mmodule: MModule): Bool

nitc :: MModuleData :: has_mmodule

is a value locally defined in mmodule
fun hash: Int

core :: Object :: hash

The hash code of the object.
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".
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.
fun lookup_all_modules(mmodule: MModule, min_visibility: MVisibility): Sequence[MModule]

nitc :: MModuleData :: lookup_all_modules

Return all the super modules that defines a value
fun lookup_all_values(mmodule: MModule, min_visibility: MVisibility): Sequence[E]

nitc :: MModuleData :: lookup_all_values

Return all the values defined in mmodule and its imported modules.
fun lookup_first_value(mmodule: MModule, min_visibility: MVisibility): nullable E

nitc :: MModuleData :: lookup_first_value

Return the most specific values defined in mmodule and its imported modules.
fun lookup_joined_values(mmodule: MModule, min_visibility: MVisibility): Sequence[E]

nitc :: MModuleMultiData :: lookup_joined_values

like lookup_all_values but return a big concatenated sequence (instead of a sequence of array)
fun lookup_values(mmodule: MModule, min_visibility: MVisibility): Sequence[E]

nitc :: MModuleData :: lookup_values

Return the most specific values defined in mmodule and its imported modules.
fun model: Model

nitc :: MModuleData :: model

The model associated with the data
protected fun model=(model: Model)

nitc :: MModuleData :: model=

The model associated with the data
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
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 serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram nitc::MModuleMultiData MModuleMultiData nitc::MModuleData MModuleData nitc::MModuleMultiData->nitc::MModuleData core::Object Object nitc::MModuleData->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

class MModuleData[E: Object]

nitc :: MModuleData

A map-like structure to associate E toMModule

Class definitions

nitc $ MModuleMultiData
# A `MModuleData` where multiples values could be set on a single module
# a-la `MultiHashMap`
class MModuleMultiData[E]
	super MModuleData[Array[E]]

	# Instead of `null` return an empty array usable
	redef fun [](mmodule)
	do
		var res = super
		if res == null then
			res = new Array[E]
			defs[mmodule] = res
		end
		return res
	end

	# like `lookup_all_values` but return a big concatenated sequence (instead of a sequence of array)
	fun lookup_joined_values(mmodule: MModule, min_visibility: MVisibility): Sequence[E]
	do
		var mmodules = lookup_all_modules(mmodule, min_visibility)
		mmodules = model.mmodule_importation_hierarchy.linearize(mmodules)
		var res = new Array[E]
		for m in mmodules do res.add_all defs[m]
		return res
	end
end
src/model/mmodule_data.nit:104,1--129,3