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

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


        BooleanLiteralExp oBLExp = (BooleanLiteralExp) oPropExp.getElement();
        return oBLExp.getBooleanSymbol();
      }
    }
    else if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if (oOpExp.getOperationName().compareTo("and") == 0) {
        return getBooleanValue(oOpExp.getLeft(), in_colCurrentValueAssignment) &&
        getBooleanValue(oOpExp.getRight(), in_colCurrentValueAssignment);
      } else if (oOpExp.getOperationName().compareTo("or") == 0) {
        return getBooleanValue(oOpExp.getLeft(), in_colCurrentValueAssignment) ||
        getBooleanValue(oOpExp.getRight(), in_colCurrentValueAssignment);
      } else if (oOpExp.getOperationName().compareTo("not") == 0) {
        // TODO f�r un�re Operationen neuen Typ einf�hren
        if (oOpExp.getLeft() == null)
          return !getBooleanValue(oOpExp.getRight(), in_colCurrentValueAssignment);
        if (oOpExp.getRight() == null)
          return !getBooleanValue(oOpExp.getLeft(), in_colCurrentValueAssignment);
        throw new Exception("\"not\" was not interpreted correctly in getBooleanValue()");
        //return false;
      }
      // TODO weitere Operationen einf�gen
    }
View Full Code Here


      // check if the used types are linear ordered types (else the splitting is useless)
      if(expressionContainsLinearOrderedTypes(in_oTCGOCLOperation)) {
 
        // split up "<>" in two alternatives: "<" or ">"
       
        TCGOCLOperation oFirstExp = (TCGOCLOperation) TCGOCLExpressionHelperClass
            .copyExpression(in_oTCGOCLOperation);
        oFirstExp.setOperationName("<");
        colRetValues.add(oFirstExp);
 
        TCGOCLOperation oSecondExp = (TCGOCLOperation) TCGOCLExpressionHelperClass
            .copyExpression(in_oTCGOCLOperation);
        oSecondExp.setOperationName(">");
        colRetValues.add(oSecondExp);
      }
    }
    return colRetValues;   
  }
View Full Code Here

        }
      }
    }
    else if(in_oExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
      if((expressionContainsLinearOrderedTypes(oOperation.getLeft()) == true) ||
        expressionContainsLinearOrderedTypes(oOperation.getRight()) == true)
          return true;
      }
    return false;
  }
View Full Code Here

  {
    TCGOCLExpression oExpression = null;
    if(in_oPrecondition instanceof TCGOCLOperation &&
        in_oPostcondition instanceof TCGOCLOperation)
    {
      TCGOCLOperation oPrecondition = (TCGOCLOperation)in_oPrecondition;
      TCGOCLOperation oPostcondition = (TCGOCLOperation)in_oPostcondition;
      // both conditions have the dependent property on the left side
 
//      // all missing combinations of relations cannot be evaluated
//      if((oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("<")) ||
//          (oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("<=")) ||
//          (oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("=")) ||
//          (oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("<")) ||
//          (oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals("<"))) {
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName("<");
//      }
//      else if((oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("<=")) ||
//          (oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("=")) ||
//          (oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals("<="))) {
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName("<=");
//      }
//      else if((oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals("=")) ||
//          (oPrecondition.getOperationName().equals("<>") && oPostcondition.getOperationName().equals("<>"))){
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName("=");
//      }
//      else if((oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals(">=")) ||
//          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals("=")) ||
//          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals(">="))) {
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName(">=");
//      }
//      else if((oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals(">")) ||
//          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals(">")) ||
//          (oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals("=")) ||
//          (oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals(">=")) ||
//          (oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals(">"))) {
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName(">");
//      }
//      else if((oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals("<>")) ||
//          (oPrecondition.getOperationName().equals("<>") && oPostcondition.getOperationName().equals("="))) {
//        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
//        ((TCGOCLOperation)oExpression).setOperationName("<>");       
//      }
//     
      // all missing combinations of relations cannot be evaluated
      if((oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("<=")) ||
          (oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("="))) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName("<");
      }
      else if((oPrecondition.getOperationName().equals("<") && oPostcondition.getOperationName().equals("<")) ||
          (oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("<=")) ||
          (oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("=")) ||
          (oPrecondition.getOperationName().equals("<=") && oPostcondition.getOperationName().equals("<"))) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName("<=");
      }
      else if((oPrecondition.getOperationName().equals("=") && oPostcondition.getOperationName().equals("=")) ||
          (oPrecondition.getOperationName().equals("<>") && oPostcondition.getOperationName().equals("<>"))){
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName("=");
      }
      else if((oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals(">")) ||
          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals(">=")) ||
          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals("=")) ||
          (oPrecondition.getOperationName().equals(">=") && oPostcondition.getOperationName().equals(">"))) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName(">=");
      }
      else if((oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals(">=")) ||
          (oPrecondition.getOperationName().equals(">") && oPostcondition.getOperationName().equals("="))) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName(">");
      }
      else if((oPrecondition.getOperationName().equals("<>") && oPostcondition.getOperationName().equals("="))) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        ((TCGOCLOperation)oExpression).setOperationName("<>");       
      }
     
      // got new expression -> also add copies of the left and the right part
      if(oExpression != null)
      {
        // just referencing the used sides of the original conditions is error-prone
        // -> in the following these sides are altered -> this would affect also the original conditions!
        ((TCGOCLOperation)oExpression).setLeft(copyExpression(oPostcondition.getRight()));
        ((TCGOCLOperation)oExpression).setRight(copyExpression(oPrecondition.getRight()));
        normalizeExpression(oExpression);
      }
      else if(oPrecondition.getOperationName().equals("not")) {
        TCGOCLExpression oNegatedExpression = null;
        if(oPrecondition.getLeft() != null)
          oNegatedExpression = oPrecondition.getLeft();
        if(oPrecondition.getRight() != null)
          oNegatedExpression = oPrecondition.getRight();
        oExpression = connectPreconditionAndPostcondition(oNegatedExpression, in_oPostcondition);
        oExpression = negateLogicalTCGOCLExpression(oExpression);
      }
      else if(oPostcondition.getOperationName().equals("not")) {
        TCGOCLExpression oNegatedExpression = null;
        if(oPostcondition.getLeft() != null)
          oNegatedExpression = oPostcondition.getLeft();
        if(oPostcondition.getRight() != null)
          oNegatedExpression = oPostcondition.getRight();
        oExpression = connectPreconditionAndPostcondition(in_oPrecondition, oNegatedExpression);
        oExpression = negateLogicalTCGOCLExpression(oExpression);       
      }
      else {
        System.err.println("no new expression created");
      }
    }
    else {
      // only possible for boolean variables
      if(in_oPrecondition instanceof TCGOCLAtom &&
        in_oPostcondition instanceof TCGOCLOperation) {
        TCGOCLOperation oPostOp = (TCGOCLOperation)in_oPostcondition;
        if(oPostOp.getOperationName().equals("="))
          oExpression = oPostOp.getRight();
        else {
          oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
          ((TCGOCLOperation)oExpression).setOperationName("not");
          ((TCGOCLOperation)oExpression).setRight(oPostOp.getRight());
        }
      }
      else if(in_oPrecondition instanceof TCGOCLOperation &&
        in_oPostcondition instanceof TCGOCLAtom) {
       
View Full Code Here

        TCGOCLAtom oOldAtom = (TCGOCLAtom)in_oExpression;
        oTCGOCLExpression = copyAtom(oOldAtom);
      }
      else if(in_oExpression instanceof TCGOCLOperation)
      {
        TCGOCLOperation oOldOperation = (TCGOCLOperation)in_oExpression;
        oTCGOCLExpression = copyOperation(oOldOperation);
      }
      else if(in_oExpression instanceof TCGOCLIfThenElse)
      {
        TCGOCLIfThenElse oOldIfThenElse = (TCGOCLIfThenElse)in_oExpression;
View Full Code Here

        }
        oRetValue.setFirst(oNewAtom);
      }
      else if(in_oExpression instanceof TCGOCLOperation)
      {
        TCGOCLOperation oOldOperation = (TCGOCLOperation)in_oExpression;
        TCGOCLOperation oNewOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oNewOperation.setOperation(oOldOperation.getOperation());
        oNewOperation.setOperationName(oOldOperation.getOperationName());
        oNewOperation.setTransitionContext(oOldOperation.getTransitionContext());
        Pair<TCGOCLExpression, List<TCGOCLAtom>> oFirstValue =
          copyExpression(oOldOperation.getLeft(), in_colReferences);
        oNewOperation.setLeft(oFirstValue.getFirst());
        Pair<TCGOCLExpression, List<TCGOCLAtom>> oSecondValue =
          copyExpression(oOldOperation.getRight(), in_colReferences);
        oNewOperation.setRight(oSecondValue.getFirst());

        oRetValue.setFirst(oNewOperation);
        oRetValue.getSecond().addAll(oFirstValue.getSecond());
        oRetValue.getSecond().addAll(oSecondValue.getSecond());
      }
View Full Code Here

    oNewAtom.setTransitionContext(in_oAtom.getTransitionContext());
    return oNewAtom;
  }
 
  public static TCGOCLOperation copyOperation(TCGOCLOperation in_oOperation) {
    TCGOCLOperation oNewOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
    oNewOperation.setOperation(in_oOperation.getOperation());
    oNewOperation.setOperationName(in_oOperation.getOperationName());
    oNewOperation.setTransitionContext(in_oOperation.getTransitionContext());
    oNewOperation.setLeft(copyExpression(in_oOperation.getLeft()));
    oNewOperation.setRight(copyExpression(in_oOperation.getRight()));
    return oNewOperation;
 
View Full Code Here

    EObject oReferredObject = null;
    ValueTypeRange oActualValueRange = null;
   
    // current expression is an operation
    if(in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOperationExp = (TCGOCLOperation)in_oExpression;
      // first check that the expression has no dependent elements
      if((oClassificator.getNumberOfDependentVariables() == 0) &&
          (oClassificator.getNumberOfInputParameter() == 0)) {
        ValueTypeRange oExpressionRange =
          OCLExpressionValueTypeRangeFactory.
View Full Code Here

 
 
  public static TCGOCLExpression removeUnaryMinus(TCGOCLExpression in_oExpression)
  {
    if(in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExpression;
      // unary minus
      if(isUnaryMinus(oOpExp)) {
        TCGOCLExpression oLeftOrRightExp =
          TCGOCLExpressionHelperClass.getNonNullLeftOrRight(oOpExp);
        if(!(oLeftOrRightExp instanceof TCGOCLAtom)) {
          return TCGOCLExpressionHelperClass.
            negateArithmeticalTCGOCLExpression(oLeftOrRightExp);
        }
        // if it is an atom then leave it unchanged
      }
      else {
        // special case: operation is "-" and the right side
        // is an unary minus (no matter if an atom is negated)
        if((oOpExp.getOperationName().equals("-") ||
            oOpExp.getOperationName().equals("+")) &&
            isUnaryMinus(oOpExp.getRight())) {
          oOpExp.setOperationName(sm_colCorrespondingOperations.get(oOpExp.getOperationName()));
          oOpExp.setRight(getNonNullLeftOrRight(
              (TCGOCLOperation)oOpExp.getRight()));
        }
        oOpExp.setLeft(removeUnaryMinus(oOpExp.getLeft()));
        oOpExp.setRight(removeUnaryMinus(oOpExp.getRight()));
      }
    }
    return in_oExpression;
  }
View Full Code Here

    return in_oExpression;
  }
 
  public static boolean isUnaryMinus(TCGOCLExpression in_oExpression) {
    if(in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
      return oOperation.getOperationName().equals("-") &&
        (oOperation.getLeft() == null || oOperation.getRight() == null);
    }
    return false;
  }
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.