# The total order superset the class refinement and the class specialisation relations
class ClassSorter
special AbstractSorter[MMLocalClass]
- redef fun compare(a, b) do return a.compare(b)
+ redef fun compare(a, b) do return a.total_order_compare(b)
init do end
end
-
-redef class MMLocalClass
- # Comparaison in a total order that superset the class refinement and the class specialisation relations
- fun compare(b: MMLocalClass): Int
- do
- var a = self
- if a == b then
- return 0
- else if a.module.mhe < b.module then
- return 1
- else if b.module.mhe < a.module then
- return -1
- end
- var ar = a.cshe.rank
- var br = b.cshe.rank
- if ar > br then
- return 1
- else if br > ar then
- return -1
- else
- return b.name.to_s <=> a.name.to_s
- end
- end
-end
# Local classes are classes defined, refined or imported in a module
class MMLocalClass
# The name of the local class
- readable var _name: Symbol
+ readable var _name: Symbol
# Arity of the local class (if generic)
# FIXME: How to move this into the generic module in a sane way?
do
return _name.to_s
end
+
+ # Comparaison in a total order that superset the class refinement and the class specialisation relations
+ fun total_order_compare(b: MMLocalClass): Int
+ do
+ var a = self
+ if a == b then
+ return 0
+ else if a.module.mhe < b.module then
+ return 1
+ else if b.module.mhe < a.module then
+ return -1
+ end
+ var ar = a.cshe.rank
+ var br = b.cshe.rank
+ if ar > br then
+ return 1
+ else if br > ar then
+ return -1
+ else
+ return b.name.to_s <=> a.name.to_s
+ end
+ end
end
# A global property gather local properties that correspond to a same message