Package org.eclipse.ocl

Examples of org.eclipse.ocl.Query


    /**
     * @generated
     */
    protected Query getQuery() {
      Query oclQuery = null;
      if (this.queryRef != null) {
        oclQuery = (Query) this.queryRef.get();
      }
      if (oclQuery == null) {
        OCLHelper oclHelper = oclInstance.createOCLHelper();
View Full Code Here


    /**
     * @generated
     */
    protected Object doEvaluate(Object context, Map env) {
      Query oclQuery = getQuery();
      if (oclQuery == null) {
        return null;
      }
      EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
      // init environment
      for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
        Map.Entry nextEntry = (Map.Entry) it.next();
        evalEnv.replace((String) nextEntry.getKey(), nextEntry
            .getValue());
      }
      try {
        initExtentMap(context);
        Object result = oclQuery.evaluate(context);
        return (result != oclInstance.getEnvironment()
            .getOCLStandardLibrary().getOclInvalid()) ? result
            : null;
      } finally {
        evalEnv.clear();
        oclQuery.getExtentMap().clear();
      }
    }
View Full Code Here

     */
    private void initExtentMap(Object context) {
      if (!getStatus().isOK() || context == null) {
        return;
      }
      final Query queryToInit = getQuery();
      final Object extentContext = context;
      queryToInit.getExtentMap().clear();
      if (queryToInit.queryText() != null
          && queryToInit.queryText().indexOf(
              PredefinedType.ALL_INSTANCES_NAME) >= 0) {
        AbstractVisitor visitior = new AbstractVisitor() {

          private boolean usesAllInstances = false;

          public Object visitOperationCallExp(OperationCallExp oc) {
            if (!usesAllInstances) {
              usesAllInstances = PredefinedType.ALL_INSTANCES == oc
                  .getOperationCode();
              if (usesAllInstances) {
                queryToInit
                    .getExtentMap()
                    .putAll(
                        oclInstance
                            .getEvaluationEnvironment()
                            .createExtentMap(
                                extentContext));
              }
            }
            return super.visitOperationCallExp(oc);
          }
        };
        queryToInit.getExpression().accept(visitior);
      }
    }
View Full Code Here

    /**
     * @generated
     */
    protected Query getQuery() {
      Query oclQuery = null;
      if (this.queryRef != null) {
        oclQuery = (Query) this.queryRef.get();
      }
      if (oclQuery == null) {
        OCLHelper oclHelper = oclInstance.createOCLHelper();
View Full Code Here

    /**
     * @generated
     */
    protected Object doEvaluate(Object context, Map env) {
      Query oclQuery = getQuery();
      if (oclQuery == null) {
        return null;
      }
      EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
      // init environment
      for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
        Map.Entry nextEntry = (Map.Entry) it.next();
        evalEnv.replace((String) nextEntry.getKey(), nextEntry
            .getValue());
      }
      try {
        initExtentMap(context);
        Object result = oclQuery.evaluate(context);
        return (result != oclInstance.getEnvironment()
            .getOCLStandardLibrary().getOclInvalid()) ? result
            : null;
      } finally {
        evalEnv.clear();
        oclQuery.getExtentMap().clear();
      }
    }
View Full Code Here

     */
    private void initExtentMap(Object context) {
      if (!getStatus().isOK() || context == null) {
        return;
      }
      final Query queryToInit = getQuery();
      final Object extentContext = context;
      queryToInit.getExtentMap().clear();
      if (queryToInit.queryText() != null
          && queryToInit.queryText().indexOf(
              PredefinedType.ALL_INSTANCES_NAME) >= 0) {
        AbstractVisitor visitior = new AbstractVisitor() {

          private boolean usesAllInstances = false;

          public Object visitOperationCallExp(OperationCallExp oc) {
            if (!usesAllInstances) {
              usesAllInstances = PredefinedType.ALL_INSTANCES == oc
                  .getOperationCode();
              if (usesAllInstances) {
                queryToInit
                    .getExtentMap()
                    .putAll(
                        oclInstance
                            .getEvaluationEnvironment()
                            .createExtentMap(
                                extentContext));
              }
            }
            return super.visitOperationCallExp(oc);
          }
        };
        queryToInit.getExpression().accept(visitior);
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ocl.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.