Package sg.edu.nus.comp.simTL.engine.exceptions

Examples of sg.edu.nus.comp.simTL.engine.exceptions.SimTLException


   */
  public GrayElementAddAllocation(AllocationType type, GrayPath grayPath, IContext context) throws SimTLException {
    super(type, context);
    this.grayPath = grayPath;
    if(type==AllocationType.FOR_NEWIT&&!(this instanceof NewIterationAddAllocation))
        throw new SimTLException("Use NewIterationAddAllocation instead!");
    if(grayPath==null) throw new SynchronizingException("GrayPath cannot be null");
    if(grayPath.getLeaf()==null) throw new SynchronizingException("GrayPath-Element cannot be null");
  }
View Full Code Here


            tRightContext));
       
      } else {
        EObject uppermostForLoop = findUpperMostForLoop(tParent, tLeft, tLeftContext);
        if(uppermostForLoop==null||!TForLoop.isTForLoop(uppermostForLoop)){
          throw new SimTLException("Didn't find uppermost for-loop ancistor?");
        }
       
        GrayPath grayPathToTLeft = findGrayPath(new TForLoop(uppermostForLoop, tLeftContext, template), tLeft, tLeftContext);
        elementsInRange.add(new NewIterationAddAllocation(grayPathToTLeft,true,tLeftContext));
      }
      return elementsInRange;
    }
    EObject commonAncistor = tParent;
    if(tLeft!=null&&tRight!=null){
      commonAncistor = findCommonAncistor(tParent, tLeft, tLeftContext, tRight, tRightContext);
    }
//    log.info("found common ancistor of " +
//        Util.getFullName(tLeft) + " and " + Util.getFullName(tRight) +
//        " :: " + Util.getFullName(commonAncistor));
    //left to right first
    EObject tLeftRep = null;
    if(tLeft!=null){
      tLeftRep = addAllocationsTillCap(true, tLeft, tLeftContext, commonAncistor, tiChild,elementsInRange);
    }
    //then right to left
    EObject tRightRep = null;
    if(tRight!=null){
      tRightRep = addAllocationsTillCap(false, tRight, tRightContext, commonAncistor, tiChild,elementsInRange);
    }
    //then in between tLeftRep and tRightRep below commonAncistor
//    log.info("Found tLeftRep: " + Util.getFullName(tLeftRep) + " and tRightRep: " + Util.getFullName(tRightRep));
   
    EReference commonAncistor2ChildRef = (EReference)commonAncistor.eClass().getEStructuralFeature(tParent2ChildRef.getName());
    if(commonAncistor2ChildRef==null){
      throw new SimTLException("tElementReference doesn't have the name than tParent to tChildReference.");
    }
    //Up here both contexts could be used
    addAllocationsBetweenTLeftRepAndTRightRepUnderCommonAncistor(commonAncistor, commonAncistor2ChildRef, tLeftRep, tRightRep, tiChild, tLeftContext, elementsInRange);
   
    return elementsInRange;
View Full Code Here

    while(tChildParent!=tAncistor.getTElement()){
      tChildParent= template.getParentFrom(tChildParent, context).getParent();
      if(TElement.isTElement(tChildParent)){
        reversePath.add(tChildParent);
      } else {
        throw new SimTLException("Found OLelement on the way to tAncistor. Should be only TElements!");
      }
    }
   
    //FIXME Check if this is correct!
    //ROOT we have already
View Full Code Here

   */
  @Override
  public List<EObject> getChildrenFrom(EObject tParent, EReference reference,
      IContext context) throws SimTLException {
    if(tParent== null) return null;
    else if (reference == null) throw new SimTLException("Reference is null");
   
    if(hasPatternVersion(tParent, reference, context)){
      log.debug("Has Patternversion");
      PatternVersion pv =findPatternVersion(tParent, reference, context);
      return pv.getEObjects();
View Full Code Here

    path = new Vector<EObject>();
    add(root);
  }
 
  public void add(EObject element) throws SimTLException{
    if(!TElement.isTElement(element))throw new SimTLException("eObject is no TElement!");
    path.add(element);
  }
View Full Code Here

    path.add(element);
  }
 
  public void setLeaf(EObject leaf){
    this.leaf = leaf;
    if(TElement.isTElement(leaf)) throw new SimTLWrapperError(new SimTLException("GrayElement should not be TElement but OL!!"));
  }
View Full Code Here

  private final EStructuralFeature reference;

  public ReferenceFromParent(EObject parent, EStructuralFeature reference) throws SimTLException {
    this.parent = parent;
    this.reference = reference;
    if(parent==null) throw new SimTLException("Parent is null");
    if(reference==null) throw new SimTLException("Reference is null");
  }
View Full Code Here

        Reference2Element pPointerToList = (Reference2Element)forLoop.getSetToBeIterated().getReferenceFromParent();
        List<EObject> parameterList = (List<EObject>)pPointerToList.getReferencedValue();
        if(parameterList.size()>0
            && (neighborInputElement==null
              ||!parameterList.contains(neighborInputElement))){
          throw new SimTLException("InputModel collection doesn't contain neighbor input element. It does contain other elements though");
         
        }
       
        Reference2Element pPointerToListElement = (Reference2Element)pPointerToList;
        EClass pClass = pPointerToListElement.getReferenceToChildren().getEReferenceType();
        //create new inputElement
        EObject pElement = pClass.getEPackage().getEFactoryInstance().create(pClass);
       
       
        if(pElement==null) throw new SimTLException("Couldn't instantiate parameter element type " + pClass.getName());
       
        //Add element to parameter model
        if(parameterList.size()>1){
          //It must be a new iteration => Existing is covered in position above
          boolean insertToRightOfParam = ((NewIterationAddAllocation)grayElementAddAllocation).isInsertToRightOfParam();
View Full Code Here

      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;
      for(EObject tElementChild : template.getChildrenFrom(tElementEO,
          ((OLContainer)tElement).getOLReference(),context)){
View Full Code Here

    this.context = context;
    this.template = template;
    if(template.getModelResource()==getParent().eResource()){
      isTemplate=true;
      if(context==null){
        throw new SimTLException("Reference2Element for a template needs a context!");
      }
    }   
  }
View Full Code Here

TOP

Related Classes of sg.edu.nus.comp.simTL.engine.exceptions.SimTLException

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.