Examples of IContext


Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

//      log.info("iLeft: " + Util.getFullName(iLeft) + " iRight: " + Util.getFullName(iRight));
     
      //tLeft
      EObjectTraceLinkReturnContainer tLeftETLRC = null;
      EObject tLeft = null;
      IContext tLeftContext = null;
      if(iLeft!=null){
        tLeftETLRC = findTObject(iLeft);
        tLeft = tLeftETLRC.getTObject();
        tLeftContext = tLeftETLRC.getTraceLink().getStaticContext();
      }
      //tRight
      EObjectTraceLinkReturnContainer tRightETLRC = null;
      EObject tRight = null;
      IContext tRightContext = null;
      if(iRight!=null){
        tRightETLRC = findTObject(iRight)
        tRight = tRightETLRC.getTObject();
        tRightContext = tRightETLRC.getTraceLink().getStaticContext();
      }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

    }
   
    //find tChildObject
    EObjectTraceLinkReturnContainer tChildETLRC = findTObject(tiChild);
    EObject tChild =tChildETLRC.getTObject();
    IContext tChildContext = tChildETLRC.getTraceLink().getStaticContext();
   
    // Remove trace link
    modelCorrespondence.remove(tChildETLRC.getTraceLink());
   
    List<EObject> tParentChildren = template.getChildrenFrom(tParent, tParent2ChildRef, tChildContext);
    //Element in Element
    if(tParentChildren.contains(tChild)){
      template.removeChildFrom(tParent, tParent2ChildRef, tChild, tChildContext);
     
      log.debug("Removed element "+Util.getFullName(tChild)+" from element " + Util.getFullName(tParent));
//      checkWhetherAnIfBecameValidAgain(tParent,tObjectETLRC.getTraceLink().getStaticContext());
      return;
    }
    //Sometimes tObject is NOT parent of tChild! (for and if)
    ReferenceFromParent tChildParent2tChildRef = template.getParentFrom(tChild, tChildContext);
    EObject tChildParent = tChildParent2tChildRef.getParent();
    //FOR-LOOP
    if(TForLoop.isTForLoop(tChildParent)){
      TForLoop forLoop = new TForLoop(tChildParent, tChildContext, template);
      List<EObject> loopBody= template.getChildrenFrom(
          forLoop.getTElement(), forLoop.getOLReference(), tChildContext);
     
      //TODO implement the following
//      if(decisionMaker.onlyFilterOutInputElementAndDoNotDelete(tChild)){
//        throw new SynchronizingException("Handle filter out - Not yet implemented.");
//      }
      if(loopBody.size()>1){
        //Remove element when more elements are in bodyVersion
        template.removeChildFrom(
            forLoop.getTElement(), forLoop.getOLReference(), tChild, tChildContext);
       
        log.debug("Removed tChild "+Util.getFullName(tChild)+
            " from for-Loop body: " + Util.getFullName(forLoop.getTElement()));
      } else if(loopBody.size()==1){
       
       
        //Remove parameter element when only one element is in bodyVersion
        EObject inputModelElement = tChildContext.getVariableValue(forLoop.getName());
       
        parameterModelHandler.removeElement(inputModelElement,
            forLoop.getSetToBeIterated().getReferenceFromParent());
       
        log.debug("Removed parameterElement in for-Loop: " + Util.getFullName(forLoop.getTElement()) + " Element: " + Util.getFullName(inputModelElement));
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

    EObject tChild = null;
    if(addAllocation instanceof PositionAddAllocation){
      PositionAddAllocation pAddAlloc = (PositionAddAllocation)addAllocation;
      EObject tParent = pAddAlloc.getTParent();
      EReference tParent2tChildRef = pAddAlloc.getReferenceFromParent();
      IContext context = pAddAlloc.getReferencedContext();
      Integer position = pAddAlloc.getPosition();
     
      tChild = EObjectCopier.copyElement(
          iChild,
          tParent2tChildRef.getEReferenceType().getEPackage());
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

   */
  @Override
  public Reference2Element getParentFrom(EObject tChild, IContext context)
      throws SimTLException {
    if(tChild==null) return null;
    IContext relevantContext = findRelevantContext(tChild, context);
    for(Reference2Element tParent2Child : parent2context2patternVersionMap.keySet()){
      Map<IContext,PatternVersion> patternVersionMap = parent2context2patternVersionMap.get(tParent2Child);
      if(patternVersionMap.containsKey(relevantContext)
          && patternVersionMap.get(relevantContext).getEObjects().contains(tChild)){
        log.debug("tChild is in patternVersion");
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

    return super.getParentFrom(tChild, context);
  }

  private PatternVersion findPatternVersion(EObject tParent, EReference tParent2tChildRef, IContext context) throws SimTLException{
    Reference2Element tRef2El = new Reference2Element(tParent, tParent2tChildRef, context, this);
    IContext relevantContext = findRelevantContext(tParent, context);
    Map<IContext,PatternVersion> patternVersionMap = parent2context2patternVersionMap.get(tRef2El);
    if(patternVersionMap==null){
      patternVersionMap = new HashMap<IContext, PatternVersion>();
      parent2context2patternVersionMap.put(tRef2El, patternVersionMap);
    }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

    return pv;
  }
 
  private boolean hasPatternVersion(EObject tParent, EReference tParent2tChildRef, IContext context) throws SimTLException{
    Reference2Element tRef2El = new Reference2Element(tParent, tParent2tChildRef, context, this);
    IContext relevantContext = findRelevantContext(tParent, context);
    Map<IContext,PatternVersion> patternVersionMap = parent2context2patternVersionMap.get(tRef2El);
    if(patternVersionMap==null) return false;
    PatternVersion pv = patternVersionMap.get(relevantContext);
    if(pv==null) return false;
    return true;
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.IContext

      EObject tiChild  ) throws SimTLException{
    log.debug("Enable GrayElement");
    //addAllocation is gray element
    log.debug("Reason for Gray Element: " + grayElementAddAllocation.getAllocationType());
    GrayPath grayPath = grayElementAddAllocation.getGrayPath();
    IContext context = grayElementAddAllocation.getReferencedContext();
   
    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
              new TraceLinkNode(
                template,
                tChild
              ),
              new TraceLinkNode(
                instance,
                tiChild
              )
            ));
       
      } else if(TForLoop.isTForLoop(tObject)){
        TForLoop forLoop = new TForLoop(tObject, context, template);
        EObject neighborInputElement = context.getVariableValue(forLoop.getName());
       
        Reference2Element pPointerToList = (Reference2Element)forLoop.getSetToBeIterated().getReferenceFromParent();
        List<EObject> parameterList = (List<EObject>)pPointerToList.getReferencedValue();
        if(parameterList.size()>0
            && (neighborInputElement==null
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.