package com.rockwellcollins.atc.resolute.analysis.execution;

import java.util.Comparator;

import org.osate.aadl2.NamedElement;

public class NamedElementComparator implements Comparator<NamedElement> {
    @Override
    public int compare(NamedElement arg0, NamedElement arg1) {
        if (arg0 == arg1) {
            return 0;
        }
        
        int r = arg0.getName().compareToIgnoreCase(arg1.getName());
        if (r != 0) {
            return r;
        }
        
        r = Integer.compare(arg0.hashCode(), arg1.hashCode());
        if (r == 0) {
            throw new IllegalArgumentException("Unable to order distinct objects via hashcode");
        }
        return r;
    }
}

@@ -123,16 +123,92 @@
 ement;%0A%0A
+import com.rockwellcollins.atc.resolute.analysis.values.NamedElementValue;%0A%0A
 public c
@@ -431,30 +431,147 @@
     
-int r = arg0.getName()
+String text0 = new NamedElementValue(arg0).toString();%0A        String text1 = new NamedElementValue(arg1).toString();%0A        int r = text0
 .com
@@ -591,22 +591,13 @@
 ase(
-arg1.getName()
+text1
 );%0A 

Order based on name used in assurance case