/* (non-Javadoc)
         * @see ocl20.CoreClassifier#conformsTo(ocl20.CoreClassifier)
         */

        public virtual bool conformsTo(CoreClassifier c)
        {
            CoreClassifier thisClassifier = getModel() != null?getModel().toOclType(this) : this;

            CoreClassifier theOtherClassifier = c.getModel() != null ? (CoreClassifier)c.getModel().toOclType(c) : c;

            return((thisClassifier == theOtherClassifier) ||
                   (thisClassifier.getFullPathName().Equals(theOtherClassifier.getFullPathName())) ||
                   (OCLANY.Equals(theOtherClassifier.getName())) ||
                   (OCLVOID.Equals(thisClassifier.getName())) ||
                   (OCLINVALID.Equals(thisClassifier.getName())) ||
                   (isClassifierDescendantOf(theOtherClassifier)) ||
                   (classifierRealizesInterface(theOtherClassifier)));
        }
示例#2
0
        /* (non-Javadoc)
         * @see AstOclModelElementFactory#createCollectionOperation(CoreOperation, CoreClassifier)
         */
        public CollectionOperation createCollectionOperation(
            CoreOperation jmiOperation, CoreClassifier owner)
        {
//          String key = owner.getFullPathName() + jmiOperation.getName();

            String key = owner.getFullPathName() + CoreModelElementNameGeneratorImpl.getInstance().generateName(jmiOperation);
            CollectionOperation operation;

            allCollectionOperations.TryGetValue(key, out operation);

            if (operation == null)
            {
                operation = oclPackage.getTypes().getCollectionOperation();
                operation.setFeatureOwner(owner);
                operation.setJmiOperation(jmiOperation);
                allCollectionOperations.Add(key, operation);
            }

            operation.setFeatureOwner(owner);

            return(operation);
        }
 protected void addElementToEnvironment(
     String name,
     CoreModelElement wrapper,
     Environment environment)
 {
     try {
         environment.addElement(name, wrapper, false);
     } catch (NameClashException e) {
         Object element = environment.lookupLocal(name);
         try {
             if (element is CoreClassifierImpl &&
                 wrapper is CoreClassifierImpl &&
                 !OclTypesDefinition.isOclPrimitiveType(wrapper.getName()))
             {
                 environment.removeElement(name);
                 CoreClassifier cls = (CoreClassifier)element;
                 environment.addElement(cls.getFullPathName(), cls, false);
                 environment.addElement(((CoreClassifier)wrapper).getFullPathName(), cls, false);
             }
         } catch (NameClashException e2) {
         }
     }
 }