Merge: Reworked crypto.nit to introduce basic XOR attacks
[nit.git] / src / model / model_views.nit
index 3a88f45..566a5bd 100644 (file)
@@ -132,6 +132,14 @@ class ModelView
                return res
        end
 
+       # Searches the MEntity that matches `full_name`.
+       fun mentity_by_full_name(full_name: String): nullable MEntity do
+               for mentity in mentities do
+                       if mentity.full_name == full_name then return mentity
+               end
+               return null
+       end
+
        # Looks up a MEntity by its full `namespace`.
        #
        # Usefull when `mentities_by_name` returns conflicts.
@@ -155,6 +163,16 @@ class ModelView
                end
                return v.tree
        end
+
+       # Build the POSet of `mmodules` importation.
+       fun mmodules_poset(mmodules: Set[MModule]): POSet[MModule] do
+               return model.mmodule_importation_hierarchy.sub(mmodules)
+       end
+
+       # Build the POSet of `mmodules` hierarchy.
+       fun mclasses_poset(mainmodule: MModule, mclasses: Set[MClass]): POSet[MClass] do
+               return mainmodule.flatten_mclass_hierarchy.sub(mclasses)
+       end
 end
 
 class LookupNamespaceVisitor