Package net.sf.parteg.base.testcasegraph.generated

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


                in_oOpExp.getOperationName()));
        in_oOpExp.setRight(
            negateArithmeticalTCGOCLExpression(in_oOpExp.getRight()));
      }
      else {
        TCGOCLOperation oOpLeftExp = (TCGOCLOperation)in_oOpExp.getLeft();
        OCLTreeExpressionFindObjectVisitor oVisitor =
          new OCLTreeExpressionFindObjectVisitor(in_oVariable);
        OCLTreeExpressionIterator.run(oOpLeftExp.getLeft(), oVisitor);
        // try to shift the variable to the left side of the left expression
        // variable is on local right side of the left expression
        // -> exchange on left hand side left and right
        if(!oVisitor.isFound()) {
          // exchange sides
          TCGOCLExpression oLeftSide = oOpLeftExp.getLeft();
          oOpLeftExp.setLeft(oOpLeftExp.getRight());
          oOpLeftExp.setRight(oLeftSide);
         
          // influence relation operator correspondingly
          if(oOpLeftExp.getOperationName().equals("+") ||
              oOpLeftExp.getOperationName().equals("*")) {
            // nothing - written just for completeness
          }
          else if(oOpLeftExp.getOperationName().equals("-")) {
            in_oOpExp.setOperationName(
                sm_colCorrespondingRelations.get(
                    in_oOpExp.getOperationName()));
            in_oOpExp.setRight(
                TCGOCLExpressionHelperClass.negateArithmeticalTCGOCLExpression(
                    in_oOpExp.getRight()));
          }
          else if(oOpLeftExp.getOperationName().equals("/"))
          {
            // TODO #### Fallunterscheidung einbauen und evtl. mehrere m�gliche
            // Ausdr�cke zur�ckgeben
          }
          // check again
          OCLTreeExpressionIterator.run(oOpLeftExp.getLeft(), oVisitor);
        }
       
        // not "else" -> value is computed again at the last statement
       
        // variable is on local left side of the left expression
        // -> transfer local right side of left expression to the right expression
        if(oVisitor.isFound()) {
          TCGOCLExpression oLeftSide = oOpLeftExp.getLeft();
          oOpLeftExp.setLeft(in_oOpExp.getRight());
          in_oOpExp.setRight(oOpLeftExp);
          in_oOpExp.setLeft(oLeftSide);
          // exclude the case that we work with an unary minus or a not
          if(!(oOpLeftExp.getRight() == null &&
            (oOpLeftExp.getOperationName().equals("-") ||
            oOpLeftExp.getOperationName().equals("not")))) {
           
            oOpLeftExp.setOperationName(sm_colCorrespondingOperations.get(
                oOpLeftExp.getOperationName()));
            // multiplication or division with a negative number?
            if((oOpLeftExp.getOperationName().compareTo("*") == 0) ||
              (oOpLeftExp.getOperationName().compareTo("/") == 0)) {
              // moved expression was negative
              if(expressionIsNegative(oOpLeftExp.getRight()))
              {
                // exchange relation symbol
                in_oOpExp.setOperationName(sm_colCorrespondingRelations.get(in_oOpExp.getOperationName()));
              }
            }
View Full Code Here


          oExp = ((TCGOCLOperation)oExp).getLeft();
      }
 
      if(oExp instanceof TCGOCLOperation)
      {
        TCGOCLOperation oOpExp = (TCGOCLOperation)oExp;
        if(oOpExp.getLeft() != null)
        {
          // first step: get variable on the left side
          OCLTreeExpressionFindObjectVisitor oVisitor =
            new OCLTreeExpressionFindObjectVisitor(in_oShiftedExpression);
          OCLTreeExpressionIterator.run(oOpExp.getLeft(), oVisitor);
          // variable was not found on the left-hand side -> exchange both sides of the expression
          if(!oVisitor.isFound())
          {
            exchangeSidesOfExpression(oOpExp);
          }
View Full Code Here

 
  private static boolean expressionIsNegative(TCGOCLExpression in_oExpression)
  {
    if(in_oExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExpression;
      if((oOpExp.getLeft() == null || oOpExp.getRight() == null) &&
          (((Operation)oOpExp.getOperation()).getName().compareTo("-") == 0))
      {
        return true;
      }
    }
    // TODO ausrechnen ob in_oExpression einen negativen Wert darstellt
View Full Code Here

      }
    }
    else if (in_oCheckedExpression instanceof TCGOCLOperation &&
        in_oWarrantedExpression instanceof TCGOCLOperation) {
     
      TCGOCLOperation oCheckedOperation = (TCGOCLOperation)in_oCheckedExpression;
      TCGOCLOperation oWarrantedOperation = (TCGOCLOperation)in_oWarrantedExpression;
     
      if(!oCheckedOperation.getOperationName().equals(
          oWarrantedOperation.getOperationName())) {
        return false;
      }
      if(!expressionsAreEqual(oCheckedOperation.getLeft(), oWarrantedOperation.getLeft())) {
        return false;
      }
      if(!expressionsAreEqual(oCheckedOperation.getRight(), oWarrantedOperation.getRight())) {
        return false;
      }
      return true;
    }
    return false;
View Full Code Here

   
    // einfachster Fall: beide Seiten sind gleich, aber die Relationszeichen
    // sind widerspr�chlich - reicht f�r Testziele
    if(in_oFirstExpression instanceof TCGOCLOperation &&
        in_oSecondExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oFirstOp = (TCGOCLOperation)in_oFirstExpression;
      TCGOCLOperation oSecondOp = (TCGOCLOperation)in_oSecondExpression;
     
      if(expressionsAreEqual(oFirstOp.getRight(), oSecondOp.getRight()) &&
          operationNamesAreContradicting(oFirstOp.getOperationName(),
              oSecondOp.getOperationName())) {
        return true;
      }
    }
   
    return false;
View Full Code Here

//                  break ATOM;
                }
              }
            }
            else if(oExpression instanceof TCGOCLOperation) {
              TCGOCLOperation oOperation = (TCGOCLOperation)oExpression;
              // shift atom to the left
              shiftSubexpressionToTheLeft(oInterestingAtom, oOperation);
              // now investigate the right side of the expression
              // combine with other expressions of the list
              colTmpExpressionsCopy.remove(oOperation);
             
              Map<TCGOCLAtom, ValueTypeRange> colTemporaryAtomToVTR
                = new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
              colTemporaryAtomToVTR.putAll(in_colAtomToVTR);
              colTemporaryAtomToVTR.remove(oAtom);
              //colTemporaryAtomToVTR.remove(in_oAtom);
              // colTemporaryEPIToAtoms contains all remaining epi to atoms
   
              Map<TCGOCLAtom, ValueTypeRange> colAtomToVTR =
                new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
              // restart the evaluation for each ATOM of the right side
              OCLTreeTCGOCLAtomCollectorVisitor oAtomCollector =
                new OCLTreeTCGOCLAtomCollectorVisitor();
              OCLTreeExpressionIterator.run(oOperation.getRight(), oAtomCollector);
              for(TCGOCLAtom oExpAtom : oAtomCollector.getExpressions()) {
                // check only atoms that reference variables or properties
                if(oExpAtom.getElement() instanceof Variable ||
                    oExpAtom.getElement() instanceof Property) {
                  List<TCGOCLAtom> colExpAtoms = new ArrayList<TCGOCLAtom>();
View Full Code Here

          oSecondAtom = oTmpAtom;
          break;
        }
      }
      if(oSecondAtom != null) {
        TCGOCLOperation oCheckedOperation =
          (TCGOCLOperation)in_oCheckedExpression;
        TCGOCLOperation oWarrantedOperation =
          (TCGOCLOperation)in_oWarrantedExpression;

        shiftSubexpressionToTheLeft(oFirstAtom, oCheckedOperation);
        shiftSubexpressionToTheLeft(oSecondAtom, oWarrantedOperation);
        // compare right side of expressions
        TCGOCLExpression oCheckedExpression = oCheckedOperation.getRight();
        TCGOCLExpression oWarrantedExpression = oWarrantedOperation.getRight();
        removeUnaryMinus(oCheckedExpression);
        removeUnaryMinus(oWarrantedExpression);
        // expressions equal? -> compare the exact syntax of both
        if(oCheckedOperation.getOperationName().equals(oWarrantedOperation.getOperationName()) &&
            expressionsAreEqual(oCheckedExpression, oWarrantedExpression)) {
          return true;
        }
//        expressionsContainTheSameAtoms
       
        if(oWarrantedExpression instanceof TCGOCLOperation &&
            oCheckedExpression instanceof TCGOCLOperation) {
          // TODO: how to compare arbitrary expressions?
          exchangeSidesOfExpression(
            (TCGOCLOperation)oWarrantedExpression);
          removeUnaryMinus(oWarrantedExpression);
          if(oCheckedOperation.getOperationName().equals(oWarrantedOperation.getOperationName()) &&
              expressionsAreEqual(oCheckedExpression, oWarrantedExpression)) {
            return true;
          }
        }
        else {
          return oCheckedOperation.getOperationName().equals(
              oWarrantedOperation.getOperationName()) &&
            expressionsCanBeTransformedIntoEachOther(
              oWarrantedExpression, oCheckedExpression);
        }
      }
    }
View Full Code Here

TOP

Related Classes of net.sf.parteg.base.testcasegraph.generated.TCGOCLOperation

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.