@Override public EOperation define(EcoreEnvironment env) { EOperation eOperation = EcoreFactory.eINSTANCE.createEOperation(); eOperation.setName(fName); int pos = 0; for (EClassifier cls : fParamTypes) { EParameter eParam = EcoreFactory.eINSTANCE.createEParameter(); String paramName = cls.getName(); if (fParamNames != null) { paramName = fParamNames[pos++]; } eParam.setName(paramName); eParam.setEType(cls); eOperation.getEParameters().add(eParam); } eOperation.setEType(fReturnType); assert fContextType instanceof EClass; ((EClass) fContextType).getEOperations().add(eOperation); CallHandlerAdapter.attach(eOperation, fDispatcher); return eOperation; }
public EOperation define(EcoreEnvironment env) { List<Variable<EClassifier, EParameter>> argList = new ArrayList<Variable<EClassifier, EParameter>>(); int pos = 0; for (EClassifier cls : fParamTypes) { Variable<EClassifier, EParameter> stringVariable = ExpressionsFactory.eINSTANCE.createVariable(); String paramName = cls.getName(); if (fParamNames != null) { paramName = fParamNames[pos++]; } stringVariable.setName(paramName); stringVariable.setType(cls); argList.add(stringVariable); } EOperation result = env.defineOperation( fContextType, fName, fReturnType, argList, org.eclipse.ocl.ecore.EcoreFactory.eINSTANCE.createConstraint()); CallHandlerAdapter.attach(result, fDispatcher); if (fIsDeprecated) { if (fDeprecatedBy != null) { QvtOperationalParserUtil.markAsDeprecated(result, fDeprecatedBy); } else { QvtOperationalParserUtil.markAsDeprecated(result); } } return result; }