public override bool operationNameMatches(String name)
    {
        ModelElementNameGenerator nameGenerator = CoreModelElementNameGeneratorImpl.getInstance();

        return(nameGenerator.operationNameMatches(nameGenerator.generateNameForOperation(
                                                      this.name, this.paramTypes), name));
    }
 private void populateWithDefinedFeatures(Environment environment)
 {
     foreach (CoreFeature feature in constraintsHolder.getDefinedFeatures())
     {
         ModelElementNameGenerator nameGenerator = new CoreModelElementNameGeneratorImpl();
         addElementToEnvironment(nameGenerator.generateName(feature), feature, environment);
     }
 }
        private void populateWithAssociationClasses(Environment environment)
        {
            List <object> associationClasses = this.getAllAssociationClasses();

            foreach (CoreAssociationClass associationClass in associationClasses)
            {
                ModelElementNameGenerator nameGenerator = new CoreModelElementNameGeneratorImpl();
                addElementToEnvironment(nameGenerator.generateName(associationClass), associationClass, environment);
            }
        }
 private void populateWithFeatures(Environment environment)
 {
     foreach (CoreModelElement element in getClassifierFeatures())
     {
         if (elementShouldBeAddedToEnvironment(element))
         {
             ModelElementNameGenerator nameGenerator = new CoreModelElementNameGeneratorImpl();
             addElementToEnvironment(nameGenerator.generateName(element), element, environment);
         }
     }
 }
        public CoreModelElement addDefinedOperation(
            string source,
            string name,
            List <object> paramNames,
            List <object> paramTypes,
            CoreClassifier returnType)
        {
            CoreFeature element = createOclDefinedOperation(source, name, paramNames, paramTypes, returnType);

            element.setFeatureOwner(classifier);
            element.setElemOwner(classifier);
            ModelElementNameGenerator nameGenerator = CoreModelElementNameGeneratorImpl.getInstance();

            string mangledName = nameGenerator.generateNameForOperation(name, paramTypes);

            this.definedFeatures.Add(mangledName, element);
            addElementToDefinedFeaturesBySource(source, element);

            return(element);
        }
        private int deleteAllDefinedElements(string sourceName)
        {
            List <object> namesToBeRemovedFromEnvironment = new List <object>();
            int           result = 0;

            List <CoreFeature> elementsToBeRemoved;

            this.definedFeaturesBySource.TryGetValue(sourceName, out elementsToBeRemoved);
            if (elementsToBeRemoved != null)
            {
                foreach (CoreFeature modelElement in elementsToBeRemoved)
                {
                    if (modelElement.GetType() == typeof(CoreAttribute))
                    {
                        CoreAttribute attr = (CoreAttribute)modelElement;
                        namesToBeRemovedFromEnvironment.Add(attr.getName());
                    }
                    else
                    {
                        CoreOperation oper = (CoreOperation)modelElement;
                        namesToBeRemovedFromEnvironment.Add(
                            CoreModelElementNameGeneratorImpl.getInstance().generateNameForOperation(oper.getName(),
                                                                                                     new List <object>(oper.getParametersTypesExceptReturn())));
                    }
                }

                result = elementsToBeRemoved.Count;

                foreach (string element in namesToBeRemovedFromEnvironment)
                {
                    CoreFeature coreFeature;
                    bool        foudbefore = this.definedFeatures.TryGetValue(element, out coreFeature);
                    this.definedFeatures.Remove(element);
                    bool foundafter = this.definedFeatures.TryGetValue(element, out coreFeature);
                }

                this.definedFeaturesBySource.Add(sourceName, new List <CoreFeature>());
            }

            return(result);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        /* (non-Javadoc)
         * @see ocl20.CoreOperation#operationNameMatches(java.lang.String)
         */

        public virtual bool operationNameMatches(String name)
        {
            ModelElementNameGenerator nameGenerator = CoreModelElementNameGeneratorImpl.getInstance();

            return(nameGenerator.operationNameMatches(nameGenerator.generateName(this), name));
        }