/** * Initializes me with my environment. * * @param env * my environment */ public AbstractTypeChecker( Environment<?, C, O, P, ?, PM, ?, ?, ?, ?, ?, ?> env) { super(); this.env = env; uml = env.getUMLReflection(); oclFactory = env.getOCLFactory(); stdlib = env.getOCLStandardLibrary(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void addEnvironmentVariable( Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject> environment, Variable<EClassifier, ?> variable) { environment.addElement(variable.getName(), (Variable)variable, true); }
/** * Initializes me with my environment. * * @param ocl the OCL environment */ OCLHelperImpl(OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> ocl) { this.ocl = ocl; uml = ocl.getEnvironment().getUMLReflection(); oclFactory = ocl.getEnvironment().getOCLFactory(); environmentFactory = ocl.getEnvironment().getFactory(); }
public OCLSyntaxHelper(Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) { environment = env; stdlib = env.getOCLStandardLibrary(); uml = env.getUMLReflection(); }
/** * Initializes me with a resource in which I will persist the model-based * types that I generate in my associated {@link Environment}. * * @param env my environment * @param resource my resource */ public AbstractTypeResolver( Environment<PK, C, O, P, ?, PM, ?, ?, ?, ?, ?, ?> env, Resource resource) { this.env = env; this.resource = resource; oclFactory = env.getOCLFactory(); uml = env.getUMLReflection(); }
Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> environment = (Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?>) helper .getEnvironment(); OCLFactory oclFactory = environment.getOCLFactory(); UMLReflection<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?> umlReflection = environment .getUMLReflection(); variable.setType(umlReflection.getOCLType(entry.getValue())); environment.addElement(entry.getKey(), variable, true);
public Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> createClassifierContext( Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> parent, C context) { Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> result = createEnvironment(parent); // in case it corresponds to an OCL primitive type UMLReflection<PK, C, O, P, EL, PM, S, COA, SSA, CT> uml = parent.getUMLReflection(); context = uml.asOCLType(context); Variable<C, PM> self = parent.getOCLFactory().createVariable(); uml.setName(self, Environment.SELF_VARIABLE_NAME); uml.setType(self, context); result.addElement(self.getName(), self, true); result.setSelfVariable(self); return result; }
/** * Initializes me with my environment. * * @param env my environment */ protected ToStringVisitor(Environment<?, C, O, P, EL, PM, S, COA, SSA, CT, ?, ?> env) { this.env = env; this.uml = (env == null)? null : env.getUMLReflection(); }
@SuppressWarnings("unchecked") private OrderedSetType<C, O> getOrderedSet() { if (orderedSet == null) { orderedSet = (OrderedSetType<C, O>) getEnvironment().getOCLStandardLibrary() .getOrderedSet(); } return orderedSet; }
initASTMapping(env, spec, prePostOrBodyDeclCS, null); O operation = env.getContextOperation(); Variable<C, PM> selfVar = env.getSelfVariable(); spec.setContextVariable(selfVar); && (env.lookupLocal(Environment.RESULT_VARIABLE_NAME) == null)) { resultVar = genVariableDeclaration(null, "prePostOrBodyDeclCS0", env, //$NON-NLS-1$ && (env.lookupLocal(Environment.RESULT_VARIABLE_NAME) == null)) { resultVar = genVariableDeclaration(null, "prePostOrBodyDeclCS", env, //$NON-NLS-1$ Collection<Variable<C, PM>> vars = env.getVariables(); for (Variable<C, PM> var : vars) { if (parameters.contains(var.getRepresentedParameter())) { env.setBodyCondition(operation, astNode); env.deleteElement(Environment.RESULT_VARIABLE_NAME);
if (result.lookupLocal(SELF_VARIABLE_NAME) == null) { genVariableDeclaration(operationContextCS, "operationContextDeclCS", result, //$NON-NLS-1$ SELF_VARIABLE_NAME, env.getContextClassifier(), null, true, true, true); Variable<C, PM> var = result.lookupLocal(innateParmName); result.deleteElement(innateParmName); result.addElement(contextParmName, var, true);
C contextClassifier = env.getContextClassifier(); initASTMapping(env, env.getSelfVariable(), defCS, null); initASTMapping(env, spec, defExpr); if (simpleNameCS != null) { OCLMessages.DuplicateProperty_ERROR_, variable .getName(), uml.getName(contextEnv .getContextClassifier()))); spec.setContextVariable(env.getSelfVariable()); feature = (EObject) env.defineAttribute(contextClassifier, variable, astNode); operationString(env, operName, params), uml .getName(contextEnv .getContextClassifier()))); spec.setContextVariable(env.getSelfVariable()); spec.getParameterVariable().addAll(params); feature = (EObject) env.defineOperation(contextClassifier, operName, operType, params, astNode); operCS.setAst(feature); env.undefine(feature);
public boolean isStandardLibraryFeature(C owner, Object feature) { boolean result = owner instanceof PredefinedType<?>; if (result) { result = env.getUMLReflection().isOperation(feature) ? !env.getAdditionalOperations(owner).contains(feature) : !env.getAdditionalAttributes(owner).contains(feature); } return result; }
/** * Initializes me with a root environment. * * @param env * my root environment */ protected OCL(Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) { this(env.getFactory(), env); }
public AbstractOCLAnalyzer(AbstractOCLParser parser) { super(parser); Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env = getOCLEnvironment(); this.environmentFactory = env.getFactory(); oclFactory = createOCLFactory(env); uml = env.getUMLReflection(); }
boolean result = env.addElement(name, vdcl, explicitFlag); if (!result) { if (name != null) { env.setSelfVariable(vdcl);
astNode.setType(env.getOCLStandardLibrary().getBoolean()); } else if (name.equals("select") || name.equals("reject")) {//$NON-NLS-2$//$NON-NLS-1$ astNode.setType(source.getType()); astNode.setSource(source); env.deleteElement(vdcl.getName()); if (vdcl1 != null) { env.deleteElement(vdcl1.getName());
public Object evaluate() { evalProblems = null; // lazily create the evaluation environment, if not already done by // the client. There is no "self" context variable EvaluationVisitor<?, C, O, P, ?, ?, ?, ?, ?, CT, CLS, E> ev = environment.getFactory().createEvaluationVisitor( environment, getEvaluationEnvironment(), getExtentMap()); Object result; try { result = ev.visitExpression(expression); } catch (EvaluationHaltedException e) { evalProblems = e.getDiagnostic(); result = environment.getOCLStandardLibrary().getInvalid(); } return result; }
/** * Creates/obtains the {@link OCLFactory} that I use to create OCL AST * elements. * * @param env * my OCL environment * * @return an appropriate factory */ protected OCLFactory createOCLFactory( Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) { return env.getOCLFactory(); }
.lookupImplicitSourceForProperty(simpleName); VariableExp<C, PM> src = createVariableExp(env, arg, implicitSource);