Exemplo n.º 1
0
 public void addRootPackages() {
   CompleteModelInternal completeModel = environmentFactory.getCompleteModel();
   String name2 = name;
   if (name2 != null) {
     CompletePackage rootCompletePackage = completeModel.getOwnedCompletePackage(name2);
     if (rootCompletePackage != null) {
       addNamedElement(rootCompletePackage);
     }
     CompletePackage completePackage = completeModel.getCompletePackageByURI(name2);
     if (completePackage != null) {
       addElement(name2, completePackage);
     }
   } else {
     for (CompletePackage rootCompletePackage : completeModel.getOwnedCompletePackages()) {
       if (rootCompletePackage != null) {
         addNamedElement(rootCompletePackage);
       }
     }
     for (CompletePackage completePackage : completeModel.getAllCompletePackagesWithUris()) {
       String nsURI = completePackage.getURI();
       if (nsURI != null) {
         addElement(nsURI, completePackage);
       }
     }
   }
 }
Exemplo n.º 2
0
 public void addAllOperations(
     org.eclipse.ocl.pivot.@NonNull Class type, @Nullable FeatureFilter featureFilter) {
   if (accepts(
           PivotPackage.Literals.ITERATION) // If ITERATION is acceptable then so too is OPERATION
       && (requiredType
           != PivotPackage.Literals
               .NAMESPACE)) { // Don't really want operations when looking for NAMESPACE
     assert environmentFactory.getMetamodelManager().isTypeServeable(type);
     type = PivotUtil.getUnspecializedTemplateableElement(type);
     CompleteClass completeClass = environmentFactory.getMetamodelManager().getCompleteClass(type);
     String name2 = name;
     if (name2 != null) {
       for (Operation operation : completeClass.getOperations(featureFilter, name2)) {
         if ((operation != null) /*&& (operation.isStatic() == selectStatic)*/) {
           addElement(name2, operation);
         }
       }
     } else {
       for (Operation operation : completeClass.getOperations(featureFilter)) {
         if ((operation != null) /*&& (operation.isStatic() == selectStatic)*/) {
           addNamedElement(operation);
         }
       }
     }
   }
 }
Exemplo n.º 3
0
 public void addNamedElement(/*@NonNull*/ Nameable namedElement) {
   if (namedElement == null) {
     return;
   }
   String elementName = namedElement.getName();
   if (elementName != null) {
     addElement(elementName, namedElement);
   }
 }
Exemplo n.º 4
0
 public void addElements(@NonNull Map<String, ?> elements) {
   String name2 = name;
   if (name2 != null) {
     Object element = elements.get(name2);
     if (element != null) {
       addElement(name2, element);
     }
   } else {
     for (String key : elements.keySet()) {
       if (key != null) {
         Object element = elements.get(key);
         if (element != null) {
           addElement(key, element);
         }
       }
     }
   }
 }
Exemplo n.º 5
0
 public void addElements(@Nullable Iterable<? extends Object> elements) {
   if (elements != null) {
     for (Object element : elements) {
       if (element instanceof Nameable) {
         Nameable namedElement = (Nameable) element;
         String elementName = namedElement.getName();
         if (elementName != null) {
           addElement(elementName, namedElement);
         }
       }
     }
   }
 }
Exemplo n.º 6
0
 public void addImportedElement(@NonNull URI baseURI) {
   if (PivotUtilInternal.isASURI(baseURI)) {
     baseURI = PivotUtilInternal.getNonASURI(baseURI);
   }
   String name = getName();
   if (name != null) {
     @NonNull URI uri = URI.createURI(name).resolve(baseURI);
     try {
       Element importedElement =
           environmentFactory.getMetamodelManager().loadResource(uri, null, null);
       if (importedElement != null) {
         addElement(name, importedElement);
       }
     } catch (Exception e) {
       // if it doesn't load just treat it as unresolved
     }
   }
 }
Exemplo n.º 7
0
 public void addAllPrecedences(@NonNull Library pivot) {
   if (accepts(PivotPackage.Literals.PRECEDENCE)) {
     String name2 = name;
     if (name2 != null) {
       for (Precedence precedence : pivot.getOwnedPrecedences()) {
         if (name2.equals(precedence.getName())) {
           addElement(name2, precedence);
         }
       }
     } else {
       for (Precedence precedence : pivot.getOwnedPrecedences()) {
         if (precedence != null) {
           addNamedElement(precedence);
         }
       }
     }
   }
 }
Exemplo n.º 8
0
 public void addAllParameters(@NonNull Operation pivot) {
   if (accepts(PivotPackage.Literals.PARAMETER)) {
     String name2 = name;
     if (name2 != null) {
       for (Parameter parameter : pivot.getOwnedParameters()) {
         if (name2.equals(parameter.getName())) {
           addElement(name2, parameter);
         }
       }
     } else {
       for (Parameter parameter : pivot.getOwnedParameters()) {
         if (parameter != null) {
           addNamedElement(parameter);
         }
       }
     }
   }
 }
Exemplo n.º 9
0
 public void addAllPackages(@NonNull Model root) {
   if (accepts(PivotPackage.Literals.PACKAGE)) {
     String name2 = name;
     if (name2 != null) {
       for (org.eclipse.ocl.pivot.Package pkge : root.getOwnedPackages()) {
         if ((pkge != null) && name2.equals(pkge.getName())) {
           addElement(name2, pkge);
         }
       }
     } else {
       for (org.eclipse.ocl.pivot.Package pkge : root.getOwnedPackages()) {
         if (pkge != null) {
           addNamedElement(environmentFactory.getMetamodelManager().getPrimaryPackage(pkge));
         }
       }
     }
   }
 }
Exemplo n.º 10
0
 public void addAllEnumerationLiterals(org.eclipse.ocl.pivot.Enumeration pivot) {
   if (accepts(PivotPackage.Literals.ENUMERATION_LITERAL)) {
     String name2 = name;
     if (name2 != null) {
       for (EnumerationLiteral literal : pivot.getOwnedLiterals()) {
         if ((literal != null) && name2.equals(literal.getName())) {
           addElement(name2, literal);
         }
       }
     } else {
       for (EnumerationLiteral literal : pivot.getOwnedLiterals()) {
         if (literal != null) {
           addNamedElement(literal);
         }
       }
     }
   }
 }
Exemplo n.º 11
0
 public void addAllPackages(org.eclipse.ocl.pivot.@NonNull Package pkge) {
   if (accepts(PivotPackage.Literals.PACKAGE)) {
     CompletePackage parentCompletePackage =
         environmentFactory.getMetamodelManager().getCompletePackage(pkge);
     String name2 = name;
     if (name2 != null) {
       CompletePackage completePackage = parentCompletePackage.getOwnedCompletePackage(name2);
       if (completePackage != null) {
         addElement(name2, completePackage);
       }
     } else {
       for (CompletePackage completePackage : parentCompletePackage.getOwnedCompletePackages()) {
         if (completePackage != null) {
           addNamedElement(completePackage);
         }
       }
     }
   }
 }
Exemplo n.º 12
0
 public void addAllTemplateParameters(@NonNull TemplateableElement pivot) {
   if (accepts(PivotPackage.Literals.TYPE)) {
     TemplateSignature templateSignature = pivot.getOwnedSignature();
     if (templateSignature != null) {
       String name2 = name;
       List<TemplateParameter> templateParameters = templateSignature.getOwnedParameters();
       if (name2 != null) {
         for (TemplateParameter templateParameter : templateParameters) {
           if ((templateParameter != null) && name2.equals(templateParameter.getName())) {
             addElement(name2, templateParameter);
           }
         }
       } else {
         for (TemplateParameter templateParameter : templateParameters) {
           if (templateParameter != null) {
             addNamedElement(templateParameter);
           }
         }
       }
     }
   }
 }
Exemplo n.º 13
0
 // This copy here to preserve API until failure of clients to update understood.
 public void addElement(/*@NonNull*/ String elementName, /*@NonNull*/ Element element) {
   addElement(elementName, (Object) element);
 }