+ parent_path = p.ud_path_to_object
+ end
+ end
+
+ if max_parent != null and parent_path != null then
+ path.add(max_parent)
+ path.add_all(parent_path)
+ end
+
+ return path
+ end
+
+ # Return the longest path from class to root hierarchy following only classes relations
+ fun class_path_to_object: Array[MClass] do
+ var path = new Array[MClass]
+ if not self.is_class then return path
+ var max_dit: nullable Int = null
+ var max_parent: nullable MClass = null
+ var parent_path: nullable Array[MClass] = null
+
+ for p in parents do
+ var dit = p.class_path_to_object.length
+ if max_dit == null or dit >= max_dit then
+ max_dit = dit
+ max_parent = p
+ parent_path = p.class_path_to_object
+ end
+ end
+
+ if max_parent != null and parent_path != null then
+ path.add(max_parent)
+ path.add_all(parent_path)
+ end
+
+ return path
+ end
+
+ # Return the longest path from class to root hierarchy following only interfaces relations
+ fun interface_path_to_object: Array[MClass] do
+ var path = new Array[MClass]
+ if not self.is_interface then return path
+ var max_dit: nullable Int = null
+ var max_parent: nullable MClass = null
+ var parent_path: nullable Array[MClass] = null
+
+ for p in parents do
+ var dit = p.interface_path_to_object.length
+ if max_dit == null or dit >= max_dit then
+ max_dit = dit
+ max_parent = p
+ parent_path = p.interface_path_to_object
+ end
+ end
+
+ if max_parent != null and parent_path != null then
+ path.add(max_parent)
+ path.add_all(parent_path)
+ end
+
+ return path
+ end
+
+ # Return the longest path from class to root hierarchy following only ud classes relations
+ fun ud_class_path_to_object: Array[MClass] do
+ var path = new Array[MClass]
+ if not self.is_class or not self.is_user_defined then return path
+ var max_dit: nullable Int = null
+ var max_parent: nullable MClass = null
+ var parent_path: nullable Array[MClass] = null
+
+ for p in parents do
+ var dit = p.ud_class_path_to_object.length
+ if max_dit == null or dit >= max_dit then
+ max_dit = dit
+ max_parent = p
+ parent_path = p.ud_class_path_to_object
+ end
+ end
+
+ if max_parent != null and parent_path != null then
+ path.add(max_parent)
+ path.add_all(parent_path)
+ end
+
+ return path
+ end
+
+ # Return the longest path from class to root hierarchy following only ud interfaces relations
+ fun ud_interface_path_to_object: Array[MClass] do
+ var path = new Array[MClass]
+ if not self.is_interface or not self.is_user_defined then return path
+ var max_dit: nullable Int = null
+ var max_parent: nullable MClass = null
+ var parent_path: nullable Array[MClass] = null
+
+ for p in parents do
+ var dit = p.ud_interface_path_to_object.length
+ if max_dit == null or dit >= max_dit then
+ max_dit = dit
+ max_parent = p
+ parent_path = p.ud_interface_path_to_object