Package net.sf.parteg.base.testcasetree.generated

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


      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

  public static void run(TCGOCLExpression in_oExp, OCLTreeExpressionVisitor in_oVisitor)
  {
    in_oVisitor.check(in_oExp);
    if(in_oExp instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExp;
      run(oOpExp.getLeft(), in_oVisitor);
      run(oOpExp.getRight(), in_oVisitor);     
    }
  }
View Full Code Here

  {
    // TODO boolesche Verkn�pfungen noch beachten

    if(m_oOCLExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOpExp = (TCGOCLOperation)m_oOCLExpression;
      if(oOpExp.getLeft() != null)
      {
        // first step: get variable on the left side
        OCLTreeExpressionFindObjectVisitor oVisitor = new OCLTreeExpressionFindObjectVisitor(in_oExpression);
        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

  {
    if(in_oOpExp.getLeft() instanceof TCGOCLOperation)
    {
      // noch beachten: variable nur mit Negationszeichen!
     
      TCGOCLOperation oOpLeftExp = (TCGOCLOperation)in_oOpExp.getLeft();
      OCLTreeExpressionFindObjectVisitor oVisitor = new OCLTreeExpressionFindObjectVisitor(in_oVariable);
      OCLTreeExpressionIterator.run(oOpLeftExp.getLeft(), oVisitor);
      // variable is on local right side -> 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
        }
        else if(oOpLeftExp.getOperationName().equals("-"))
        {
          in_oOpExp.setOperationName(sm_colCorrespondingRelations.get(in_oOpExp.getOperationName()));
          in_oOpExp.setRight(ExpressionConverter.negateTCGOCLExpression(in_oOpExp.getRight()));
        }
        else if(oOpLeftExp.getOperationName().equals("/"))
        {
          // TODO #### Fallunterscheidung einbauen
        }
      }
       
      OCLTreeExpressionIterator.run(oOpLeftExp.getLeft(), oVisitor);
      // variable is on local left side -> transfer local right side to the right
      if(oVisitor.isFound())
      {
        TCGOCLExpression oLeftSide = oOpLeftExp.getLeft();
        oOpLeftExp.setLeft(in_oOpExp.getRight());
        in_oOpExp.setRight(oOpLeftExp);
        in_oOpExp.setLeft(oLeftSide);
        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

 
  private 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

 
  private void buildMapForClassification(TCGOCLExpression in_oExpression)
  {
    if(in_oExpression instanceof TCGOCLOperation)
    {
      TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
      buildMapForClassification(oOperation.getLeft());
      buildMapForClassification(oOperation.getRight());
    }
    if(in_oExpression instanceof TCGOCLAtom)
    {
      TCGOCLAtom oAtom = (TCGOCLAtom)in_oExpression;
      m_colExpressionClassification.get(oAtom.getClassification()).add(oAtom);
View Full Code Here

TOP

Related Classes of net.sf.parteg.base.testcasetree.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.