コード例 #1
0
 /** Finds an operation in the given classifier. */
 public static Operation findOperation(
     IRepository repository,
     Classifier classifier,
     String operationName,
     List<TypedElement> arguments,
     ParameterSubstitutionMap substitutions,
     boolean ignoreCase,
     boolean recurse) {
   for (Operation operation : classifier.getOperations()) {
     if (isMatch(operation, operationName, ignoreCase)
         && (arguments == null || isMatch(repository, operation, arguments, substitutions)))
       return operation;
   }
   if (!recurse) return null;
   Operation found;
   final EList<TemplateBinding> templateBindings = classifier.getTemplateBindings();
   if (!templateBindings.isEmpty())
     for (TemplateBinding templateBinding : templateBindings) {
       TemplateSignature signature = templateBinding.getSignature();
       ParameterSubstitutionMap newSubstitutions = new ParameterSubstitutionMap(templateBinding);
       found =
           findOperation(
               repository,
               (Classifier) signature.getTemplate(),
               operationName,
               arguments,
               newSubstitutions,
               ignoreCase,
               true);
       if (found != null) return found;
     }
   for (Generalization generalization : classifier.getGeneralizations())
     if ((found =
             findOperation(
                 repository,
                 generalization.getGeneral(),
                 operationName,
                 arguments,
                 substitutions,
                 ignoreCase,
                 true))
         != null) return found;
   return null;
 }
コード例 #2
0
 public static Property findAttribute(
     Classifier classifier, String attributeIdentifier, boolean ignoreCase, boolean recurse) {
   Property found = classifier.getAttribute(attributeIdentifier, null, ignoreCase, null);
   if (found != null || !recurse) return found;
   final EList<TemplateBinding> templateBindings = classifier.getTemplateBindings();
   if (!templateBindings.isEmpty()) {
     for (TemplateBinding templateBinding : templateBindings) {
       TemplateSignature signature = templateBinding.getSignature();
       found =
           findAttribute(
               (Classifier) signature.getTemplate(), attributeIdentifier, ignoreCase, true);
       if (found != null) return found;
     }
   }
   for (Generalization generalization : classifier.getGeneralizations())
     if ((found =
             findAttribute(generalization.getGeneral(), attributeIdentifier, ignoreCase, true))
         != null) return found;
   return null;
 }