Package net.sf.parteg.base.testcasegraph.valuetyperanges

Examples of net.sf.parteg.base.testcasegraph.valuetyperanges.ValueTypeRange


        // remaining expressions to evaluate
        List<TCGOCLExpression> colTmpExpressions = new ArrayList<TCGOCLExpression>();
        colTmpExpressions.addAll(in_oConjunctionExpressions);
        colTmpExpressions.remove(oExpression);
       
        ValueTypeRange oTmpVTR =
          TCGOCLExpressionHelperClass.getValueTypeRangeForEventParameterInstance(
              colExpAtoms, colTmpExpressions,
              new HashMap<TCGOCLAtom, ValueTypeRange>(),
              in_colTestValues,
              new ArrayList<TCGOCLExpression>());
View Full Code Here


                TCGParameterHelperClass.findParameterElementMatchingToReference(
                    oTCGParameter, oTransitionInstance, oObject);
              // referenced parameter
              if(oReferencedTCGParameter != null)
              {
                ValueTypeRange oValueTypeRange =
                  OCLExpressionValueTypeRangeFactory.getValueTypeRangeForRightSideOfExpression(
                    oReferencedTCGParameter, oOCLExp);
                if(oValueTypeRange == null)
                  return ErrorClass.NOSOLUTION;
               
View Full Code Here

      // check for overlapping
      if(colFirstObjectToValueRange.size() == colSecondObjectToValueRange.size())
      {
        for(Object oSelectedObject : colFirstObjectToValueRange.keySet())
        {
          ValueTypeRange oFirstVTR = colFirstObjectToValueRange.get(oSelectedObject);
          ValueTypeRange oSecondVTR = colSecondObjectToValueRange.get(oSelectedObject);
          if((oSecondVTR == null) || !oFirstVTR.overlaps(oSecondVTR))
          {
            return;
          }
        }
View Full Code Here

                TCGOCLExpression oNewExp = TCGOCLExpressionHelperClass.connectPreconditionAndPostcondition(in_oPrecondition, oPostCondition);
                if(oNewExp != null)
                  in_colNewExpressions.add(oNewExp);
              } else { // does the right side contain just independent elements?
                // compare the expressions of both elements!
                ValueTypeRange oPostConditionRange =
                  OCLExpressionValueTypeRangeFactory.
                  getValueTypeRangeForRightSideOfExpression(
                      oOperation);
                ValueTypeRange oPreConditionRange =
                  OCLExpressionValueTypeRangeFactory.
                  getValueTypeRangeForRightSideOfExpression(
                      in_oPrecondition);
               
               
View Full Code Here

    {
      // return value that describes the result of the operation
      PrePostComparisonResult eRetValue =
        PrePostComparisonResult.NO_IMPACT_ON_CONDITION;
      // value range for precondition
      ValueTypeRange oPreValueRange =
        OCLExpressionValueTypeRangeFactory.getValueTypeRangeForRightSideOfExpression(
            in_oPrecondition);
 
      // iterate over all expressions of all postcondition conjunctions
      for(TCGConjunction oPostConjunction : in_colPostcondition.getConjunctions()) {
        EXPRESSIONLOOP: for(TCGOCLExpression oPostCondition : oPostConjunction.getExpressions()) {
         
          TCGOCLVariableClassificator oClassificator =
            new TCGOCLVariableClassificator(oPostCondition);
          for(TCGOCLAtom oActivePostExpression :
            oClassificator.getClassifiedElementsInExpression(
                VariableClassification.ACTIVE_DEPENDENT)) {
           
            oClassificator.shiftSubexpressionToTheLeft(oActivePostExpression);
            TCGOCLAtom oAtomPostExp = (TCGOCLAtom)oActivePostExpression;
           
            // 1) precondition references the same active object as postcondition
            // 2) expression is an operation (else a transformation is not possible)
            if((TCGOCLExpressionHelperClass.conditionContainsReferenceToObject(
              in_oPrecondition, oAtomPostExp.getElement()))) //  &&
              //oClassificator.getExpression() instanceof TCGOCLOperation)
            {
             
              TCGOCLVariableClassificator oRightSubClassificator =
                new TCGOCLVariableClassificator(oClassificator.getExpression());
             
              // does the right side contain a passive dependent element?
              List<TCGOCLAtom> colPassiveDependentSubExpression =
                oRightSubClassificator.getClassifiedElementsInExpression(
                    VariableClassification.PASSIVE_DEPENDENT);
              List<TCGOCLAtom> colInputParameterSubExpression =
                oRightSubClassificator.getClassifiedElementsInExpression(
                    VariableClassification.INPUT_PARAMETER);
             
              if((!colPassiveDependentSubExpression.isEmpty()) ||
                  (!colInputParameterSubExpression.isEmpty()))
              {
                TCGOCLExpression oNewExpression = TCGOCLExpressionHelperClass.connectPreconditionAndPostcondition(
                    in_oPrecondition, oPostCondition);
                if(oNewExpression != null) {
                  in_colNewExpressions.add(oNewExpression);
                }
                io_oPostConjunction.getExpressions().addAll(
                    oPostConjunction.getExpressions());
                eRetValue = PrePostComparisonResult.RESOLVED_CONDITION;
              }
              else { // does the right side contain just independent elements?

//                Hier ansetzen - Postcondition kann auch LateEvaluationGroups erzeugen
                // TODO : AA hier Abh�ngigkeiten bei postconditions einbauen
//                List<TCGOCLAtom> colChangeableParameters =
//                  TCGOCLExpressionHelperClass.getPassiveDependentVariablesAndInputParameters(oPostCondition);

                ValueTypeRange oPostValueRange =
                  OCLExpressionValueTypeRangeFactory.
                  getValueTypeRangeForRightSideOfExpression(
                      oPostCondition);

                // compare the expressions of both elements!
View Full Code Here

      // the referenced elements must be the same
      if((oWarrantedElement != null) && (oCheckedElement != null) &&
          expressionsContainReferenceToTheSameObject(oWarrantedElement, oCheckedElement))
      {
        // next condition: the warranted value range must be included in the checked
        ValueTypeRange oCheckedRange =
          OCLExpressionValueTypeRangeFactory.
          getValueTypeRangeForRightSideOfExpression(
              in_oCheckedExpression);
        ValueTypeRange oWarrantedRange =
          OCLExpressionValueTypeRangeFactory.
          getValueTypeRangeForRightSideOfExpression(
              in_oWarrantedExpression);
        if(ValueTypeRangeHelper.outerVTRangeContainsInnerVTRange(
            oCheckedRange, oWarrantedRange, in_bBoundariesMatchExactly))
View Full Code Here

    HashMap<Object, ValueTypeRange> colObjectToRange = new LinkedHashMap<Object, ValueTypeRange>();
    for(TCGOCLExpression oOCLExp : in_colExpressions)
    {
      for(TCGOCLAtom oAtom : TCGOCLExpressionHelperClass.getDependentVariableOrInputParameter(oOCLExp)) {
        Object oReferencedObject = oAtom.getElement();
        ValueTypeRange oNewRange =
          OCLExpressionValueTypeRangeFactory.getValueTypeRangeForRightSideOfExpression(
            oOCLExp);
        ValueTypeRange oExistingRange = colObjectToRange.get(oReferencedObject);
        if(oExistingRange == null)
        {
          colObjectToRange.put(oReferencedObject, oNewRange);
        } else {
          oExistingRange.adaptRange(oNewRange);
        }       
      }
    }
    return colObjectToRange;
  }
View Full Code Here

      new ArrayList<TCGOCLExpression>();
    TCGOCLVariableClassificator oClassificator =
      new TCGOCLVariableClassificator(in_oExpression);
    TCGOCLAtom oInterestingElement = null;
    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.
          getValueTypeRangeForRightSideOfExpression(
              oOperationExp);
        if(oExpressionRange == null) {
          TCGOCLExpressionHelperClass.
            getDependentVariableOrInputParameter(in_oExpression);
        }
        else if(oExpressionRange.isEmpty())
        {
          colContradictingExpressions.add(oOperationExp);
          return colContradictingExpressions;
        }
      }
      else {
        // TODO #### Widerspr�che auch f�r Eingabeparameter aufdecken
        // step 1: hashmap von Variablen auf ValueRanges bauen -> immer erweitern bis zum Widerspruch
        if((oClassificator.getNumberOfDependentVariables() +
            oClassificator.getNumberOfInputParameter() == 1)) {
          oInterestingElement =
            getDependentVariablesAndInputParameters(oClassificator).get(0);
          oReferredObject =
            getReferencedElement(oInterestingElement);
          oClassificator.shiftSubexpressionToTheLeft(oInterestingElement);
          oActualValueRange =
            OCLExpressionValueTypeRangeFactory.
            getValueTypeRangeForRightSideOfExpression(
                oOperationExp);
        }
        else {
          // Widerspr�ce f�r mehr als einen Eingabeparameter?
        }
      }
    }
    else { // in_oExpression instanceof TCGOCLAtom
      oInterestingElement = (TCGOCLAtom)in_oExpression;
      oReferredObject =
        getReferencedElement(oInterestingElement);
      oActualValueRange =
        OCLExpressionValueTypeRangeFactory.
        getValueTypeRangeForRightSideOfExpression(
            in_oExpression);
    }
   
    // now compare to the already saved value ranges from last elements
    if(oInterestingElement != null) {
      ValueTypeRange oSavedValueRange = io_colElementToValueRange
        .get(oReferredObject);
      ArrayList<TCGOCLExpression> colAssociatedExpressions =
        io_colElementToExpressions.get(oReferredObject);
//      Parameter oReferencedParameter = null;
//      if(oReferredObject instanceof Variable) {
//        oReferencedParameter = ((Variable)oReferredObject).getRepresentedParameter();
//      }
//      List<Parameter> colParameter = TCGEventHelperClass.
//        getEventParameters(oReferencedParameter,
//          oInterestingElement.getTransitionContext());
      // TODO : ### hier Transition in conditionsAreContradicting
//      Verdammt - Woher bekomme ich die Transition?
//          Was jetzt noch fehlt:
//            1) Hier die korrekte Zuordnung der Parameter
//            2) die Zuweisung der Transition an die Expression bei deren Erzeugung
//          Sind Expressions nur noch transitionsabh�ngig vergleichbar?
//          Sollte jede Expression jetzt eine Referenz auf die originale Transition
//          speichern?
      if(colAssociatedExpressions == null)
      {
        colAssociatedExpressions = new ArrayList<TCGOCLExpression>();
        io_colElementToExpressions.put(oReferredObject,
            colAssociatedExpressions);
      }
      colAssociatedExpressions.add(in_oExpression);
     
      if(oSavedValueRange == null)
        io_colElementToValueRange.put(oReferredObject, oActualValueRange);
      else
      {
        if(!oSavedValueRange.adaptRange(oActualValueRange))
        {
          // return the list of all expressions that are conflicting
          return io_colElementToExpressions.get(oReferredObject);
        }
      }
View Full Code Here

      List<TCGOCLExpression> in_colExpressions,
      Map<TCGOCLAtom, ValueTypeRange> in_colAtomToVTR,
      Map<TCGOCLAtom, TestCaseValidValue> in_colCurrentValueAssignment,
      List<TCGOCLExpression> in_colAlreadyEvaluatedExpressions) {
   
    ValueTypeRange oGlobalVTR = null;
    boolean bResult = true;
   
    //ATOM: for(TCGOCLAtom oAtom : in_oAtom) {
    if(!in_oAtom.isEmpty()) {
      TCGOCLAtom oAtom = in_oAtom.get(0);
     
      if(oGlobalVTR == null) {
        oGlobalVTR = ValueTypeRangeFactory.createValueTypeRangeForObject(oAtom);
      }
      //hier statt eines �bergebenen atoms eine Liste "gleicher" Atome �berpr�fen???
     
      // get value type range
      ValueTypeRange oVTR = in_colAtomToVTR.get(oAtom);
      if(oVTR != null)
        oVTR = oVTR.clone();
      else
        oVTR = ValueTypeRangeFactory.createValueTypeRangeForObject(oAtom);
     
     
      // TODO Typ von in_colCurrentValueAssignment �ndern auf Map<EObject,TestCaseValidValue>
      // if there is a value assignment for the given atom
      for(TCGOCLAtom oAtomWithAssignedValue : in_colCurrentValueAssignment.keySet()) {
        if(oAtomWithAssignedValue.getElement().equals(oAtom.getElement())) {
          // adapt value type range
          bResult = bResult &&
            oVTR.adaptRange(in_colCurrentValueAssignment.get(oAtomWithAssignedValue).getValue());
          bResult = bResult &&
            oGlobalVTR.adaptRange(oVTR);
          if(!bResult)
            return new IndefinableValueTypeRange();
//            break ATOM;

//          continue ATOM;
        }
      }
     
      // keep track of all the expressions still to evaluate ...
      List<TCGOCLExpression> colTmpExpressionsCopy = new ArrayList<TCGOCLExpression>();
      colTmpExpressionsCopy.addAll(in_colExpressions);
     
      for(TCGOCLExpression oExpression : in_colExpressions) {
       
        OCLTreeExpressionFindAtomReferenceVisitor oVisitor =
          //new OCLTreeExpressionFindAtomReferenceVisitor(in_oAtom);
          new OCLTreeExpressionFindAtomReferenceVisitor(oAtom);
        OCLTreeExpressionIterator.run(oExpression, oVisitor);
        // oExpression contains oAtom
        if(oVisitor.isFound()) {
          for(TCGOCLAtom oInterestingAtom : oVisitor.getFoundAtoms()) {
            if(oExpression instanceof TCGOCLAtom) {
              ValueTypeRange oTmpVTR = OCLExpressionValueTypeRangeFactory.
                getValueTypeRangeForRightSideOfExpression(
                  oInterestingAtom, oExpression);
              if(oVTR == null)
                oVTR = oTmpVTR;
              else {
                if(!oVTR.adaptRange(oTmpVTR)) {
//                  bResult = false;
                  return new IndefinableValueTypeRange();
//                  break ATOM;
                }
              }
            }
            else if(oExpression instanceof TCGOCLOperation) {
              TCGOCLOperation oOperation = (TCGOCLOperation)oExpression;
              // shift atom to the left
              shiftSubexpressionToTheLeft(oInterestingAtom, oOperation);
              // now investigate the right side of the expression
              // combine with other expressions of the list
              colTmpExpressionsCopy.remove(oOperation);
             
              Map<TCGOCLAtom, ValueTypeRange> colTemporaryAtomToVTR
                = new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
              colTemporaryAtomToVTR.putAll(in_colAtomToVTR);
              colTemporaryAtomToVTR.remove(oAtom);
              //colTemporaryAtomToVTR.remove(in_oAtom);
              // colTemporaryEPIToAtoms contains all remaining epi to atoms
   
              Map<TCGOCLAtom, ValueTypeRange> colAtomToVTR =
                new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
              // restart the evaluation for each ATOM of the right side
              OCLTreeTCGOCLAtomCollectorVisitor oAtomCollector =
                new OCLTreeTCGOCLAtomCollectorVisitor();
              OCLTreeExpressionIterator.run(oOperation.getRight(), oAtomCollector);
              for(TCGOCLAtom oExpAtom : oAtomCollector.getExpressions()) {
                // check only atoms that reference variables or properties
                if(oExpAtom.getElement() instanceof Variable ||
                    oExpAtom.getElement() instanceof Property) {
                  List<TCGOCLAtom> colExpAtoms = new ArrayList<TCGOCLAtom>();
                  colExpAtoms.add(oExpAtom);
                  ValueTypeRange oTmpVTR =
                    getValueTypeRangeForEventParameterInstance(
                        colExpAtoms, colTmpExpressionsCopy, colTemporaryAtomToVTR,
                        in_colCurrentValueAssignment, in_colAlreadyEvaluatedExpressions);
                  if(oTmpVTR instanceof IndefinableValueTypeRange) {
                    return new IndefinableValueTypeRange();
    //                  bResult = false;
    //                  break ATOM;
                  }
                  colAtomToVTR.put(oExpAtom, oTmpVTR);
                }
              }
             
              // evaluate expressions with the help of value type ranges
              ValueTypeRange oTmpVTR = ValueTypeRangeFactory.createValueTypeRangeForObject(oInterestingAtom);
   
              oTmpVTR = OCLExpressionValueTypeRangeFactory.
                getValueTypeRangeForRightSideOfExpression(
                  oTmpVTR, oOperation,
                  in_colCurrentValueAssignment, colAtomToVTR);
View Full Code Here

        }
      }
      // adapt value ranges by evaluating all dynamic expressions of the group
      List<TCGOCLExpression> colAlreadyEvaluatedExpressions =
        new ArrayList<TCGOCLExpression>();
      ValueTypeRange oVTR =
        TCGOCLExpressionHelperClass.getValueTypeRangeForEventParameterInstance(
            in_oGroup.getParameterToAtoms().get(oEPI),
            in_oGroup.getLateSatisfiedConditions(),
            colAtomToValuetypeRange, colAtomValues,
            colAlreadyEvaluatedExpressions);
View Full Code Here

TOP

Related Classes of net.sf.parteg.base.testcasegraph.valuetyperanges.ValueTypeRange

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.