nitc $ TestModelVisitor :: SELF
Type of this instance, automatically specialized in every classnitc :: ModelVisitor :: _current_entity
The current visited entitynitc :: ModelVisitor :: _filter
Filters to apply when visiting the model.nitc :: ModelVisitor :: accept_mentity
Should we accept thismentity
from the view?
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: ModelVisitor :: current_entity
The current visited entitynitc :: ModelVisitor :: current_entity=
The current visited entitycore :: Object :: defaultinit
nitc :: TestModelVisitor :: defaultinit
nitc :: ModelVisitor :: defaultinit
nitc :: ModelVisitor :: filter=
Filters to apply when visiting the model.core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: ModelVisitor :: visit
Method to define in specific visitor.
# Example visitor that just count kind of entities.
class TestModelVisitor
super ModelVisitor
redef fun visit(e) do
cpt.inc(e.class_name)
if not e isa Model then
var name = e.full_name
var old = names.get_or_null(name)
if old != null then
names[name + "!CONFLICT!" + old.class_name] = old
name = name + "!CONFLICT!" + e.class_name
end
names[name] = e
end
e.visit_all(self)
end
# Counter of visited entities (by classnames)
var cpt = new Counter[String]
# Dictionary of full_names
var names = new Map[String, MEntity]
end
src/test_model_visitor.nit:23,1--48,3