Exemplo n.º 1
0
  // implements the interface method
  public Environment createClassifierContext(Environment parent, Type context) {

    Environment result = createEnvironment(parent);

    Variable self = parent.getOCLFactory().createVariable();
    self.setName(Environment.SELF_VARIABLE_NAME);
    self.setType(context);

    //        result.addElement(self.getName(), self, true);
    result.setSelfVariable(self);

    return result;
  }
Exemplo n.º 2
0
 // implements the interface method
 public Environment createOperationContext(Environment parent, Operation operation) {
   Environment result = createEnvironment(parent);
   if (result instanceof AbstractEnvironment) {
     ((AbstractEnvironment) result).setContextOperation(operation);
   }
   OCLFactory oclFactory = parent.getOCLFactory();
   for (Parameter next : operation.getOwnedParameters()) {
     // ensure that we use the OCL primitive types wherever possible
     Variable var = oclFactory.createVariable();
     var.setName(next.getName());
     var.setType(next.getType());
     var.setRepresentedParameter(next);
     result.addElement(var.getName(), var, true);
   }
   return result;
 }