Examples of TCGOCLOperation


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

 
  public static TCGOCLExpression negateArithmeticalTCGOCLExpression(
      TCGOCLExpression in_oTCGOCLExpression) {

    if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if(isUnaryMinus(oOpExp)) {
        in_oTCGOCLExpression = getNonNullLeftOrRight(oOpExp);
      }
      else {
        if(oOpExp.getOperationName().equals("*") ||
            oOpExp.getOperationName().equals("/")) {
          // just negate one of the sides
          // first look if one of the sides is a unary minus
          if(isUnaryMinus(oOpExp.getRight())) {
            oOpExp.setRight(negateArithmeticalTCGOCLExpression(oOpExp.getRight()));
          }
          else {
            oOpExp.setLeft(negateArithmeticalTCGOCLExpression(oOpExp.getLeft()));
          }
        }
        else if(oOpExp.getOperationName().equals("+") ||
            oOpExp.getOperationName().equals("-")) {
          oOpExp.setLeft(negateArithmeticalTCGOCLExpression(oOpExp.getLeft()));
          oOpExp.setOperationName(
              sm_colCorrespondingOperations.get(oOpExp.getOperationName()));
        }
        else { // ???
          oOpExp.setLeft(negateArithmeticalTCGOCLExpression(oOpExp.getLeft()));
          oOpExp.setRight(negateArithmeticalTCGOCLExpression(oOpExp.getRight()));
        }
      }
    }
    else if(in_oTCGOCLExpression instanceof TCGOCLAtom) {
      TCGOCLOperation oOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
      oOperation.setLeft(null);
      oOperation.setRight(in_oTCGOCLExpression);
      oOperation.setPositiveAssignmentOfOriginal(!in_oTCGOCLExpression.isPositiveAssignmentOfOriginal());
      oOperation.setOperationName("-");
      return oOperation;         
    }
    return in_oTCGOCLExpression;
  }
View Full Code Here

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

      TCGConjunction in_oConjunction) {
    if (!in_oConjunction.getExpressions().isEmpty()) {
      TCGOCLExpression oExpression = TCGOCLExpressionHelperClass
          .copyExpression(in_oConjunction.getExpressions().get(0));
      for (int i = 1; i < in_oConjunction.getExpressions().size(); ++i) {
        TCGOCLOperation oNewOperation = GeneratedFactory.eINSTANCE
            .createTCGOCLOperation();
        oNewOperation.setLeft(oExpression);
        oNewOperation.setOperationName("and");
        oNewOperation
            .setRight(TCGOCLExpressionHelperClass
                .copyExpression(in_oConjunction
                    .getExpressions().get(i)));
        oExpression = oNewOperation;
      }
View Full Code Here

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

        T result = caseTCGDisjunctiveNormalForm(tcgDisjunctiveNormalForm);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case GeneratedPackage.TCGOCL_OPERATION: {
        TCGOCLOperation tcgoclOperation = (TCGOCLOperation)theEObject;
        T result = caseTCGOCLOperation(tcgoclOperation);
        if (result == null) result = caseTCGOCLExpression(tcgoclOperation);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
View Full Code Here

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

        TCGOCLExpression in_oTCGOCLExpression) {
 
    // TODO die Funktionalit�t in den einzelnen ValueTypes implementieren ... ?
   
    if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      // if operation name is not in list -> do not change it (e.g.
      // addition, subtraction, ...) -> this is no negation
      String sNewName = sm_colNameMatching.get(oOpExp.getOperationName());
      if (sNewName != null) {
        TCGOCLOperation oNewOp = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
       
        if(sNewName.equals("not removed")) {
          if(oOpExp.getLeft() != null)
            return oOpExp.getLeft();
          return oOpExp.getRight();
        }
        else
          oNewOp.setOperationName(sNewName);
       
        if (oOpExp.getLeft() != null)
        {
          if(TCGOCLExpressionHelperClass.isBooleanOperation(oOpExp))
            oNewOp.setLeft(negateLogicalTCGOCLExpression(
                oOpExp.getLeft()));
          else
            oNewOp.setLeft(oOpExp.getLeft());
        }
        if (oOpExp.getRight() != null)
        {
          if(TCGOCLExpressionHelperClass.isBooleanOperation(oOpExp))
            oNewOp.setRight(negateLogicalTCGOCLExpression(
                oOpExp.getRight()));
          else
            oNewOp.setRight(oOpExp.getRight());
        }
        oNewOp.setClassification(oOpExp.getClassification());
        oNewOp.setOclReference(oOpExp.getOclReference());
        oNewOp.setOperation(oOpExp.getOperation());
        oNewOp.setPositiveAssignmentOfOriginal(!oOpExp.isPositiveAssignmentOfOriginal());
        return oNewOp;
      }
    }
    else if(in_oTCGOCLExpression instanceof TCGOCLAtom) {
      if(TCGOCLExpressionHelperClass.isBooleanAtom(in_oTCGOCLExpression)) {
        TCGOCLOperation oOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oOperation.setLeft(null);
        oOperation.setRight(in_oTCGOCLExpression);
        oOperation.setPositiveAssignmentOfOriginal(!in_oTCGOCLExpression.isPositiveAssignmentOfOriginal());
        oOperation.setOperationName("not");
        return oOperation;         
      }
    }
    return in_oTCGOCLExpression;
  }
View Full Code Here

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

      if (oPropExp.getElement() instanceof RealLiteralExp) {
        RealLiteralExp oRealExp = (RealLiteralExp) oPropExp.getElement();
        return oRealExp.getRealSymbol();
      }
    } else if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if (oOpExp.getOperationName().compareTo("+") == 0) {
        return getDoubleValue(oOpExp.getLeft()) + getDoubleValue(oOpExp.getRight());
      } else if (oOpExp.getOperationName().compareTo("-") == 0) {
        // TODO f�r un�re Operationen neuen Typ einf�hren
        if (oOpExp.getLeft() == null)
          return -getDoubleValue(oOpExp.getRight());
        if (oOpExp.getRight() == null)
          return -getDoubleValue(oOpExp.getLeft());
        return getDoubleValue(oOpExp.getLeft()) - getDoubleValue(oOpExp.getRight());
      } else if (oOpExp.getOperationName().compareTo("*") == 0) {
        return getDoubleValue(oOpExp.getLeft()) * getDoubleValue(oOpExp.getRight());
      } else if (oOpExp.getOperationName().compareTo("/") == 0) {
        return getDoubleValue(oOpExp.getLeft()) / getDoubleValue(oOpExp.getRight());
      }
      // TODO weitere Operationen einf�gen
    }
    return 0;
  }
View Full Code Here

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

      if (oPropExp.getElement() instanceof RealLiteralExp) {
        RealLiteralExp oRealExp = (RealLiteralExp) oPropExp.getElement();
        return oRealExp.getRealSymbol();
      }
    } else if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if (oOpExp.getOperationName().compareTo("+") == 0) {
        return getDoubleValue(oOpExp.getLeft(), in_colValueAssignments) +
        getDoubleValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("-") == 0) {
        // TODO f�r un�re Operationen neuen Typ einf�hren
        if (oOpExp.getLeft() == null)
          return -getDoubleValue(oOpExp.getRight(), in_colValueAssignments);
        if (oOpExp.getRight() == null)
          return -getDoubleValue(oOpExp.getLeft(), in_colValueAssignments);
        return getDoubleValue(oOpExp.getLeft(), in_colValueAssignments) -
        getDoubleValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("*") == 0) {
        return getDoubleValue(oOpExp.getLeft(), in_colValueAssignments) *
        getDoubleValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("/") == 0) {
        return getDoubleValue(oOpExp.getLeft(), in_colValueAssignments) /
        getDoubleValue(oOpExp.getRight(), in_colValueAssignments);
      }
      // TODO weitere Operationen einf�gen
    }
    return null;
  }
View Full Code Here

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

      if (oPropExp.getElement() instanceof IntegerLiteralExp) {
        IntegerLiteralExp oIntExp = (IntegerLiteralExp) oPropExp.getElement();
        return oIntExp.getIntegerSymbol();
      }     
    } else if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if (oOpExp.getOperationName().compareTo("+") == 0) {
        return getIntegerValue(oOpExp.getLeft()) + getIntegerValue(oOpExp.getRight());
//        Integer i1 = getIntegerValue(oOpExp.getLeft());
//        Integer i2 = getIntegerValue(oOpExp.getRight());
//        if(i1 == null || i2 == null)
//          return null;
//        return i1 + i2;
      } else if (oOpExp.getOperationName().compareTo("-") == 0) {
        // TODO f�r un�re Operationen neuen Typ einf�hren
        if (oOpExp.getLeft() == null)
          return -getIntegerValue(oOpExp.getRight());
        if (oOpExp.getRight() == null)
          return -getIntegerValue(oOpExp.getLeft());
        return getIntegerValue(oOpExp.getLeft()) - getIntegerValue(oOpExp.getRight());
      } else if (oOpExp.getOperationName().compareTo("*") == 0) {
        return getIntegerValue(oOpExp.getLeft()) * getIntegerValue(oOpExp.getRight());
      } else if (oOpExp.getOperationName().compareTo("/") == 0) {
        int left = getIntegerValue(oOpExp.getLeft());
        int right = getIntegerValue(oOpExp.getRight());
        if (left % right != 0) {
          setLastIntegerComputationWasIncorrect(true);
        }
        return left / right;
//        return getIntegerValue(oOpExp.getLeft()) / getIntegerValue(oOpExp.getRight());
View Full Code Here

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

      }

      return getIntegerValue(in_oTCGOCLExpression);
 
    } else if (in_oTCGOCLExpression instanceof TCGOCLOperation) {
      TCGOCLOperation oOpExp = (TCGOCLOperation) in_oTCGOCLExpression;
      if (oOpExp.getOperationName().compareTo("+") == 0) {
        return getIntegerValue(oOpExp.getLeft(), in_colValueAssignments) +
        getIntegerValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("-") == 0) {
        // TODO f�r un�re Operationen neuen Typ einf�hren
        if (oOpExp.getLeft() == null)
          return -getIntegerValue(oOpExp.getRight(), in_colValueAssignments);
        if (oOpExp.getRight() == null)
          return -getIntegerValue(oOpExp.getLeft(), in_colValueAssignments);
        return getIntegerValue(oOpExp.getLeft(), in_colValueAssignments) -
        getIntegerValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("*") == 0) {
        return getIntegerValue(oOpExp.getLeft(), in_colValueAssignments) *
        getIntegerValue(oOpExp.getRight(), in_colValueAssignments);
      } else if (oOpExp.getOperationName().compareTo("/") == 0) {
        return getIntegerValue(oOpExp.getLeft(), in_colValueAssignments) /
        getIntegerValue(oOpExp.getRight(), in_colValueAssignments);
      }
      // TODO weitere Operationen einf�gen
    }
    return null;
  }
View Full Code Here

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

        T result = caseTCGDisjunctiveNormalForm(tcgDisjunctiveNormalForm);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case GeneratedPackage.TCGOCL_OPERATION: {
        TCGOCLOperation tcgoclOperation = (TCGOCLOperation)theEObject;
        T result = caseTCGOCLOperation(tcgoclOperation);
        if (result == null) result = caseTCGOCLExpression(tcgoclOperation);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
View Full Code Here

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

        if(oAtomExp.getElement().equals(in_oProperty))
        {
          oClassificator.shiftSubexpressionToTheLeft(oActiveExpression);
          if(oClassificator.getExpression() instanceof TCGOCLOperation)
          {
            TCGOCLOperation oOperation = (TCGOCLOperation)oClassificator.getExpression();
            TCGOCLVariableClassificator oRightSubClassificator = new TCGOCLVariableClassificator(oOperation.getRight());
           
            // does the right side contain an active dependent element? -> schwierig -> daf�r oActiveExpression und
            // oActiveSubExpression auseinanderhalten !
            //TCGOCLExpression oActiveSubExpression = oRightSubClassificator.getClassifiedElementInExpression(VariableClassification.ACTIVE_DEPENDENT);
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.