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

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


      TCGOCLExpression in_oShiftedExpression,
      TCGOCLExpression in_oSurroundingExpression)
  {
    if(in_oShiftedExpression != null) {
      // TODO boolesche Verkn�pfungen noch beachten
      TCGOCLExpression oExp = in_oSurroundingExpression;
      while(oExp instanceof TCGOCLOperation && ((TCGOCLOperation)oExp).getOperationName().equals("not")) {
        if(((TCGOCLOperation)oExp).getLeft() == null)
          oExp = ((TCGOCLOperation)oExp).getRight();
        else
          oExp = ((TCGOCLOperation)oExp).getLeft();
View Full Code Here


    Collection<TCGOCLExpression> colRetValues =
      new ArrayList<TCGOCLExpression>();
   
    for(int i = 0; i < colDynamicExpressions.size(); ++i) {
      for(int j = i+1; j < colDynamicExpressions.size(); ++j) {
        TCGOCLExpression oFirstExpression = colDynamicExpressions.get(i);
        TCGOCLExpression oSecondExpression = colDynamicExpressions.get(j);
       
        List<TCGOCLAtom> colFirstAtoms =
          getPassiveDependentVariablesAndInputParameters(oFirstExpression);
        List<TCGOCLAtom> colSecondAtoms =
          getPassiveDependentVariablesAndInputParameters(oSecondExpression);
View Full Code Here

          (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)) {
View Full Code Here

    StringBuffer sRetValue = new StringBuffer("");
    if(in_oExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOp = (TCGOCLOperation)in_oExpression;
      if(oOp.getOperationName().equals("not")) {
        TCGOCLExpression oNonNullExp = oOp.getLeft();
        if(oNonNullExp == null)
          oNonNullExp = oOp.getRight();
        sRetValue.append("(not " + toString(oNonNullExp));
      }
      else
View Full Code Here

      DecisionTableExpressionValueSelection in_oRow)
  {
    // create an expression copy
    DecisionTableExpressionValueSelection oNewRow = new DecisionTableExpressionValueSelection();
    // change the expression according to the value selection row (e.g. negated -> add "not")
    TCGOCLExpression oNewExpression = changeExpressionAccordingToDecisionTableRow(
        in_oExpression, in_oRow, oNewRow);

    // complete the value selection row in oNewRow for composite expressions
    boolean bTruthValue = DecisionTableRowEvaluator.evaluateExpressionWithValueAssignment(
        oNewExpression, oNewRow);
View Full Code Here

  public static TCGOCLExpression changeExpressionAccordingToDecisionTableRow(
      TCGOCLExpression in_oExpression,
      DecisionTableExpressionValueSelection in_oRow,
      DecisionTableExpressionValueSelection out_oRow)
  {
    TCGOCLExpression oTCGOCLExpression = null;
    if(in_oExpression != null)
    {
      if(in_oExpression instanceof TCGOCLAtom)
      {
        TCGOCLAtom oOldAtom = (TCGOCLAtom)in_oExpression;
        TCGOCLAtom oNewAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
        oNewAtom.setElement(oOldAtom.getElement());
        oNewAtom.setTcgParameter(oOldAtom.getTcgParameter());
        oTCGOCLExpression = oNewAtom;
      }
      else if(in_oExpression instanceof TCGOCLOperation)
      {
        in_oExpression = TCGOCLExpressionHelperClass.removeDoubleNots(in_oExpression);
       
        TCGOCLOperation oOldOperation = (TCGOCLOperation)in_oExpression;
        TCGOCLOperation oNewOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oNewOperation.setOperation(oOldOperation.getOperation());
        oNewOperation.setOperationName(oOldOperation.getOperationName());
        oNewOperation.setLeft(changeExpressionAccordingToDecisionTableRow(
            oOldOperation.getLeft(), in_oRow, out_oRow));
        oNewOperation.setRight(changeExpressionAccordingToDecisionTableRow(
            oOldOperation.getRight(), in_oRow, out_oRow));
        oTCGOCLExpression = oNewOperation;
      }
      else if(in_oExpression instanceof TCGOCLIfThenElse)
      {
        TCGOCLIfThenElse oOldIfThenElse = (TCGOCLIfThenElse)in_oExpression;
        TCGOCLIfThenElse oNewIfThenElse = GeneratedFactory.eINSTANCE.createTCGOCLIfThenElse();
        oNewIfThenElse.setClassification(oOldIfThenElse.getClassification());
        oNewIfThenElse.setCondition(changeExpressionAccordingToDecisionTableRow(
            oOldIfThenElse.getCondition(), in_oRow, out_oRow));
        oNewIfThenElse.setThenExpression(changeExpressionAccordingToDecisionTableRow(
            oOldIfThenElse.getThenExpression(), in_oRow, out_oRow));
        oNewIfThenElse.setElseExpression(changeExpressionAccordingToDecisionTableRow(
            oOldIfThenElse.getElseExpression(), in_oRow, out_oRow));
        oTCGOCLExpression = oNewIfThenElse;
      }
      oTCGOCLExpression.setClassification(in_oExpression.getClassification());
      oTCGOCLExpression.setPositiveAssignmentOfOriginal(in_oExpression.isPositiveAssignmentOfOriginal());
      oTCGOCLExpression.setOclReference(in_oExpression.getOclReference());
    }
   
    if(in_oRow.get(in_oExpression) != null)
    {
      if(in_oRow.get(in_oExpression).equals(false))
View Full Code Here

  public static TCGOCLExpression removeDoubleNots(TCGOCLExpression in_oExpression)
  {
    if(in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExpression;
      if(oOpExp.getOperationName().equals("not")) {
        TCGOCLExpression oNegatedOp = oOpExp.getLeft();
        if(oNegatedOp == null)
          oNegatedOp = oOpExp.getRight();
       
        if(oNegatedOp instanceof TCGOCLOperation) {
          TCGOCLOperation oPositiveOp = (TCGOCLOperation)oNegatedOp;
          if(oPositiveOp.getOperationName().equals("not")) {
            TCGOCLExpression oFinalExp = oPositiveOp.getLeft();
            if(oFinalExp == null)
              oFinalExp = oPositiveOp.getRight();
           
            return removeDoubleNots(oFinalExp);
          }
View Full Code Here

 
  public static TCGOCLExpression pushDownNots(TCGOCLExpression in_oExpression)
  {
    if(in_oExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExpression;
      TCGOCLExpression oLeftOrRightExp =
        TCGOCLExpressionHelperClass.getNonNullLeftOrRight(oOpExp);
      if(oOpExp.getOperationName().equals("not") &&
          !TCGOCLExpressionHelperClass.isBooleanAtom(oLeftOrRightExp)) {
        return TCGOCLExpressionHelperClass.negateLogicalTCGOCLExpression(
            oLeftOrRightExp);
View Full Code Here

  public static void normalizeExpression(TCGOCLExpression in_oCondition) {
    if (in_oCondition != null) {
      // find input parameter in condition
      TCGOCLVariableClassificator oClassificator = new TCGOCLVariableClassificator(
          in_oCondition);
      TCGOCLExpression oToBeIsolatedOnLeft = null;
      List<TCGOCLAtom> colExpression = oClassificator
          .getClassifiedElementsInExpression(VariableClassification.ACTIVE_DEPENDENT);
      if (colExpression.isEmpty()) {
        colExpression = oClassificator
          .getClassifiedElementsInExpression(VariableClassification.INPUT_PARAMETER);
View Full Code Here

   */
  public static TCGOCLExpression connectPreconditionAndPostcondition(
      TCGOCLExpression in_oPrecondition,
      TCGOCLExpression in_oPostcondition)
  {
    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);
View Full Code Here

TOP

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

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.