Example #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ocl.utilities.AbstractVisitor#handleVariable(org.eclipse.ocl.expressions.Variable, java.lang.Object)
  */
 @Override
 protected EPackage handleVariable(
     Variable<EClassifier, EParameter> variable, EPackage initResult) {
   EClassifier newType = handle(variable.getType());
   if (newType != null) {
     orgToCopy.put(variable.getType(), newType);
     variable.setType(newType);
   }
   /*
    * variable
    */
   return super.handleVariable(variable, initResult);
 }
    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;
    }