Examples of TCGDisjunctiveNormalForm


Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

    return oDNF;
  }

  public static TCGDisjunctiveNormalForm copyDNFDeep(TCGDisjunctiveNormalForm in_oDNF)
  {
    TCGDisjunctiveNormalForm oDNF = GeneratedFactory.eINSTANCE.createTCGDisjunctiveNormalForm();
    if(in_oDNF != null) {
      for(TCGConjunction oConjunction : in_oDNF.getConjunctions())
      {
        oDNF.getConjunctions().add(TCGConjunctionHelperClass.copyConjunctionDeep(oConjunction));     
      }
      oDNF.setOriginalExpression(TCGOCLExpressionHelperClass.copyExpression(in_oDNF.getOriginalExpression()));
    }
    return oDNF;
  }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

    {
      // abstract syntax tree of guard: OCLExpression
      OCLExpression oExpression = OCLParser.parseCondition(
          in_sOCLCondition, in_oNamespace, in_sOCLKindId);
      // create corresponding DNF with TCGOCLExpressions
      TCGDisjunctiveNormalForm oDNF =
        TCGDisjunctiveNormalFormHelperClass.createDNFForOCLExpression(
            oExpression, in_oNamespace, in_oContextClass,
            in_sOCLKindId, in_bSplitInequations);
     
      TCGDisjunctiveNormalFormHelperClass.removeDoubleNots(oDNF);
      TCGConjunctionHelperClass.removeContradictingConjunctions(
          oDNF.getConjunctions());
      // hier kann nicht mit "<>" umgegangen werden,
      // "<>" darf hier aber noch nicht aufgel�st werden! (wegen TestGoals)
//      TCGConjunctionHelperClass.removeRedundantExpressionsInConjunctions(
//          oDNF.getConjunctions());
//      TCGConjunctionHelperClass.removeRedundantConjunctions(
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

   */
  public static TCGDisjunctiveNormalForm createDisjunctiveNormalForm(
      TCGOCLExpression in_oExpression,
      boolean in_bSplitInequations) {
   
    TCGDisjunctiveNormalForm oDNF = GeneratedFactory.eINSTANCE
        .createTCGDisjunctiveNormalForm();
    if (in_oExpression == null)
      return oDNF;

    if (in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oExpression;

      // TODO f�r alle andere booleschen Operatoren erweitern
      if (oOpExp.getOperationName().compareTo("and") == 0) {
        TCGDisjunctiveNormalForm oLeftDNF = createDisjunctiveNormalForm(oOpExp
            .getLeft(), in_bSplitInequations);
        TCGDisjunctiveNormalForm oRightDNF = createDisjunctiveNormalForm(oOpExp
            .getRight(), in_bSplitInequations);
        return connectTwoDNFWithAnd(oLeftDNF, oRightDNF);
      }

      if (oOpExp.getOperationName().compareTo("or") == 0) {
//        TCGDisjunctiveNormalForm oLeftDNF = createDisjunctiveNormalForm(oOpExp
//            .getLeft(), in_bSplitInequations);
//        TCGDisjunctiveNormalForm oRightDNF = createDisjunctiveNormalForm(oOpExp
//            .getRight(), in_bSplitInequations);
//        return connectTwoDNFWithOr(oLeftDNF, oRightDNF);

         TCGDisjunctiveNormalForm oFirstDNF = null;
         {
           TCGOCLExpression oFirstExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getLeft());
           TCGOCLExpression oSecondExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getRight());
           oFirstDNF = connectTwoDNFWithAnd(
               createDisjunctiveNormalForm(oFirstExp, in_bSplitInequations),
               createDisjunctiveNormalForm(oSecondExp, in_bSplitInequations));
         }
       
         TCGDisjunctiveNormalForm oSecondDNF = null;
         {
           TCGOCLExpression oFirstExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getLeft());
           oFirstExp = net.sf.parteg.base.testcasegraph.helperclasses.TCGOCLExpressionHelperClass.negateLogicalTCGOCLExpression(oFirstExp);
           TCGOCLExpression oSecondExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getRight());
           oSecondDNF = connectTwoDNFWithAnd(
               createDisjunctiveNormalForm(oFirstExp, in_bSplitInequations),
               createDisjunctiveNormalForm(oSecondExp, in_bSplitInequations));
         }
               
         TCGDisjunctiveNormalForm oThirdDNF = null;
         {
           TCGOCLExpression oFirstExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getLeft());
           TCGOCLExpression oSecondExp =
             TCGOCLExpressionHelperClass.copyExpression(oOpExp.getRight());
           oSecondExp = net.sf.parteg.base.testcasegraph.helperclasses.TCGOCLExpressionHelperClass.negateLogicalTCGOCLExpression(oSecondExp);
           oThirdDNF = connectTwoDNFWithAnd(
               createDisjunctiveNormalForm(oFirstExp, in_bSplitInequations),
               createDisjunctiveNormalForm(oSecondExp, in_bSplitInequations));
         }
               
         return connectTwoDNFWithOr(oFirstDNF,
             connectTwoDNFWithOr(oSecondDNF, oThirdDNF));
      }

      if (oOpExp.getOperationName().compareTo("not") == 0) {
        // negation has to be applicated to all sub-expressions
        // TODO: introduce unary operation - which side holds the
        // information?
        TCGOCLExpression oNegatedExpression = null;
        if (oOpExp.getLeft() != null) {
          oNegatedExpression = oOpExp.getLeft();
        } else if (oOpExp.getRight() != null) {
          oNegatedExpression = oOpExp.getRight();
        }
        if(TCGOCLExpressionHelperClass.isBooleanAtom(oNegatedExpression)) {
          oDNF.getConjunctions().add(
              GeneratedFactory.eINSTANCE.createTCGConjunction());
          oDNF.getConjunctions().get(0).getExpressions().add(
              TCGOCLExpressionHelperClass.copyExpression(in_oExpression));
          return oDNF;
        }
        else {
//          oOpExp.setLeft(negateTCGOCLExpression(oNegatedExpression));
//          return createDisjunctiveNormalForm(oOpExp.getLeft(), in_bSplitInequations);
          oNegatedExpression = net.sf.parteg.base.testcasegraph.helperclasses.TCGOCLExpressionHelperClass.negateLogicalTCGOCLExpression(oNegatedExpression);
          return createDisjunctiveNormalForm(oNegatedExpression, in_bSplitInequations);
        }
      }

      // split equations only if necessary
      if(in_bSplitInequations == true)
      {
        // operation name = "<>"
        TCGDisjunctiveNormalForm oNewDNF = TCGOCLExpressionHelperClass.splitUpInequationToDNF(oOpExp);
        if(oNewDNF != null)
          return oNewDNF;
      }

      /*
       * if(oOpExp.getOperationName().compareTo("not removed") == 0) {
       * if(oOpExp.getLeft() != null) { return
       * createDisjunctiveNormalForm(oOpExp.getLeft()); } else
       * if(oOpExp.getRight() != null) { return
       * createDisjunctiveNormalForm(oOpExp.getRight()); } }
       */
    } else if (in_oExpression instanceof TCGOCLIfThenElse) {
      TCGOCLIfThenElse oTCGIfThenElse = (TCGOCLIfThenElse) in_oExpression;

      // condition satisfied
      TCGDisjunctiveNormalForm oConditionDNF = createDisjunctiveNormalForm(oTCGIfThenElse
          .getCondition(), in_bSplitInequations);
      TCGDisjunctiveNormalForm oThenDNF = createDisjunctiveNormalForm(oTCGIfThenElse
          .getThenExpression(), in_bSplitInequations);
      TCGDisjunctiveNormalForm oSatisfiedDNF = connectTwoDNFWithAnd(
          oConditionDNF, oThenDNF);

      // condition violated
      oTCGIfThenElse.setCondition(net.sf.parteg.base.testcasegraph.helperclasses.TCGOCLExpressionHelperClass.negateLogicalTCGOCLExpression(oTCGIfThenElse.getCondition()));
      TCGDisjunctiveNormalForm oNotConditionDNF = createDisjunctiveNormalForm(oTCGIfThenElse
          .getCondition(), in_bSplitInequations);
      TCGDisjunctiveNormalForm oElseDNF = createDisjunctiveNormalForm(oTCGIfThenElse
          .getElseExpression(), in_bSplitInequations);
      TCGDisjunctiveNormalForm oViolatedDNF = connectTwoDNFWithAnd(
          oNotConditionDNF, oElseDNF);

      return connectTwoDNFWithOr(oSatisfiedDNF, oViolatedDNF);
    }

View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

          }
        }
        if(bFoundInequation == true)
        {
          oDNF.getConjunctions().remove(oRemovedConjunctions);
          TCGDisjunctiveNormalForm oNewDNF = copyDNFDeep(oDNF);
          oDNF.getConjunctions().add(colAddedConjunctions.get(0));
          oNewDNF.getConjunctions().add(colAddedConjunctions.get(1));
         
          colRetValues.add(oNewDNF);
          break;
        }
      }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

  //    TCGOCLExpression oExpression = in_oDNF.getOriginalExpression();
    oExpression = TCGOCLExpressionHelperClass.
      negateLogicalTCGOCLExpression(oExpression);
  //    System.out.println("*** *** ***");
  //    System.out.println(TCGOCLExpressionHelperClass.toString(oExpression));
    TCGDisjunctiveNormalForm oRetValue = createDisjunctiveNormalForm(oExpression, in_bSplitInequations);
    // mark all contained conjunctions as negative elements
    for(TCGConjunction oConjunction : oRetValue.getConjunctions())
    {
      oConjunction.setPositiveSubExpressionOfOriginal(false);
    }
    return oRetValue;
  }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

  }
 
  public static TCGDisjunctiveNormalForm connectTwoDNFWithAnd(
      TCGDisjunctiveNormalForm in_oLeftDNF,
      TCGDisjunctiveNormalForm in_oRightDNF) {
    TCGDisjunctiveNormalForm oResultDNF = GeneratedFactory.eINSTANCE
        .createTCGDisjunctiveNormalForm();
    for (TCGConjunction oLeftConjunction : in_oLeftDNF.getConjunctions()) {
      for (TCGConjunction oRightConjunction : in_oRightDNF
          .getConjunctions()) {
        TCGConjunction oNewConjunction = GeneratedFactory.eINSTANCE
            .createTCGConjunction();
        oNewConjunction.getExpressions().addAll(
            oLeftConjunction.getExpressions());
        oNewConjunction.getExpressions().addAll(
            oRightConjunction.getExpressions());
        oResultDNF.getConjunctions().add(oNewConjunction);
      }
    }
    return oResultDNF;
  }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

  }
 
  public static TCGDisjunctiveNormalForm connectTwoDNFWithOr(
      TCGDisjunctiveNormalForm in_oLeftDNF,
      TCGDisjunctiveNormalForm in_oRightDNF) {
    TCGDisjunctiveNormalForm oResultDNF = GeneratedFactory.eINSTANCE
        .createTCGDisjunctiveNormalForm();
    for (TCGConjunction oLeftConjunction : in_oLeftDNF.getConjunctions()) {
      oResultDNF.getConjunctions().add(oLeftConjunction);
    }
    for (TCGConjunction oRightConjunction : in_oRightDNF.getConjunctions()) {
      oResultDNF.getConjunctions().add(oRightConjunction);
    }
    return oResultDNF;
  }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

     
      // split equations only if necessary
      if(in_bSplitInequations == true)
      {
        // operation name = "<>"
        TCGDisjunctiveNormalForm oNewDNF = TCGOCLExpressionHelperClass.splitUpInequationToDNF(oOpExp);
        connectTwoDNFWithAnd(out_oDNF, oNewDNF);
//        in_oRow.get(oOpExp);
        return;
      }
    }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

      boolean in_bSplitInequations)
  {
    TCGOCLExpression oTCGOCLExp = TransformOCLToTCGOCL.transformExpression(
        in_oOCLExpression, in_sOCLKind, in_oNamespace, in_oContextClass);
    // transform to DNF
    TCGDisjunctiveNormalForm oDNF =
      createDisjunctiveNormalForm(oTCGOCLExp, in_bSplitInequations);
    oTCGOCLExp = TCGOCLExpressionHelperClass.pushDownNots(oTCGOCLExp);
    oDNF.setOriginalExpression(oTCGOCLExp);
    return oDNF;
  }
View Full Code Here

Examples of net.sf.parteg.base.testcasegraph.generated.TCGDisjunctiveNormalForm

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPrecondition(TCGDisjunctiveNormalForm newPrecondition, NotificationChain msgs) {
    TCGDisjunctiveNormalForm oldPrecondition = precondition;
    precondition = newPrecondition;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GeneratedPackage.TCG_TRANSITION__PRECONDITION, oldPrecondition, newPrecondition);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.