예제 #1
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public EList<Handler> getAllHandlers() {
   EList<Handler> result = new BasicEList<Handler>();
   for (Element child : getChildren()) {
     result.addAll(child.getAllHandlers());
   }
   result.addAll(getHandlers());
   return result;
 }
예제 #2
0
 /**
  * Return the subLines and the cells of this line.
  *
  * @param line The line
  * @return List of representations elements
  */
 private EList<DRepresentationElement> getRepresentationElements(DLine line) {
   EList<DRepresentationElement> result = new BasicEList<DRepresentationElement>();
   result.add(line);
   result.addAll(line.getCells());
   for (DLine subLine : line.getLines()) {
     result.addAll(getRepresentationElements(subLine));
   }
   return result;
 }
 /**
  * {@inheritDoc}
  *
  * @see org.eclipse.sirius.viewpoint.impl.DDiagramElementContainerImpl#getElements()
  */
 @Override
 public EList<DDiagramElement> getElements() {
   final EList<DDiagramElement> result = new BasicEList<DDiagramElement>();
   result.addAll(getOwnedBorderedNodes());
   result.addAll(getOwnedElements());
   return new EcoreEList.UnmodifiableEList<DDiagramElement>(
       eInternalContainer(),
       DiagramPackage.eINSTANCE.getDDiagramElementContainer_Elements(),
       result.size(),
       result.toArray());
 }
예제 #4
0
 /** {@inheritDoc} */
 @Override
 public EList<DRepresentationElement> getOwnedRepresentationElements() {
   EList<DRepresentationElement> result =
       new BasicEList<DRepresentationElement>(getColumns().size() + getLines().size());
   result.addAll(getColumns());
   result.addAll(getLines());
   return new EcoreEList.UnmodifiableEList<DRepresentationElement>(
       eInternalContainer(),
       ViewpointPackage.eINSTANCE.getDRepresentation_OwnedRepresentationElements(),
       result.size(),
       result.toArray());
 }
예제 #5
0
  public String[] getValidInsertElements() {

    VEXDocument doc = this.getDocument();
    if (doc == null) return new String[0];

    Validator validator = doc.getValidator();
    if (validator == null) return new String[0];

    int startOffset = this.getCaretOffset();
    int endOffset = this.getCaretOffset();
    if (this.hasSelection()) {
      startOffset = this.getSelectionStart();
      endOffset = this.getSelectionEnd();
    }

    VEXElement parent = doc.getElementAt(startOffset);

    Set<String> validItems = validator.getValidItems(parent.getName());
    List<String> candidates = new ArrayList<String>(validItems);
    candidates.remove(Validator.PCDATA);

    // filter invalid sequences
    EList<String> nodesBefore = doc.getNodeNames(parent.getStartOffset() + 1, startOffset);
    EList<String> nodesAfter = doc.getNodeNames(endOffset, parent.getEndOffset());
    int sequenceLength = nodesBefore.size() + 1 + nodesAfter.size();
    for (Iterator<String> iter = candidates.iterator(); iter.hasNext(); ) {
      String candidate = iter.next();
      EList<String> sequence = new BasicEList<String>(sequenceLength);
      sequence.addAll(nodesBefore);
      sequence.add(candidate);
      sequence.addAll(nodesAfter);
      if (!validator.isValidSequence(parent.getName(), sequence, true)) {
        iter.remove();
      }
    }

    // If there's a selection, root out those candidates that can't
    // contain it.
    if (hasSelection()) {
      EList<String> selectedNodes = doc.getNodeNames(startOffset, endOffset);

      for (Iterator<String> iter = candidates.iterator(); iter.hasNext(); ) {
        String candidate = iter.next();
        if (!validator.isValidSequence(candidate, selectedNodes, true)) {
          iter.remove();
        }
      }
    }

    Collections.sort(candidates);
    return (String[]) candidates.toArray(new String[candidates.size()]);
  }
예제 #6
0
  public EList<PartialStateDescription> getSubFormulas() {
    EList<PartialStateDescription> result = new BasicEList<PartialStateDescription>();

    if (leftStateFormula != null) {
      result.add(leftStateFormula);
      result.addAll(leftStateFormula.getSubFormulas());
    }
    if (rightStateFormula != null) {
      result.add(rightStateFormula);
      result.addAll(rightStateFormula.getSubFormulas());
    }

    return result;
  }
예제 #7
0
 public void addSrcDep(EList<MindRootSrc> dep) {
   if (_allsrc == null) {
     getAllsrc();
     return;
   }
   _allsrc.addAll(dep);
 }
예제 #8
0
  public static void resolveMPE(
      MindProject currentProject, EList<MindRootSrc> allsrc, MindPathEntry mpe) {

    MindObject resolvedBy = mpe.getResolvedBy();
    if (resolvedBy == null) return;
    switch (mpe.getEntryKind()) {
      case APPLI:
        break;
      case IMPORT_PACKAGE:
        MindPackage mpackage = (MindPackage) resolvedBy;
        addSourceOrLibrary(allsrc, mpackage.getRootsrc());
        break;
      case LIBRARY:
        MindRootSrc rs = (MindRootSrc) resolvedBy;
        addSourceOrLibrary(allsrc, rs);
        break;
      case PROJECT:
        MindProject mp = (MindProject) resolvedBy;
        if (mp != currentProject) allsrc.addAll(mp.getAllsrc());
        break;
      case SOURCE:
        rs = (MindRootSrc) resolvedBy;
        addSourceOrLibrary(allsrc, rs);
        break;

      default:
        break;
    }
  }
예제 #9
0
 private void copyFields(
     final EObject objectWithReference,
     final Iterable<XtendMember> members,
     final Set<String> fieldNames) {
   boolean _not = (!(objectWithReference instanceof XtendClass));
   if (_not) {
     return;
   }
   final XtendClass type = ((XtendClass) objectWithReference);
   final ArrayList<XtendField> newFields = CollectionLiterals.<XtendField>newArrayList();
   Iterable<XtendField> _filter = Iterables.<XtendField>filter(members, XtendField.class);
   for (final XtendField field : _filter) {
     String _name = field.getName();
     boolean _contains = fieldNames.contains(_name);
     boolean _not_1 = (!_contains);
     if (_not_1) {
       final XtendField copiedMember = this._expressionCopier.<XtendField>cloneWithProxies(field);
       SourceAdapter.adapt(copiedMember, field);
       newFields.add(((XtendField) copiedMember));
       String _name_1 = field.getName();
       fieldNames.add(_name_1);
     }
   }
   EList<XtendMember> _members = type.getMembers();
   _members.addAll(newFields);
 }
예제 #10
0
 /**
  * return all model & instance files in a Workspace, i.e., files with the extension "aaxl"
  *
  * @return EList of IFiles that represent AADL model files
  */
 public EList<IFile> getAllModelFiles() {
   EList<IFile> result = new BasicEList<IFile>();
   IAadlProject[] projects = getOpenAadlProjects();
   for (int i = 0; i < projects.length; i++) {
     result.addAll(projects[i].getAllModelFiles());
   }
   return result;
 }
예제 #11
0
 public void recomputeAllSrc() {
   if (_allsrc == null) getAllsrc();
   else {
     BasicEList<MindRootSrc> newList = new BasicEList<MindRootSrc>();
     computeAllSrc(newList);
     _allsrc.retainAll(newList);
     _allsrc.addAll(newList);
   }
 }
예제 #12
0
 @Override
 public EList<AbstractActor> getAllVertices() {
   EList<AbstractActor> result = new BasicEList<AbstractActor>();
   for (AbstractActor aa : getVertices()) {
     result.add(aa);
     if (aa instanceof PiGraph) {
       result.addAll(((PiGraph) aa).getAllVertices());
     } else if (aa instanceof Actor) {
       Refinement refinement = ((Actor) aa).getRefinement();
       if (refinement != null) {
         AbstractActor subGraph = refinement.getAbstractActor();
         if (subGraph != null && subGraph instanceof PiGraph) {
           result.addAll(((PiGraph) subGraph).getAllVertices());
         }
       }
     }
   }
   return result;
 }
  /* (non-Javadoc)
   * @see com.hundsun.ares.studio.jres.model.core.impl.JRESResourceInfoImpl#getReferences()
   */
  @Override
  public EList<Reference> getReferences() {
    // TODO 1、引用标准字段
    // TODO 扩展属性表空间信息引用///////////未添加

    EList<Reference> references = new BasicEList<Reference>();
    // 表字段
    references.addAll(getColumnRef(getColumns()));
    // 表索引
    for (TableIndex index : getIndexes()) {
      references.addAll(getColumnIndexRef(index.getColumns()));
    }
    // 修订记录的扩展属性表空间
    for (Iterator<EObject> it = EcoreUtil.getAllContents(this, true); it.hasNext(); ) {
      EObject obj = it.next();
      if (obj instanceof IReferenceProvider) {
        references.addAll(((IReferenceProvider) obj).getReferences());
      }
    }
    return references;
  }
예제 #14
0
  /**
   * Save a list of EObjects to the resource with the given URI.
   *
   * @param eObjects the EObjects to be saved
   * @param resourceURI the URI of the resource, which should be used to save the EObjects
   * @throws IOException if saving to the resource fails
   */
  public void saveEObjectToResource(List<? extends EObject> eObjects, URI resourceURI)
      throws IOException {
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.createResource(resourceURI);
    EList<EObject> contents = resource.getContents();

    for (EObject eObject : eObjects) {
      contents.add(eObject);
    }

    contents.addAll(eObjects);
    resource.save(null);
  }
예제 #15
0
  public static void resolve(Context context, EList<BodyElement> elements) {
    List<BodyElement> resolved = new ArrayList<BodyElement>();
    for (int i = 0; i < elements.size(); i++) {
      BodyElement element = elements.get(i);
      if (element instanceof UnresolvedBodyElement) {
        UnresolvedBodyElement unresolved = (UnresolvedBodyElement) element;
        resolved.addAll(unresolved.resolve(context));
      } else {
        resolved.add(element);
      }
    }

    elements.clear();
    elements.addAll(resolved);
  }
예제 #16
0
  /**
   * Given a BO (XSD Complex Type), return a list of the attributes within the complexType.
   *
   * @param bo
   * @return List of XSDAttributeDeclaration
   */
  public static List<XSDAttributeDeclaration> getChildAttributes(XSDComplexTypeDefinition bo) {
    EList attrContents = bo.getAttributeContents();
    List<XSDAttributeDeclaration> attrs = new ArrayList<XSDAttributeDeclaration>();

    for (int i = 0; i < attrContents.size(); i++) {
      Object next = attrContents.get(i);

      // Attribute contents may include actual attribute declarations (wrapped in XSDAttributeUses)
      // or
      // attribute group definitions, containing bundles of attributes
      if (next instanceof XSDAttributeUse) {
        attrs.add(((XSDAttributeUse) next).getContent().getResolvedAttributeDeclaration());

      } else if (next instanceof XSDAttributeGroupDefinition) {

        // Add these attributes to the end of attrContents to be processed in turn
        XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) next;
        if (attrGroup.getResolvedAttributeGroupDefinition() != null)
          attrContents.addAll(attrGroup.getResolvedAttributeGroupDefinition().getAttributeUses());
      }
    }
    return attrs;
  }
  /**
   * Obtains the operations declared on the specified type.
   *
   * @param classifierName The name of the classifier which operation are sought.
   * @return The operations it declares. <code>null</code> if none.
   */
  public synchronized EList<EOperation> getExistingOperations(String classifierName) {
    EList<EOperation> result = new BasicEList<EOperation>();

    if (PRIMITIVE_STRING_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(stringType.getEOperations()));
    } else if (TYPE_OCLANY_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(oclAnyType.getEOperations()));
    } else if (TYPE_EOBJECT_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(eObjectType.getEOperations()));
    } else if (TYPE_COLLECTION_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(collectionType.getEOperations()));
    } else if (TYPE_ORDEREDSET_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(orderedSetType.getEOperations()));
    } else if (TYPE_SEQUENCE_NAME.equals(classifierName)) {
      result.addAll(EcoreUtil.copyAll(sequenceType.getEOperations()));
    }
    return result;
  }
예제 #18
0
 public boolean addAll(int index, java.util.Collection<? extends E> c) {
   copy.addAll(index, c);
   return original.addAll(index, c);
 }
예제 #19
0
 protected static void _privk3_step(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final Hashtable<String, Object> context,
     final EList<String> events) {
   boolean allJunctionsAttended = false;
   while ((!allJunctionsAttended)) {
     {
       ArrayList<AbstractState> currentState =
           RegionAspect.getCurrentState(_self, context, events);
       ArrayList<Transition> currentTransitions = new ArrayList<Transition>();
       ArrayList<AbstractState> attendedStates = new ArrayList<AbstractState>();
       ArrayList<AbstractState> newStates = new ArrayList<AbstractState>();
       EList<Transition> activeTransitions = new BasicEList<Transition>();
       for (final AbstractState _state : currentState) {
         EList<Transition> _activeTransitions =
             RegionAspect.getActiveTransitions(_self, _state, events);
         activeTransitions.addAll(_activeTransitions);
       }
       for (final Transition transition : activeTransitions) {
         {
           RegionAspect.findOldActiveStates(_self, attendedStates, transition, context);
           RegionAspect.findNewActiveTransitions(_self, currentTransitions, transition, context);
           RegionAspect.findNewActiveStates(
               _self, newStates, transition, currentTransitions, context);
         }
       }
       for (final AbstractState _attendedState : attendedStates) {
         if ((_attendedState instanceof State)) {
           StateAspect.exitState(((State) _attendedState), context);
         }
       }
       RegionAspect.removeStatesFromContext(_self, context, attendedStates);
       RegionAspect.addStatesToContext(_self, context, newStates);
       final Consumer<Transition> _function =
           (Transition transition_1) -> {
             TransitionAspect.evalTransition(transition_1, context);
           };
       activeTransitions.forEach(_function);
       final Consumer<Transition> _function_1 =
           (Transition transition_1) -> {
             boolean _alreadyFired = TransitionAspect.alreadyFired(transition_1, context);
             boolean _not = (!_alreadyFired);
             if (_not) {
               TransitionAspect.evalTransition(transition_1, context);
             }
           };
       currentTransitions.forEach(_function_1);
       final Consumer<AbstractState> _function_2 =
           (AbstractState state) -> {
             EList<Transition> _outgoing = state.getOutgoing();
             final Consumer<Transition> _function_3 =
                 (Transition transition_1) -> {
                   TransitionAspect.resetFired(transition_1);
                 };
             _outgoing.forEach(_function_3);
           };
       newStates.forEach(_function_2);
       final ArrayList<AbstractState> currentConditionalState = new ArrayList<AbstractState>();
       Set<String> _keySet = context.keySet();
       Iterator<String> _it = _keySet.iterator();
       while (_it.hasNext()) {
         {
           String _key = _it.next();
           Object _value = context.get(_key);
           boolean _startsWith = _key.startsWith("currentState");
           if (_startsWith) {
             final Consumer<AbstractState> _function_3 =
                 (AbstractState _vertex) -> {
                   currentConditionalState.add(_vertex);
                 };
             ((ArrayList<AbstractState>) _value).forEach(_function_3);
           }
         }
       }
       String _name = _self.getName();
       String _plus = ("currentState-" + _name);
       Object _get = context.get(_plus);
       currentState = ((ArrayList<AbstractState>) _get);
       final Function1<AbstractState, Boolean> _function_3 =
           (AbstractState _vertex) -> {
             EList<Transition> _outgoing = _vertex.getOutgoing();
             final Function1<Transition, Boolean> _function_4 =
                 (Transition _outgoing_1) -> {
                   boolean _and = false;
                   AbstractState _target = _outgoing_1.getTarget();
                   if (!(_target instanceof Pseudostate)) {
                     _and = false;
                   } else {
                     AbstractState _target_1 = _outgoing_1.getTarget();
                     _and = (_target_1 instanceof Junction);
                   }
                   return Boolean.valueOf(_and);
                 };
             return Boolean.valueOf(IterableExtensions.<Transition>exists(_outgoing, _function_4));
           };
       boolean _exists = IterableExtensions.<AbstractState>exists(currentState, _function_3);
       boolean _not = (!_exists);
       allJunctionsAttended = _not;
     }
   }
 }
  /**
   * Validate the model. All checks are performed for all automata in the file. This method checks
   * that
   *
   * <ul>
   *   <li>only allowed extension are used. Allowed extension are {@link
   *       org.ect.ea.extensions.clocks.AutomatonClocksProvider}, {@link
   *       org.ect.ea.extensions.clocks.TCADataConstraintsProvider}, {@link
   *       org.ect.ea.extensions.constraints.ConstraintExtensionProvider}, {@link
   *       org.ect.ea.extensions.startstates.StartStateExtensionProvider}, {@link
   *       org.ect.ea.extensions.portnames.AutomatonPortNamesProvider}, {@link
   *       org.ect.ea.extensions.portnames.TransitionPortNamesProvider}, {@link
   *       org.ect.ea.extensions.clocks.TransitionUpdateProvider}, {@link
   *       org.ect.ea.extensions.clocks.TransitionGuardProvider}, {@link
   *       org.ect.ea.extension.stateMemory.StateMemoryExtensionProvider} and {@link
   *       org.ect.ea.extensions.clocks.StateInvariantProvider}.
   *   <li>all required extensions are used. Required extensions are {@link
   *       org.ect.ea.extensions.startstates.StartStateExtensionProvider}, {@link
   *       org.ect.ea.extensions.portnames.AutomatonPortNamesProvider} and {@link
   *       org.ect.ea.extensions.portnames.TransitionPortNamesProvider}.
   *   <li>depending on whether the automaton is a CA or a TCA, some other extensions are required
   *       and forbidden:
   *       <ul>
   *         <li>Required extensions of TCA are {@link
   *             org.ect.ea.extensions.clocks.TCADataConstraintsProvider}, {@link
   *             org.ect.ea.extensions.clocks.AutomatonClocksProvider}, {@link
   *             org.ect.ea.extensions.clocks.TransitionGuardProvider}, {@link
   *             org.ect.ea.extensions.clocks.TransitionUpdateProvider} and {@link
   *             org.ect.ea.extensions.clocks.StateInvariantProvider}. These are also the forbidden
   *             extensions for CA.
   *         <li>Forbidden extensions of TCA are {@link
   *             org.ect.ea.extensions.constraints.ConstraintExtensionProvider}. These are also the
   *             required extensions for CA.
   *       </ul>
   *   <li>all names (except for memory cells and ports) are unique within the system.
   *   <li>memory cell names may occur more than once in one automaton, but must be unique between
   *       different automata, and must not equal any other name.
   *   <li>port names may be shared between automata, but must be different from all other names
   *   <li>there exists exactly one start state per automaton.
   *   <li>untimed CA (that means without clock extensions) do not have transitions with empty name
   *       set
   *   <li>TCA transition with empty name set do not have an associated data constraint
   *   <li>there exist no names {@link org.ect.ea.extensions.clocks.ClockUtils#GLOBAL_CLOCK} or
   *       {@link org.ect.ea.extensions.clocks.ClockUtils#NO_FLOW_NAME}
   *   <li>the range of data values is well-formed, i.e. either on the form
   *       <tt>lowerBound..upperBound</tt>, with <tt>lowerBound=0</tt>, <tt>upperBound>=1</tt>, or
   *       empty (for infinite data domain)
   *   <li>integer values in the data constraints lie within the given range
   *   <li>unfolding depth is at least 1
   *   <li>the target language is one of [mathsat,msat]
   *   <li>the output file name is not empty
   * </ul>
   */
  public IStatus validateGenModel(IGenModel genModel) {

    EList<Automaton> automata = ((Automaton) genModel.getTarget()).getModule().getAutomata();

    String projectName = genModel.getProperty(IGenModel.PROJECT_NAME);
    if (projectName == null || projectName.equals("")) {
      return new Status(IStatus.ERROR, PLUGIN_ID, "Project name cannot be empty.");
    }

    String rng = genModel.getProperty(CodegenUtils.PROPERTY_RANGE);
    // rng = rng.replace("..", ",");

    String targetlang = genModel.getProperty("targetlang");

    // for temporary usage
    // String tempS = "";
    EList<String> tempL = new BasicEList<String>();
    boolean tempB;

    /* check extensions */
    /* Every automaton must support the automaton port names, transition
     * port names, and start state extension, and may support the state
     * memory extension.
     * If the automaton is a CA (untimed), it must support the constraint
     * extension, and must not support the TCA data constraint,
     * automaton clocks, transition guard, transition update and
     * invariant extension.
     * If the automaton is a TCA (timed), it must support the TCA data
     * constraint, automaton clocks, transition guard, transition update and
     * invariant extension, and must not support the constraint extension.
     * */

    // check that only allowed extensions are used
    // note that not all these extensions can be used at the same time
    final EList<String> allowedExtensions = new BasicEList<String>();
    allowedExtensions.add(ClockUtils.STATE_MEMORY_ID);
    allowedExtensions.add(ClockUtils.AUTOMATON_CLOCKS_ID);
    allowedExtensions.add(ClockUtils.TRANSITION_GUARD_ID);
    allowedExtensions.add(ClockUtils.TRANSITION_UPDATE_ID);
    allowedExtensions.add(ClockUtils.INVARIANT_ID);
    allowedExtensions.add(ClockUtils.DATA_CONSTRAINT_ID);
    allowedExtensions.add(ClockUtils.CONSTRAINT_ID);
    allowedExtensions.add(ClockUtils.AUTOMATON_PORT_NAMES_ID);
    allowedExtensions.add(ClockUtils.TRANSITION_PORT_NAMES_ID);
    allowedExtensions.add(ClockUtils.START_STATE_ID);

    final EList<String> requiredExtensions = new BasicEList<String>();
    requiredExtensions.add(ClockUtils.START_STATE_ID);
    requiredExtensions.add(ClockUtils.AUTOMATON_PORT_NAMES_ID);
    requiredExtensions.add(ClockUtils.TRANSITION_PORT_NAMES_ID);

    final EList<String> requiredCAExtensions = new BasicEList<String>();
    requiredCAExtensions.add(ClockUtils.CONSTRAINT_ID);

    final EList<String> forbiddenCAExtensions = new BasicEList<String>();
    forbiddenCAExtensions.add(ClockUtils.DATA_CONSTRAINT_ID);
    forbiddenCAExtensions.add(ClockUtils.AUTOMATON_CLOCKS_ID);
    forbiddenCAExtensions.add(ClockUtils.TRANSITION_GUARD_ID);
    forbiddenCAExtensions.add(ClockUtils.TRANSITION_UPDATE_ID);
    forbiddenCAExtensions.add(ClockUtils.INVARIANT_ID);

    final EList<String> requiredTCAExtensions = new BasicEList<String>(forbiddenCAExtensions);
    final EList<String> forbiddenTCAExtensions = new BasicEList<String>(requiredCAExtensions);

    EList<String> names = new BasicEList<String>(); // to check uniqueness of names
    Set<String> portNames =
        new HashSet<
            String>(); // port names can be shared, but must be different from other names, use set
                       // to automatically remove duplicates

    boolean timed = false;
    boolean untimed = false;
    boolean allMem = false;
    boolean noMem = false;

    for (Automaton automaton : automata) {

      // add automaton name to global name set name
      names.add(automaton.getName());

      // check that only allowed extensions are used
      final EList<String> usedExtensions = automaton.getUsedExtensionIds();
      if (!allowedExtensions.containsAll(usedExtensions)) {
        tempL.clear();
        tempL.addAll(usedExtensions);
        tempL.removeAll(allowedExtensions);
        return new Status(
            IStatus.ERROR, PLUGIN_ID, "Extension(s) used but not supported: " + tempL);
      }

      // check that all required extensions are used
      if (!usedExtensions.containsAll(requiredExtensions)) {
        tempL.clear();
        tempL.addAll(requiredExtensions);
        tempL.removeAll(usedExtensions);
        return new Status(
            IStatus.ERROR, PLUGIN_ID, automaton.getName() + "must support extension(s): " + tempL);
      }

      // check that exactly one of the constraint extensions is used, infer CA or TCA from that
      if (usedExtensions.contains(ClockUtils.DATA_CONSTRAINT_ID)) {
        timed = true;
        if (untimed == true) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "All automata must support same constraint extension, either "
                  + ClockUtils.DATA_CONSTRAINT_ID
                  + " or "
                  + ClockUtils.CONSTRAINT_ID);
        }
      }
      if (usedExtensions.contains(ClockUtils.CONSTRAINT_ID)) {
        untimed = true;
        if (timed == true) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "All automata must support same constraint extension, either "
                  + ClockUtils.DATA_CONSTRAINT_ID
                  + " or "
                  + ClockUtils.CONSTRAINT_ID);
        }
      }
      if (!(timed || untimed)) { // no constraint extension is used
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "All automata must support same constraint extension, either "
                + ClockUtils.DATA_CONSTRAINT_ID
                + " or "
                + ClockUtils.CONSTRAINT_ID);
      }

      // if CA: check for required and forbidden extensions
      if (untimed) {
        if (!usedExtensions.containsAll(requiredCAExtensions)) {
          tempL.clear();
          tempL.addAll(requiredCAExtensions);
          tempL.removeAll(usedExtensions);
          return new Status(
              IStatus.ERROR, PLUGIN_ID, "Untimed CA must support extension(s): " + tempL);
        }
        tempL.clear();
        tempL.addAll(usedExtensions);
        tempL.addAll(forbiddenCAExtensions);
        tempL = new StringListExtension(tempL).getDuplicateEntries();
        if (!tempL.isEmpty()) {
          return new Status(
              IStatus.ERROR, PLUGIN_ID, "Untimed CA must not support extension(s): " + tempL);
        }
      }
      // if TCA: check for required and forbidden extensions
      if (timed) {

        if (!usedExtensions.containsAll(requiredTCAExtensions)) {
          tempL.clear();
          tempL.addAll(requiredTCAExtensions);
          tempL.removeAll(usedExtensions);
          return new Status(IStatus.ERROR, PLUGIN_ID, "TCA must support extension(s): " + tempL);
        }
        tempL.clear();
        tempL.addAll(usedExtensions);
        tempL.addAll(forbiddenTCAExtensions);
        tempL = new StringListExtension(tempL).getDuplicateEntries();
        if (!tempL.isEmpty()) {
          return new Status(
              IStatus.ERROR, PLUGIN_ID, "TCA must not support extension(s): " + tempL);
        }
      }

      // check that the automaton has states (otherwise, code generation does not make sense)
      if (automaton.getStates().isEmpty()) {
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "Automaton does not have states, code generation does not make sense.");
      }

      // check that the automaton has transitions (otherwise, code generation does not make sense)
      if (automaton.getTransitions().isEmpty()) {
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "Automaton does not have transitions, code generation does not make sense.");
      }

      // check for state memory extension
      if (usedExtensions.contains(ClockUtils.STATE_MEMORY_ID)) {
        allMem = true;
        if (noMem) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "State memory must be support by all automata or not at all.");
        }
      } else {
        noMem = true;
        if (allMem) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "State memory must be support by all automata or not at all.");
        }
      }

      // create EList of memory cell names (if memory cells are used)
      if (allMem) {
        EList<String> thisAutoMemCells = new BasicEList<String>();
        for (State s : automaton.getStates()) {
          try {
            tempL =
                StringListExtension.parse(s.findExtension(ClockUtils.STATE_MEMORY_ID).toString())
                    .getValues(); // memory cells of current state
            if (!tempL.isEmpty()) { // empty if state does not have memory cells
              thisAutoMemCells.addAll(tempL);
            }
          } catch (ParseException pe) {
            return new Status(
                IStatus.ERROR,
                PLUGIN_ID,
                "Unexpected error while trying to parse memory cells of " + s.getName());
          }
        }
        // remove duplicate cells from current automaton
        StringListExtension sle = new StringListExtension(thisAutoMemCells);
        sle.removeDuplicateEntries();
        // add names to global EList (checked later)
        tempL = sle.getValues();
        for (String s : tempL) {
          names.add(s);
        }
      }

      // add state names to global name set (checked later), and check for initial states
      tempB = false; // for initial states
      for (State s : automaton.getStates()) {
        if (s.getName() == null || s.getName().equals("")) {
          return new Status(IStatus.ERROR, PLUGIN_ID, "States must have a name.");
        }
        names.add(s.getName());
        if (CA.isStartState(s)) {
          if (tempB == true) {
            return new Status(
                IStatus.ERROR, PLUGIN_ID, "Each automaton must have exactly one initial location");
          }
          tempB = true;
        }
        if (!tempB) {
          return new Status(
              IStatus.ERROR, PLUGIN_ID, "Each automaton must have exactly one initial location");
        }
      }

      // untimed CA transitions must not have empty name set
      if (untimed) {
        for (Transition t : automaton.getTransitions()) {
          if (((StringListExtension) t.findExtension(ClockUtils.TRANSITION_PORT_NAMES_ID))
              .getValues()
              .isEmpty()) {
            return new Status(
                IStatus.ERROR, PLUGIN_ID, "Transitions of untimed CA must not have empty name set");
          }
        }
      }

      // TCA transitions with the empty name set must not have a data
      // constraint on ports (only memory cells)
      // actually this check should not be necessary, it is checked during editing (by the parser)
      // already
      if (timed) {
        for (Transition t : automaton.getTransitions()) {
          if (((StringListExtension) t.findExtension(ClockUtils.TRANSITION_PORT_NAMES_ID))
              .getValues()
              .isEmpty()) { // found transition with empty port set
            // get the constraint
            String cons = t.findExtension(ClockUtils.DATA_CONSTRAINT_ID).toString();
            TCADataParser parser = new TCADataParser(cons);
            try {
              tempL = parser.get_port_names();
              if (!tempL.isEmpty()) {
                return new Status(
                    IStatus.ERROR,
                    PLUGIN_ID,
                    "Invisible transitions (with empty port set) must not have a data constraint on ports.");
              }
            } catch (RecognitionException pe) {
              return new Status(
                  IStatus.ERROR, PLUGIN_ID, "Unexpected error while trying to parse " + cons);
            }
          }
        }
      }

      // add clock names to global name set (checked later)
      if (timed) {
        for (String c : ClockUtils.getClocks(automaton)) {
          names.add(c);
        }
      }

      // add port names to global port name set (checked later)
      for (String p :
          ((StringListExtension) automaton.findExtension(ClockUtils.AUTOMATON_PORT_NAMES_ID))
              .getValues()) {
        portNames.add(p);
      }
    }

    // check range of data values
    // either 'lowerBound..upperBound' or empty (=infinite)
    if (rng.trim().equals("")) {
      infinite = true;
    } else {
      infinite = false;
      if (!rng.contains("..")) {
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "Finite range must be given in the form '0..upperBound'.\nupperBound must be an integer value strictly greater than 0.");
      }
      try {
        lowerBound = Integer.parseInt(rng.substring(0, rng.indexOf(".")));
        if (lowerBound != 0) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "Finite range must be given in the form '0..upperBound'.\nLower bounds other than 0 are not (yet) supported.");
        }
      } catch (NumberFormatException nfe) {
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "Finite range must be given in the form '0..upperBound'.\nLower bounds other than 0 are not (yet) supported.");
      }
      try {
        upperBound = Integer.parseInt(rng.substring(rng.lastIndexOf(".") + 1, rng.length()));
        if (upperBound < 1) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "Finite range must be given in the form '0..upperBound'.\nupperBound must be an integer value strictly greater than 0.");
        }
      } catch (NumberFormatException nfe) {
        return new Status(
            IStatus.ERROR,
            PLUGIN_ID,
            "Finite range must be given in the form '0..upperBound'.\nupperBound must be an integer value strictly greater than 0.");
      }
    }

    // check that integer values used in data constraints are within the range (if finite)
    if (!infinite) {
      int min = -1;
      int max = 0;
      for (Automaton automaton : automata) {
        for (Transition t : automaton.getTransitions()) {
          String cons = t.findExtension(ClockUtils.DATA_CONSTRAINT_ID).toString();
          TCADataParser parser = new TCADataParser(cons);
          try {
            tempL = parser.get_minmax_int_values();
            min = Math.min(min, Integer.parseInt(tempL.get(0)));
            max = Math.max(max, Integer.parseInt(tempL.get(1)));
          } catch (RecognitionException re) {
            return new Status(
                IStatus.ERROR, PLUGIN_ID, "Unexpected error while trying to parse " + cons);
          }
        }
        if ((min < -1) || (max > this.upperBound)) {
          return new Status(
              IStatus.ERROR,
              PLUGIN_ID,
              "Integer values in data constraints are outside declared range.");
        }
      }
    }

    // check for spaces in all but port names
    for (String s : names) {
      if (s.contains(" ")) {
        return new Status(IStatus.ERROR, PLUGIN_ID, "Names must not contain spaces: '" + s + "'");
      }
    }

    // check for duplicate names in all but port names
    tempL = new StringListExtension(names).getDuplicateEntries();
    if (!tempL.isEmpty()) {
      return new Status(
          IStatus.ERROR,
          PLUGIN_ID,
          "Names (except for port names) must not be shared between automata: "
              + tempL.toString().replace("[", "").replace("]", ""));
    }

    // check for spaces in port names
    for (String p : portNames) {
      if (p.contains(" ")) {
        return new Status(IStatus.ERROR, PLUGIN_ID, "Names must not contain spaces: '" + p + "'");
      }
    }

    // compare port names with all other names, check for duplicates between the two sets
    StringListExtension sle = new StringListExtension(portNames);
    sle.removeDuplicateEntries();
    tempL = sle.getValues();
    tempL.addAll(names);
    tempL = new StringListExtension(tempL).getDuplicateEntries();
    if (!tempL.isEmpty()) {
      return new Status(
          IStatus.ERROR,
          PLUGIN_ID,
          "Names must be unique: " + tempL.toString().replace("[", "").replace("]", ""));
    }

    // check for reserved names CodegenUtils.NO_FLOW_NAME and CodegenUtils.GLOBAL_CLOCK
    if (names.contains(CodegenUtils.NO_FLOW_NAME)
        || portNames.contains(CodegenUtils.NO_FLOW_NAME)) {
      return new Status(
          IStatus.ERROR, PLUGIN_ID, "'" + CodegenUtils.NO_FLOW_NAME + "' is a reserved name. ");
    }
    if (names.contains(CodegenUtils.GLOBAL_CLOCK)
        || portNames.contains(CodegenUtils.GLOBAL_CLOCK)) {
      return new Status(
          IStatus.ERROR, PLUGIN_ID, "'" + CodegenUtils.GLOBAL_CLOCK + "' is a reserved name. ");
    }

    // check that the unfolding depth is at least 1
    try {
      unfoldingDepth = Integer.valueOf(genModel.getProperty(CodegenUtils.PROPERTY_DEPTH));
    } catch (NumberFormatException nfe) {
      return new Status(
          IStatus.ERROR, PLUGIN_ID, "Not a valid unfolding depth: chose an integer > 0");
    }
    if (!(unfoldingDepth > 0)) {
      return new Status(
          IStatus.ERROR, PLUGIN_ID, "Not a valid unfolding depth: chose an integer > 0");
    }

    // check that target language is one of the supported languages, hard code for the moment
    if (!targetlang.equalsIgnoreCase("mathsat") && !targetlang.equalsIgnoreCase("msat")) {
      return new Status(IStatus.ERROR, PLUGIN_ID, "Target language must be one of [mathsat|msat]");
    } else { // to standardise the property contents
      genModel.setProperty("targetlang", mathsat);
    }

    // check that output file name is not empty
    if (genModel.getProperty(CodegenUtils.PROPERTY_FILENAME).isEmpty()) {
      return new Status(IStatus.ERROR, PLUGIN_ID, "Output file name cannot be empty");
    }

    /* If none of the above occurs, the model is ok */
    return Status.OK_STATUS;
  }