Examples of TCGDisjunctiveNormalForm


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

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPostcondition(TCGDisjunctiveNormalForm newPostcondition, NotificationChain msgs) {
    TCGDisjunctiveNormalForm oldPostcondition = postcondition;
    postcondition = newPostcondition;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GeneratedPackage.TCG_TRANSITION__POSTCONDITION, oldPostcondition, newPostcondition);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here

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

      if(in_oTransitionInstance.getTargetNode() instanceof TCGRealNode) {
        colNodes.add((TCGRealNode)in_oTransitionInstance.getTargetNode());
        colNodes.addAll(TCGNodeHelperClass.getSuperStates(in_oTransitionInstance.getTargetNode()));
       
        for(TCGRealNode oTargetNode : colNodes) {
          TCGDisjunctiveNormalForm oDNF = ((TCGRealNode)oTargetNode).getCondition();
          if((oDNF != null) && (oDNF.getConjunctions().size() > 0))
          {
            boolean bMoreThanOneConjunction = (oDNF.getConjunctions().size() > 1);
            in_oFormattedOutput.append(in_sConditionPrefix);
           
            for(int nConjunctionCounter = 0;
              nConjunctionCounter < oDNF.getConjunctions().size();
              ++nConjunctionCounter)
            {
              TCGConjunction oConjunction = oDNF.getConjunctions().get(nConjunctionCounter);
              if(nConjunctionCounter != 0)
                in_oFormattedOutput.append(" || ");
              if(bMoreThanOneConjunction == true)
                in_oFormattedOutput.append("(");
             
View Full Code Here

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

        T result = caseTCGConjunction(tcgConjunction);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case GeneratedPackage.TCG_DISJUNCTIVE_NORMAL_FORM: {
        TCGDisjunctiveNormalForm tcgDisjunctiveNormalForm = (TCGDisjunctiveNormalForm)theEObject;
        T result = caseTCGDisjunctiveNormalForm(tcgDisjunctiveNormalForm);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case GeneratedPackage.TCGOCL_OPERATION: {
View Full Code Here

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

    {
      // transform OCL to TCGOCL
      TCGOCLExpression oTCGOCLExp = TransformOCLToTCGOCL.transformExpression(
          in_oExpression, Configuration.getOCLGuardId(), in_oContextClass);
      // transform to DNF
      TCGDisjunctiveNormalForm oDNF = ExpressionConverter.createDisjunctiveNormalForm(oTCGOCLExp);
      // add expressions for coverage criterion
      ExpressionConverter.addConjunctionsForCoverageCriterion(oDNF);
     
      // work on each conjunction
      for(TCGConjunction oConjunction : oDNF.getConjunctions())
      {
        if(conditionsInConjunctionAreContradicting(oConjunction))
        {
          bReachingTransitionBearsConflicts = true;
        }
View Full Code Here

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

      String in_sOCLKind)
  {
    TCGOCLExpression oTCGOCLExp = TransformOCLToTCGOCL.transformExpression(
        in_oOCLExpression, in_sOCLKind, in_oNamespace);
    // transform to DNF
    TCGDisjunctiveNormalForm oDNF = ExpressionConverter.createDisjunctiveNormalForm(oTCGOCLExp);
    return oDNF;
  }
View Full Code Here

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

    ArrayList<TCGNode> colNodes = new ArrayList<TCGNode>();
    // transform OCL to TCGOCL
    TCGOCLExpression oTCGOCLExp = TransformOCLToTCGOCL.transformExpression(
        in_oExpression, Configuration.getOCLPreId(), in_oContextClass);
    // transform to DNF
    TCGDisjunctiveNormalForm oDNF = ExpressionConverter.createDisjunctiveNormalForm(oTCGOCLExp);
    // add expressions for coverage criterion
    ExpressionConverter.addConjunctionsForCoverageCriterion(oDNF);

    for(TCGConjunction oConjunction : oDNF.getConjunctions())
    {
      TCGTransition oTransition = createTCGPart(in_oTCGNode, in_oOperation.getName());

      if(oTransition != null)
      {
View Full Code Here

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

      org.eclipse.uml2.uml.Class in_oContextClass)
  {
    ArrayList<TCGNode> colNodes = new ArrayList<TCGNode>();
    TCGOCLExpression oTCGOCLExp = TransformOCLToTCGOCL.transformExpression(
        in_oExpression, Configuration.getOCLPostId(), in_oContextClass);
    TCGDisjunctiveNormalForm oDNF = ExpressionConverter.createDisjunctiveNormalForm(oTCGOCLExp);
    for(TCGConjunction oConjunction : oDNF.getConjunctions())
    {
      TCGTransition oTransition = createTCGPart(in_oTCGNode, in_oOperation.getName());
      if(oTransition != null)
      {
        // remember original expression
View Full Code Here

Examples of net.sf.parteg.base.testcasetree.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

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

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPostcondition(TCGDisjunctiveNormalForm newPostcondition, NotificationChain msgs) {
    TCGDisjunctiveNormalForm oldPostcondition = postcondition;
    postcondition = newPostcondition;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GeneratedPackage.TCG_TRANSITION__POSTCONDITION, oldPostcondition, newPostcondition);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here

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

   * creates the conjunctive normal form of in_oExpression
   */
  public static TCGDisjunctiveNormalForm createDisjunctiveNormalForm(
      TCGOCLExpression in_oExpression)
  {
    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());
        TCGDisjunctiveNormalForm oRightDNF = createDisjunctiveNormalForm(oOpExp.getRight());
        return connectTwoDNFWithAnd(oLeftDNF, oRightDNF);
      }

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

//        DisjunctiveNormalForm oFirstDNF = new DisjunctiveNormalForm();
//        {
//          TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
//          TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
//          Conjunction oFirstConjunction = new Conjunction();
//          oFirstConjunction.getExpressions().add(oFirstExp);
//          oFirstConjunction.getExpressions().add(oSecondExp);
//          oFirstDNF.getConjunctions().add(oFirstConjunction);
//        }
//
//        DisjunctiveNormalForm oSecondDNF = new DisjunctiveNormalForm();
//        {
//          TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
//          negateTCGOCLExpression(oFirstExp);
//          TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
//          Conjunction oFirstConjunction = new Conjunction();
//          oFirstConjunction.getExpressions().add(oFirstExp);
//          oFirstConjunction.getExpressions().add(oSecondExp);
//          oSecondDNF.getConjunctions().add(oFirstConjunction);
//        }
//       
//        DisjunctiveNormalForm oThirdDNF = new DisjunctiveNormalForm();
//        {
//          TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
//          TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
//          negateTCGOCLExpression(oSecondExp);
//          Conjunction oFirstConjunction = new Conjunction();
//          oFirstConjunction.getExpressions().add(oFirstExp);
//          oFirstConjunction.getExpressions().add(oSecondExp);
//          oThirdDNF.getConjunctions().add(oFirstConjunction);
//        }
//       
//        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?
        if(oOpExp.getLeft() != null)
        {
          oOpExp.setLeft(negateTCGOCLExpression(oOpExp.getLeft()));
          return createDisjunctiveNormalForm(oOpExp.getLeft());
        }
        else if(oOpExp.getRight() != null)
        {
          oOpExp.setRight(negateTCGOCLExpression(oOpExp.getRight()));
          return createDisjunctiveNormalForm(oOpExp.getRight());
        }
      }

      if(oOpExp.getOperationName().compareTo("<>") == 0)
      {
        // split up "<>" in two alternatives: "<" or ">"
        TCGOCLOperation oFirstExp = (TCGOCLOperation)TestCaseGraphHelper.copyExpression(oOpExp);
        oFirstExp.setOperationName("<");
        TCGConjunction oFirstConjunction = GeneratedFactory.eINSTANCE.createTCGConjunction();
        oFirstConjunction.getExpressions().add(oFirstExp);

        TCGOCLOperation oSecondExp = (TCGOCLOperation)TestCaseGraphHelper.copyExpression(oOpExp);
        oSecondExp.setOperationName(">");
        TCGConjunction oSecondConjunction = GeneratedFactory.eINSTANCE.createTCGConjunction();
        oSecondConjunction.getExpressions().add(oSecondExp);

        TCGDisjunctiveNormalForm oNewDNF = GeneratedFactory.eINSTANCE.createTCGDisjunctiveNormalForm();
        oNewDNF.getConjunctions().add(oFirstConjunction);
        oNewDNF.getConjunctions().add(oSecondConjunction);
        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());
      TCGDisjunctiveNormalForm oThenDNF = createDisjunctiveNormalForm(oTCGIfThenElse.getThenExpression());
      TCGDisjunctiveNormalForm oSatisfiedDNF = connectTwoDNFWithAnd(oConditionDNF, oThenDNF);
     
      // condition violated
      negateTCGOCLExpression(oTCGIfThenElse.getCondition());
      TCGDisjunctiveNormalForm oNotConditionDNF = createDisjunctiveNormalForm(oTCGIfThenElse.getCondition());
      TCGDisjunctiveNormalForm oElseDNF = createDisjunctiveNormalForm(oTCGIfThenElse.getElseExpression());
      TCGDisjunctiveNormalForm oViolatedDNF = connectTwoDNFWithAnd(oNotConditionDNF, oElseDNF);
     
      return connectTwoDNFWithOr(oSatisfiedDNF, oViolatedDNF);
    }

    oDNF.getConjunctions().add(GeneratedFactory.eINSTANCE.createTCGConjunction());
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.