Examples of TCGOCLOperation


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

            in_oPrecondition, oAtomPostExp.getElement()))
        {
          oClassificator.shiftSubexpressionToTheLeft(oActivePostExpression);
          if(oClassificator.getExpression() instanceof TCGOCLOperation)
          {
            TCGOCLOperation oOperation =
              (TCGOCLOperation)oClassificator.getExpression();
            TCGOCLVariableClassificator oRightSubClassificator =
              new TCGOCLVariableClassificator(oOperation.getRight());
           
            // does the right side contain a passive dependent element?
            TCGOCLExpression oPassiveDependentSubExpression = oRightSubClassificator.getClassifiedElementInExpression(VariableClassification.PASSIVE_DEPENDENT);
            TCGOCLExpression oInputParameterSubExpression = oRightSubClassificator.getClassifiedElementInExpression(VariableClassification.INPUT_PARAMETER);
            if((oPassiveDependentSubExpression != null) || (oInputParameterSubExpression != null))
View Full Code Here

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

 
  private static TCGOCLExpression connectPreconditionAndPostcondition(
      TCGOCLExpression in_oPrecondition,
      TCGOCLExpression in_oPostcondition)
  {
    TCGOCLOperation 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().compareTo("<") == 0 && oPostcondition.getOperationName().compareTo("<") == 0) ||
          (oPrecondition.getOperationName().compareTo("<") == 0 && oPostcondition.getOperationName().compareTo("<=") == 0) ||
          (oPrecondition.getOperationName().compareTo("<") == 0 && oPostcondition.getOperationName().compareTo("=") == 0) ||
          (oPrecondition.getOperationName().compareTo("<=") == 0 && oPostcondition.getOperationName().compareTo("<") == 0) ||
          (oPrecondition.getOperationName().compareTo("=") == 0 && oPostcondition.getOperationName().compareTo("<") == 0)) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oExpression.setOperationName("<");
      }
      else if((oPrecondition.getOperationName().compareTo("<=") == 0 && oPostcondition.getOperationName().compareTo("<=") == 0) ||
          (oPrecondition.getOperationName().compareTo("<=") == 0 && oPostcondition.getOperationName().compareTo("=") == 0) ||
          (oPrecondition.getOperationName().compareTo("=") == 0 && oPostcondition.getOperationName().compareTo("<=") == 0)) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oExpression.setOperationName("<=");
      }
      else if(oPrecondition.getOperationName().compareTo("=") == 0 && oPostcondition.getOperationName().compareTo("=") == 0) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oExpression.setOperationName("=");
      }
      else if((oPrecondition.getOperationName().compareTo("=") == 0 && oPostcondition.getOperationName().compareTo(">=") == 0) ||
          (oPrecondition.getOperationName().compareTo(">=") == 0 && oPostcondition.getOperationName().compareTo("=") == 0) ||
          (oPrecondition.getOperationName().compareTo(">=") == 0 && oPostcondition.getOperationName().compareTo(">=") == 0)) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        oExpression.setOperationName(">=");
      }
      else if((oPrecondition.getOperationName().compareTo("=") == 0 && oPostcondition.getOperationName().compareTo(">") == 0) ||
          (oPrecondition.getOperationName().compareTo(">=") == 0 && oPostcondition.getOperationName().compareTo(">") == 0) ||
          (oPrecondition.getOperationName().compareTo(">") == 0 && oPostcondition.getOperationName().compareTo("=") == 0) ||
          (oPrecondition.getOperationName().compareTo(">") == 0 && oPostcondition.getOperationName().compareTo(">=") == 0) ||
          (oPrecondition.getOperationName().compareTo(">") == 0 && oPostcondition.getOperationName().compareTo(">") == 0)) {
        oExpression = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        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!
        oExpression.setLeft(copyExpression(oPostcondition.getRight()));
        oExpression.setRight(copyExpression(oPrecondition.getRight()));
        ExpressionConverter.normalizeExpression(oExpression);
      }
    }   
    return oExpression;
View Full Code Here

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

        oNewAtom.setTcgParameter(oOldAtom.getTcgParameter());
        oTCGOCLExpression = 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.setLeft(copyExpression(oOldOperation.getLeft()));
        oNewOperation.setRight(copyExpression(oOldOperation.getRight()));
        oTCGOCLExpression = oNewOperation;
      }
      oTCGOCLExpression.setClassification(in_oExpression.getClassification());
      oTCGOCLExpression.setOclReference(in_oExpression.getOclReference());
    }
View Full Code Here

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

          (oClassificator.getNumberOfInputParameter() == 0))
      {
        try {
          if(oExpression instanceof TCGOCLOperation)
          {
            TCGOCLOperation oOperation = (TCGOCLOperation)oExpression;
            double nLeftValue = ExpressionConverter.getValue(oOperation.getLeft());
            double nRightValue = ExpressionConverter.getValue(oOperation.getRight());
            if((oOperation.getOperationName().compareTo("<") == 0) && (nLeftValue >= nRightValue))
              return true;
            if((oOperation.getOperationName().compareTo("<=") == 0) && (nLeftValue > nRightValue))
              return true;
            if((oOperation.getOperationName().compareTo("=") == 0) && (nLeftValue != nRightValue))
              return true;
            if((oOperation.getOperationName().compareTo(">=") == 0) && (nLeftValue < nRightValue))
              return true;
            if((oOperation.getOperationName().compareTo(">") == 0) && (nLeftValue <= nRightValue))
              return true;
          }
        }
        catch(Exception e)
        {
View Full Code Here

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

    {
      return ((TCGOCLAtom)in_oOCLExpression).getElement().equals(in_oReferencedObject);
    }
    else if(in_oOCLExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oOCLExpression;
      return conditionContainsReferenceToObject(oOpExp.getLeft(), in_oReferencedObject) ||
        conditionContainsReferenceToObject(oOpExp.getRight(), in_oReferencedObject);
    }
    else if(in_oOCLExpression instanceof TCGOCLIfThenElse)
    {
      TCGOCLIfThenElse oIfThenElseExp = (TCGOCLIfThenElse)in_oOCLExpression;
      return conditionContainsReferenceToObject(oIfThenElseExp.getCondition(), in_oReferencedObject) ||
View Full Code Here

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

    try {
      TCGEquivalenceClass oEqClass = DomainHelper.createDefaultEquivalenceClass();
     
      if(in_oCondition instanceof TCGOCLOperation)
      {
        TCGOCLOperation oCallExp = (TCGOCLOperation)in_oCondition;
        double dValue = getValue((TCGOCLExpression)oCallExp.getRight());
        DomainHelper.adaptDomain(oEqClass, dValue, oCallExp.getOperationName(), false);
      }
      return oEqClass;
    }
    catch(Exception e)
    {
View Full Code Here

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

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

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

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

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

 
  public static TCGOCLExpression negateTCGOCLExpression(TCGOCLExpression in_oTCGOCLExpression)
  {
    if(in_oTCGOCLExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oTCGOCLExpression;
      // if operation name is not in list -> do not change it (e.g. addition, substraction, ...)
      if(sm_colNameMatching.get(oOpExp.getOperationName()) != null)
      {
        oOpExp.setOperationName(sm_colNameMatching.get(oOpExp.getOperationName()));
        if(oOpExp.getLeft() != null)
          if(oOpExp.getLeft() instanceof TCGOCLOperation)
            oOpExp.setLeft(negateTCGOCLExpression(oOpExp.getLeft()));
        if(oOpExp.getRight() != null)
          if(oOpExp.getRight() instanceof TCGOCLOperation)
            oOpExp.setRight(negateTCGOCLExpression(oOpExp.getRight()));
        return oOpExp;
      }
    }
    else if(in_oTCGOCLExpression instanceof TCGOCLAtom)
    {
      TCGOCLOperation oOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
      oOperation.setLeft(null);
      oOperation.setRight(in_oTCGOCLExpression);
      oOperation.setOperationName("-");
      return oOperation;
    }
    return null;
  }
View Full Code Here

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

      else if(in_oExpression instanceof OperationCallExp)
      {
        // TODO un�re Operationen einf�hren?
        OperationCallExp oOpExp = (OperationCallExp)in_oExpression;
     
        TCGOCLOperation oOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
        OCLExpression oOCLLeftExpression = (OCLExpression)oOpExp.getSource();
        if(oOCLLeftExpression != null)
          oOperation.setLeft(
              transformExpression(oOCLLeftExpression, in_sOCLTypeId, oContextClass));
        if(oOpExp.getArgument().size() > 0)
          oOperation.setRight(
              transformExpression((OCLExpression)oOpExp.getArgument().get(0), in_sOCLTypeId, oContextClass));
        oOperation.setOperation((EObject)oOpExp.getReferredOperation());
        oOperation.setOperationName(oOpExp.getReferredOperation().getName());
        oTCGOCLExpression = oOperation;
      }
      else if(in_oExpression instanceof IfExp)
      {
        TCGOCLIfThenElse oTCGIfExp = GeneratedFactory.eINSTANCE.createTCGOCLIfThenElse();
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.