コード例 #1
0
ファイル: PivotUtil.java プロジェクト: matterche/ocl
 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;
 }
コード例 #2
0
ファイル: PivotUtil.java プロジェクト: matterche/ocl
 public static List<TemplateParameter> getAllTemplateParameters(
     Collection<TemplateBinding> templateBindings) {
   List<TemplateParameter> list = null;
   for (TemplateBinding templateBinding : templateBindings) { // FIXME Establish ordering
     TemplateSignature templateSignature = templateBinding.getSignature();
     if (templateSignature != null) {
       List<TemplateParameter> templateParameters = templateSignature.getParameter();
       if (templateParameters.size() > 0) {
         if (list == null) {
           list = new ArrayList<TemplateParameter>();
         }
         list.addAll(templateParameters);
       }
     }
   }
   return list != null ? list : Collections.<TemplateParameter>emptyList();
 }