Beispiel #1
0
 public static Map<TemplateParameter, ParameterableElement> getAllTemplateParameterSubstitutions(
     Map<TemplateParameter, ParameterableElement> map, TemplateableElement templateableElement) {
   for (EObject eObject = templateableElement; eObject != null; eObject = eObject.eContainer()) {
     if (eObject instanceof TemplateableElement) {
       for (TemplateBinding templateBinding :
           ((TemplateableElement) eObject).getTemplateBinding()) {
         for (TemplateParameterSubstitution templateParameterSubstitution :
             templateBinding.getParameterSubstitution()) {
           if (map == null) {
             map = new HashMap<TemplateParameter, ParameterableElement>();
           }
           map.put(
               templateParameterSubstitution.getFormal(),
               templateParameterSubstitution.getActual());
         }
       }
     }
     if (eObject instanceof Type) {
       for (Type superType : ((Type) eObject).getSuperClass()) {
         map = getAllTemplateParameterSubstitutions(map, superType);
       }
     }
   }
   return map;
 }
Beispiel #2
0
 public int compare(TemplateParameterSubstitution o1, TemplateParameterSubstitution o2) {
   TemplateParameter f1 = o1.getFormal();
   TemplateParameter f2 = o2.getFormal();
   int i1 = f1.getSignature().getParameter().indexOf(f1);
   int i2 = f2.getSignature().getParameter().indexOf(f2);
   return i1 - i2;
 }