Package sg.edu.nus.comp.simTL.engine.interpreter.evaluators

Examples of sg.edu.nus.comp.simTL.engine.interpreter.evaluators.TIfStatement


       
      } else {
        log.error("BUG: For-loop has no element. This should not happend.");
      }
    } else if(TIfStatement.isTIfStatement(tChildParent)){
      TIfStatement ifStatement = new TIfStatement(tChildParent, tChildContext, template);
      List<EObject> ifBody= template.getChildrenFrom(
          ifStatement.getTElement(), ifStatement.getOLReference(), tChildContext);
     
      if(ifBody.size()>1){
        //Remove element when more elements are in bodyVersion
        template.removeChildFrom(
            ifStatement.getTElement(), ifStatement.getOLReference(), tChild, tChildContext);
       
        log.debug("Removed tChild "+Util.getFullName(tChild)+
            " from ifStatement body: " + Util.getFullName(ifStatement.getTElement()));
      } else if(ifBody.size()==1){
        parameterModelHandler.negateCondition(ifStatement, false);
      } else {
        log.error("BUG: ifStatement has no element. This should not happend.");
      }
View Full Code Here


    if(TForLoop.isTForLoop(tObject)){
      TForLoop forLoop = new TForLoop(tObject, context, template);
      GrayPath grayPath = new GrayPath(forLoop.getTElement());
      allocateToElementInNewIteration(forLoop, addRightToParamElem, grayPath, tiChild, context, allocations);
    } else if(TIfStatement.isTIfStatement(tObject)){
      TIfStatement ifStatement = new TIfStatement(tObject, context, template);
      GrayPath grayPath = new GrayPath(ifStatement.getTElement());
      allocateToElementInIfStatement(ifStatement, addRightToParamElem,
          AllocationType.IF, grayPath, tiChild, context, allocations);
    } else if(TElement.isTElement(tObject)){
      log.error("Unknown tElement");
    }
View Full Code Here

    for(EObject loopChild : template.getChildrenFrom(forLoop.getTElement(), forLoop.getOLReference(), context)){
      if(canAllocateAddTo(loopChild, tiChild)){
        grayPath.setLeaf(loopChild);
        allocations.add(new NewIterationAddAllocation(grayPath, addRightToParamElem, context));
      } else if(TIfStatement.isTIfStatement(loopChild)){
        TIfStatement ifStatement = new TIfStatement(loopChild, context, template);
        grayPath.add(ifStatement.getTElement());
        allocateToElementInIfStatement(ifStatement, addRightToParamElem,
            AllocationType.FOR_NEWIT, grayPath, tiChild, context, allocations);
      } else if(TForLoop.isTForLoop(loopChild)){
        TForLoop childForLoop = new TForLoop(loopChild, context, template);
        grayPath.add(childForLoop.getTElement());
View Full Code Here

        } else {
          allocations.add(new GrayElementAddAllocation(allocationType, grayPath, context));
        }
       
      } else if(TIfStatement.isTIfStatement(ifChild)){
        TIfStatement childIfStatement = new TIfStatement(ifChild, context, template);
        grayPath.add(childIfStatement.getTElement());
        allocateToElementInIfStatement(childIfStatement, addRightToParamElem, allocationType, grayPath, tiChild, context, allocations);
      } else if(TForLoop.isTForLoop(ifChild)){
        TForLoop forLoop = new TForLoop(ifChild, context, template);
        grayPath.add(forLoop.getTElement());
        allocateToElementInNewIteration(forLoop, addRightToParamElem, grayPath, tiChild,context,allocations);
View Full Code Here

   
    EObject tChild = grayPath.getLeaf();
    for(EObject tObject : grayPath.getPath()){
      if(TIfStatement.isTIfStatement(tObject)){
        //negate if condition
        parameterModelHandler.negateCondition(new TIfStatement(tObject,context,template), true);
       
        //introduce trace link
        modelCorrespondence.add(
            new TraceLink(
              (StaticContext)context, //context is been adapted
View Full Code Here

      }
      TElement tElement = null;
      if(TForLoop.isTForLoop(tElementEO)){
        tElement = new TForLoop(tElementEO, context, template);
      } else if(TIfStatement.isTIfStatement(tElementEO)){
        tElement = new TIfStatement(tElementEO, context, template);
      } else {         
        throw new SimTLException("Unknown TElement type " + Util.getFullName(tElementEO));
      }
      List<EObject> toDelete = new ArrayList<EObject>();
      boolean foundChild =false;
View Full Code Here

        }
        currentContext.pullVariable(loop.getName());
      }
    } else if(TIfStatement.isTIfStatement(tObject)){
      log.debug("Evaluating if");
      TIfStatement ifStatement = new TIfStatement(tObject,currentContext,template);
     
      Boolean condition = (Boolean)ifStatement.getCondition()
          .getReferenceFromParent().getReferencedValue();
      if(condition){
        //BODY
        for(EObject tObjectChildren : template.getChildrenFrom(ifStatement.getTElement(), ifStatement.getOLReference(), currentContext)){
          evaluate(tObjectChildren,iObjectProxy, iRootPackage);
        }
      }
    } else {
      log.warn("Didn't recognize XFrameElement: " + tObject);
View Full Code Here

TOP

Related Classes of sg.edu.nus.comp.simTL.engine.interpreter.evaluators.TIfStatement

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.