public override bool operationNameMatches(String name) { ModelElementNameGenerator nameGenerator = CoreModelElementNameGeneratorImpl.getInstance(); return(nameGenerator.operationNameMatches(nameGenerator.generateNameForOperation( this.name, this.paramTypes), name)); }
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); }
/* (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); }
/* (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)); }