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

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


      instance.save();
    } catch(ValidationException e){
      interpreterLog.error(e.getMessage());
      throw e;
    } catch (IOException e) {
      throw new SimTLException("Couldn't save instance",e);
    }
    return new InterpretationResult(instance,modelCorrespondence);
  }
View Full Code Here


        template.getObjectLanguageExtension(),
        resourceFactory);
    Resource instanceResource = resourceSet.createResource(outURI);
   
    if(instanceResource==null){
      throw new SimTLException("Instance - resource couldn't be created");
    }
   
    instance = new SimTLModel(ModelType.TEMPLATE_INSTANCE_MODEL,instanceResource);
   
//    currentContext.enterMetaLanguageElement();
View Full Code Here

    this.model = model;
    listeners = new Vector<IModelChangedListener>();
    if(modelType == null){
      throw new InterpreterException("No modelType given");
    } else if(modelType == ModelType.INPUT_MODEL && modelName == null){
      throw new SimTLException("No name given for imported model");
    } else if(modelType == ModelType.TEMPLATE_MODEL
        && !(this instanceof ITemplate)){
      throw new InterpreterException("TEMPLATE_MODEL can only be built by an ITemplate instance");
    }
       
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public List<EObject> getChildrenFrom(EObject parent, EReference reference,
      IContext context) throws SimTLException {
    if(parent== null) return null;
    else if (reference == null) throw new SimTLException("Reference is null");
   
    List<EObject> list = new ArrayList<EObject>();
    if(reference.isMany()){
      List<EObject> children =(List<EObject>)parent.eGet(reference);
      if(children.size()>0){
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  @Override
  public boolean removeChildFrom(EObject tParent,
      EReference tParent2tChildRef, EObject tChild, IContext context) throws SimTLException{
    if(tParent==null) throw new SimTLException("tParent is null");
    else if(tParent2tChildRef==null) throw new SimTLException("tParent2tChildRef is null");
    else if(tChild==null) return false;
   
   
    log.info("Remove " + Util.getFullName(tChild) + " from " + Util.getFullName(tParent));
    if(tParent2tChildRef.isMany()){
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  @Override
  public boolean addChildTo(EObject tParent, EReference tParent2tChildRef,
      EObject tChild, Integer position, IContext context) throws SimTLException{
    if(tParent==null) throw new SimTLException("tParent is null");
    else if(tParent2tChildRef==null) throw new SimTLException("tParent2tChildRef is null");
    else if(tChild==null) return false;
   
    log.info("Add " + Util.getFullName(tChild) + " to " + Util.getFullName(tParent) + " at reference " + tParent2tChildRef.getName() + " and position " + position);
    if(tParent2tChildRef.isMany()){
      List<EObject> listOfChildren = ((List<EObject>)tParent.eGet(tParent2tChildRef));
      if(!listOfChildren.contains(tChild)){
        if(position==null||position==Util.NO_POSITION){
          listOfChildren.add(tChild);
        } else {
          listOfChildren.add(position, tChild);
        }
        return true;
      }
    } else {
      if(position!=null || position!=Util.NO_POSITION){
        throw new SimTLException("Cannot set element. Position given ("+position+")");
      } else {
        tParent.eSet(tParent2tChildRef, tChild);
      }
      return true;
    }
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.