Exemplo n.º 1
0
        private String generateNameForOperation(CoreOperation operation)
        {
            List <object> parametersNames = operation.getParametersTypesNamesExceptReturn();

            return(generateOperationName(operation.getName(), parametersNames));
        }
        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);
        }