Ejemplo n.º 1
0
  @Check
  public void checkUniqueResultColumnAliases(SelectList list) {
    EList<ColumnSource> cols = list.getResultColumns();

    for (int i = 0; i < cols.size(); i++) {
      ColumnSource subject = cols.get(i);
      int matches = 0;
      for (int j = 0; j < cols.size(); j++) {
        ColumnSource target = cols.get(j);

        if (subject.getName() != null
            && target.getName() != null
            && subject.getName().equalsIgnoreCase(target.getName())) {
          matches++;
        }

        if (matches > 1) {
          error(
              "Duplicate alias not allowed",
              target,
              SqliteModelPackage.Literals.COLUMN_SOURCE__NAME,
              -1);
          return;
        }
      }
    }
  }
Ejemplo n.º 2
0
 public FlattenedGrammarAccess(final RuleNames names, final RuleFilter filter) {
   final Grammar grammar = names.getContextGrammar();
   Grammar flattenedGrammar = this.<Grammar>copy(grammar);
   String _name = grammar.getName();
   flattenedGrammar.setName(_name);
   LinkedHashMap<RuleWithParameterValues, AbstractRule> origToCopy =
       Maps.<RuleWithParameterValues, AbstractRule>newLinkedHashMap();
   List<AbstractRule> _rules = filter.getRules(grammar);
   boolean _isDiscardRuleTypeRef = filter.isDiscardRuleTypeRef();
   final ArrayList<AbstractRule> copies =
       this.copyRuleStubs(names, origToCopy, _rules, _isDiscardRuleTypeRef);
   EList<AbstractRule> _rules_1 = flattenedGrammar.getRules();
   Iterables.<AbstractRule>addAll(_rules_1, copies);
   Multimap<TerminalRule, AbstractRule> calledFrom = this.copyRuleBodies(copies, origToCopy);
   this.setHiddenTokens(flattenedGrammar, grammar, origToCopy);
   this.markAsFragment(calledFrom);
   boolean _isDiscardUnreachableRules = filter.isDiscardUnreachableRules();
   if (_isDiscardUnreachableRules) {
     Set<AbstractRule> usedRules = CollectionLiterals.<AbstractRule>newHashSet();
     boolean _isDiscardTerminalRules = filter.isDiscardTerminalRules();
     boolean _not = (!_isDiscardTerminalRules);
     if (_not) {
       List<TerminalRule> _allTerminalRules = GrammarUtil.allTerminalRules(flattenedGrammar);
       usedRules.addAll(_allTerminalRules);
     }
     UsedRulesFinder finder = new UsedRulesFinder(usedRules);
     finder.compute(flattenedGrammar);
     EList<AbstractRule> _rules_2 = flattenedGrammar.getRules();
     _rules_2.retainAll(usedRules);
   }
   this.flattenedGrammar = flattenedGrammar;
   OriginalGrammar _originalGrammar = new OriginalGrammar(grammar);
   _originalGrammar.attachToEmfObject(flattenedGrammar);
 }
 @Override
 public void run(
     VariantTableContent content,
     Resource resource,
     IProgressMonitor monitor,
     Map<String, VCObject> seenObjects,
     List<Option> options)
     throws Exception {
   VariantTable table = content.getTable();
   JCoFunction deletefunc = maintainEntries(content, monitor, options, true);
   executeTransaction(monitor, "DELETE " + table.getName(), deletefunc);
   JCoFunction createfunc = maintainEntries(content, monitor, options, false);
   JCoTable entries = createfunc.getTableParameterList().getTable("VAR_TAB_ENTRIES");
   EList<Row> rows = content.getRows();
   List<VariantTableArgument> arguments = table.getArguments();
   for (Row row : rows) {
     for (VariantTableArgument arg : arguments) {
       String cstic = arg.getCharacteristic().getName();
       int index = arguments.indexOf(arg);
       entries.appendRow();
       Literal literal = row.getValues().get(index);
       entries.setValue("VTCHARACT", cstic);
       entries.setValue("VTLINENO", "" + rows.indexOf(row));
       entries.setValue("VTVALUE", getValue(literal));
     }
   }
   executeTransaction(monitor, "CREATE/CHANGE " + table.getName(), createfunc);
 }
Ejemplo n.º 4
0
 public List<String> initialHiddenTokens(final Grammar it) {
   List<String> _xblockexpression = null;
   {
     boolean _isDefinesHiddenTokens = it.isDefinesHiddenTokens();
     if (_isDefinesHiddenTokens) {
       EList<AbstractRule> _hiddenTokens = it.getHiddenTokens();
       final Function1<AbstractRule, String> _function =
           new Function1<AbstractRule, String>() {
             @Override
             public String apply(final AbstractRule it) {
               return GrammarAccessExtensions.this.ruleName(it);
             }
           };
       List<String> _map = ListExtensions.<AbstractRule, String>map(_hiddenTokens, _function);
       return IterableExtensions.<String>toList(_map);
     }
     EList<Grammar> _usedGrammars = it.getUsedGrammars();
     int _size = _usedGrammars.size();
     boolean _equals = (_size == 1);
     if (_equals) {
       EList<Grammar> _usedGrammars_1 = it.getUsedGrammars();
       Grammar _head = IterableExtensions.<Grammar>head(_usedGrammars_1);
       return this.initialHiddenTokens(_head);
     }
     _xblockexpression = CollectionLiterals.<String>emptyList();
   }
   return _xblockexpression;
 }
  private void addResultToList(
      org.emftext.sdk.concretesyntax.resource.cs.ICsReferenceMapping<ReferenceType> mapping,
      org.eclipse.emf.ecore.EObject proxy,
      org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> list) {
    org.eclipse.emf.ecore.EObject target = null;
    int proxyPosition = list.indexOf(proxy);

    if (mapping instanceof org.emftext.sdk.concretesyntax.resource.cs.ICsElementMapping<?>) {
      target =
          ((org.emftext.sdk.concretesyntax.resource.cs.ICsElementMapping<ReferenceType>) mapping)
              .getTargetElement();
    } else if (mapping instanceof org.emftext.sdk.concretesyntax.resource.cs.ICsURIMapping<?>) {
      target = org.eclipse.emf.ecore.util.EcoreUtil.copy(proxy);
      org.eclipse.emf.common.util.URI uri =
          ((org.emftext.sdk.concretesyntax.resource.cs.ICsURIMapping<ReferenceType>) mapping)
              .getTargetIdentifier();
      ((org.eclipse.emf.ecore.InternalEObject) target).eSetProxyURI(uri);
    } else {
      assert false;
    }
    try {
      // if target is an another proxy and list is "unique" add() will try to resolve
      // the new proxy to check for uniqueness. There seems to be no way to avoid that.
      // Until now this does not cause any problems.
      if (proxyPosition + 1 == list.size()) {
        list.add(target);
      } else {
        list.add(proxyPosition + 1, target);
      }
    } catch (Exception e1) {
      e1.printStackTrace();
    }
  }
Ejemplo n.º 6
0
  protected Node processWildcard(XSDWildcard wildcard, Node parentNode) throws RepositoryException {
    if (wildcard == null) {
      return null;
    }
    logger.debug("Any Attribute");

    Node anyAttributeNode = parentNode.addNode(XsdLexicon.ANY_ATTRIBUTE, XsdLexicon.ANY_ATTRIBUTE);

    @SuppressWarnings("unchecked")
    EList<String> nsConstraints = wildcard.getNamespaceConstraint();
    if (nsConstraints != null && !nsConstraints.isEmpty()) {
      Set<String> values = new HashSet<String>();
      for (String nsConstraint : nsConstraints) {
        if (nsConstraint == null) continue;
        nsConstraint = nsConstraint.trim();
        if (nsConstraint.length() == 0) continue;
        values.add(nsConstraint);
      }
      if (!values.isEmpty()) {
        anyAttributeNode.setProperty(
            XsdLexicon.NAMESPACE, values.toArray(new String[values.size()]));
      }
    }
    if (wildcard.getProcessContents() != null) {
      XSDProcessContents processContents = wildcard.getProcessContents();
      anyAttributeNode.setProperty(XsdLexicon.PROCESS_CONTENTS, processContents.getLiteral());
    }
    processAnnotation(wildcard.getAnnotation(), anyAttributeNode);
    processNonSchemaAttributes(wildcard, anyAttributeNode);
    return anyAttributeNode;
  }
Ejemplo n.º 7
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case CDAPackage.RELATED_ENTITY__REALM_CODE:
       return realmCodes != null && !realmCodes.isEmpty();
     case CDAPackage.RELATED_ENTITY__TYPE_ID:
       return typeId != null;
     case CDAPackage.RELATED_ENTITY__TEMPLATE_ID:
       return templateIds != null && !templateIds.isEmpty();
     case CDAPackage.RELATED_ENTITY__CODE:
       return code != null;
     case CDAPackage.RELATED_ENTITY__ADDR:
       return addrs != null && !addrs.isEmpty();
     case CDAPackage.RELATED_ENTITY__TELECOM:
       return telecoms != null && !telecoms.isEmpty();
     case CDAPackage.RELATED_ENTITY__EFFECTIVE_TIME:
       return effectiveTime != null;
     case CDAPackage.RELATED_ENTITY__RELATED_PERSON:
       return relatedPerson != null;
     case CDAPackage.RELATED_ENTITY__SDTC_PATIENT:
       return sDTCPatient != null;
     case CDAPackage.RELATED_ENTITY__NULL_FLAVOR:
       return isSetNullFlavor();
     case CDAPackage.RELATED_ENTITY__CLASS_CODE:
       return isSetClassCode();
   }
   return super.eIsSet(featureID);
 }
 @Test
 public void testRemoveElementInSameLine() {
   try {
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("entities");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("Foo \"Bar\" /* the foo */ Baz \"Fizzle\"");
     _builder.newLine();
     _builder.append("end");
     _builder.newLine();
     final Model model = this._parseHelper.parse(_builder);
     DomainModel _domainModel = model.getDomainModel();
     EList<Entity> _entities = _domainModel.getEntities();
     _entities.remove(1);
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("entities");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("Foo \"Bar\" /* the foo */");
     _builder_1.newLine();
     _builder_1.append("end");
     this.assertSerializesTo(model, _builder_1);
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Override
 public EList<EStructuralFeature> GetEStructuralFeature() {
   // TODO Auto-generated method stub
   EList<EStructuralFeature> list_feat = new BasicEList<EStructuralFeature>();
   list_feat.add(GetEClass().getEStructuralFeature("name"));
   return list_feat;
 }
  void createDefinitionsIfMissing() {
    EList<EObject> contents = resource.getContents();

    if (contents.isEmpty() || !(contents.get(0) instanceof DocumentRoot)) {
      TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);

      if (domain != null) {
        final DocumentRoot docRoot = FACTORY.createDocumentRoot();
        final Definitions definitions = FACTORY.createDefinitions();
        //				definitions.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(definitions, resource);
        Collaboration collaboration = FACTORY.createCollaboration();
        //				collaboration.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(collaboration, resource);
        Participant participant = FACTORY.createParticipant();
        //				participant.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(participant, resource);
        participant.setName("Internal");
        collaboration.getParticipants().add(participant);
        definitions.getRootElements().add(collaboration);

        domain
            .getCommandStack()
            .execute(
                new RecordingCommand(domain) {
                  @Override
                  protected void doExecute() {
                    docRoot.setDefinitions(definitions);
                    resource.getContents().add(docRoot);
                  }
                });
        return;
      }
    }
  }
 @Test
 public void testAddElementAfterInlineComment() {
   try {
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("entities");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("Foo \"Bar\"\t//inline comment before inserted element");
     _builder.newLine();
     _builder.append("end");
     _builder.newLine();
     final Model model = this._parseHelper.parse(_builder);
     Entity _createEntity = HiddentokensequencertestFactory.eINSTANCE.createEntity();
     final Procedure1<Entity> _function =
         (Entity it) -> {
           it.setName("Baz");
           it.setDescription("Fizzle");
         };
     final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
     DomainModel _domainModel = model.getDomainModel();
     EList<Entity> _entities = _domainModel.getEntities();
     _entities.add(event);
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("entities");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("Foo \"Bar\"\t//inline comment before inserted element");
     _builder_1.newLine();
     _builder_1.append("Baz \"Fizzle\" end");
     this.assertSerializesTo(model, _builder_1);
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
Ejemplo n.º 12
0
 protected static void _privk3_getAllChildren(
     final RegionAspectRegionAspectProperties _self_,
     final Region _self,
     final AbstractState vertex,
     final ArrayList<AbstractState> children) {
   if ((vertex instanceof State)) {
     EList<Region> _ownedRegions = ((State) vertex).getOwnedRegions();
     boolean _notEquals = (!Objects.equal(_ownedRegions, null));
     if (_notEquals) {
       EList<Region> _ownedRegions_1 = ((State) vertex).getOwnedRegions();
       final Consumer<Region> _function =
           (Region _region) -> {
             EList<AbstractState> _subvertex = _region.getSubvertex();
             children.addAll(_subvertex);
             EList<AbstractState> _subvertex_1 = _region.getSubvertex();
             final Consumer<AbstractState> _function_1 =
                 (AbstractState _vertex) -> {
                   RegionAspect.getAllChildren(_self, _vertex, children);
                 };
             _subvertex_1.forEach(_function_1);
           };
       _ownedRegions_1.forEach(_function);
     }
   }
 }
Ejemplo n.º 13
0
 @Override
 public int category(Object element) {
   if (element instanceof RepositoryNode) {
     RepositoryNode node = (RepositoryNode) element;
     if (ERepositoryObjectType.METADATA_CON_COLUMN.equals(
         node.getProperties(EProperties.CONTENT_TYPE))) {
       RepositoryNode parent = node.getParent().getParent();
       if (parent != null
           && ERepositoryObjectType.METADATA_CON_TABLE.equals(
               parent.getProperties(EProperties.CONTENT_TYPE))
           && parent.getObject() instanceof MetadataTableRepositoryObject) {
         MetadataTableRepositoryObject tableObject =
             (MetadataTableRepositoryObject) parent.getObject();
         MetadataColumnRepositoryObject columnObject =
             (MetadataColumnRepositoryObject) ((RepositoryNode) element).getObject();
         MetadataColumn tColumn = columnObject.getTdColumn();
         EList<MetadataColumn> columns = tableObject.getTable().getColumns();
         for (int i = 0; i < columns.size(); i++) {
           MetadataColumn column = columns.get(i);
           if (column.getName() != null && column.getName().equals(tColumn.getName())) {
             return i;
           }
         }
       }
     }
   }
   return super.category(element);
 }
Ejemplo n.º 14
0
 /**
  * Tests if the node is an inherited element
  *
  * @param node a node
  * @return <code>true</code> if the node is an inherited element <code>false</code> if not
  */
 protected boolean isInherited(Node node) {
   EObject element = node.getElement();
   if (element instanceof Element) {
     EObject container = node.eContainer();
     EObject graphicalParent = null;
     if (container instanceof DecorationNode) {
       graphicalParent = ((DecorationNode) container).getElement();
     } else if (container instanceof View) {
       graphicalParent = ((View) container).getElement();
     }
     if (graphicalParent instanceof Property || graphicalParent instanceof Classifier) {
       Classifier classifier = null;
       if (graphicalParent instanceof Property) {
         Type type = ((Property) graphicalParent).getType();
         if (type instanceof Classifier) {
           classifier = (Classifier) type;
         }
       } else {
         classifier = (Classifier) graphicalParent;
       }
       if (classifier != null) {
         EList<NamedElement> inheritedMembers = classifier.getInheritedMembers();
         return inheritedMembers.contains(element);
       }
     }
   }
   return false;
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case _2009Package.DESIGN_CONFIGURATION_TYPE__VENDOR:
       return VENDOR_EDEFAULT == null ? vendor != null : !VENDOR_EDEFAULT.equals(vendor);
     case _2009Package.DESIGN_CONFIGURATION_TYPE__LIBRARY:
       return LIBRARY_EDEFAULT == null ? library != null : !LIBRARY_EDEFAULT.equals(library);
     case _2009Package.DESIGN_CONFIGURATION_TYPE__NAME:
       return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
     case _2009Package.DESIGN_CONFIGURATION_TYPE__VERSION:
       return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
     case _2009Package.DESIGN_CONFIGURATION_TYPE__DESIGN_REF:
       return designRef != null;
     case _2009Package.DESIGN_CONFIGURATION_TYPE__GENERATOR_CHAIN_CONFIGURATION:
       return generatorChainConfiguration != null && !generatorChainConfiguration.isEmpty();
     case _2009Package.DESIGN_CONFIGURATION_TYPE__INTERCONNECTION_CONFIGURATION:
       return interconnectionConfiguration != null && !interconnectionConfiguration.isEmpty();
     case _2009Package.DESIGN_CONFIGURATION_TYPE__VIEW_CONFIGURATION:
       return viewConfiguration != null && !viewConfiguration.isEmpty();
     case _2009Package.DESIGN_CONFIGURATION_TYPE__DESCRIPTION:
       return DESCRIPTION_EDEFAULT == null
           ? description != null
           : !DESCRIPTION_EDEFAULT.equals(description);
     case _2009Package.DESIGN_CONFIGURATION_TYPE__VENDOR_EXTENSIONS:
       return vendorExtensions != null;
   }
   return super.eIsSet(featureID);
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {
    Project p = MovieUtil.getActiveProject();
    if (p != null) {
      EList<Movie> movies =
          p.getAllModelElementsbyClass(MoviesPackage.eINSTANCE.getMovie(), new BasicEList<Movie>());
      for (Iterator<Movie> iter = movies.iterator(); iter.hasNext(); ) {
        if (iter.next().getOverallRating() == "ZERO"
            || iter.next().getOverallRating() == "ONE"
            || iter.next().getOverallRating() == "TWO") {
          iter.remove();
        }
      }

      // Open Movies View and set input
      try {
        IViewPart view =
            PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow()
                .getActivePage()
                .showView(MoviesView.ID);
        if (view instanceof MoviesView) {
          MoviesView moviesView = (MoviesView) view;
          moviesView.setInput(movies);
        }
      } catch (PartInitException e) {
        // showView() can throw an exception if view cannot be shown
        e.printStackTrace();
      }
    }
    return null;
  }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case EsbPackage.SEQUENCES__OUTPUT_CONNECTOR:
       return outputConnector != null;
     case EsbPackage.SEQUENCES__INPUT_CONNECTOR:
       return inputConnector != null;
     case EsbPackage.SEQUENCES__MEDIATOR_FLOW:
       return mediatorFlow != null;
     case EsbPackage.SEQUENCES__NAME:
       return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
     case EsbPackage.SEQUENCES__RECIEVE_SEQUENCE:
       return recieveSequence != RECIEVE_SEQUENCE_EDEFAULT;
     case EsbPackage.SEQUENCES__ASSOCIATED_PROXY:
       return associatedProxy != null && !associatedProxy.isEmpty();
     case EsbPackage.SEQUENCES__ON_ERROR:
       return onError != null;
     case EsbPackage.SEQUENCES__TEMPLATE_PARAMETERS:
       return templateParameters != null && !templateParameters.isEmpty();
     case EsbPackage.SEQUENCES__TRACE_ENABLED:
       return traceEnabled != TRACE_ENABLED_EDEFAULT;
     case EsbPackage.SEQUENCES__STATISTICS_ENABLED:
       return statisticsEnabled != STATISTICS_ENABLED_EDEFAULT;
   }
   return super.eIsSet(featureID);
 }
Ejemplo n.º 18
0
  public org.eclipse.core.runtime.IStatus build(
      org.emftext.language.efactory.resource.efactory.mopp.EfactoryResource resource,
      org.eclipse.core.runtime.IProgressMonitor monitor) {
    if (resource.getErrors().size() == 0) {
      EList<EObject> contents = resource.getContents();
      if (contents.size() > 0) {
        EObject rootObject = contents.get(0);
        if (rootObject instanceof Factory) {
          Factory factory = (Factory) rootObject;
          Builder builder = new Builder();
          Map<EObject, String> problems = new LinkedHashMap<EObject, String>();
          List<EObject> roots = builder.build(factory, problems);
          URI xmiURI = resource.getURI().trimFileExtension().appendFileExtension("xmi");
          Resource xmiResource = new ResourceSetImpl().createResource(xmiURI);
          xmiResource.getContents().addAll(roots);
          try {
            Map<Object, Object> options = new HashMap<Object, Object>();
            options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
            xmiResource.save(options);
          } catch (IOException e) {
            e.printStackTrace();
          }

          for (Entry<EObject, String> problem : problems.entrySet()) {
            resource.addError(
                problem.getValue(), EfactoryEProblemType.BUILDER_ERROR, problem.getKey());
          }
        }
      }
    }
    return org.eclipse.core.runtime.Status.OK_STATUS;
  }
Ejemplo n.º 19
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);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case SemanticsPackage.SERVICE_PROFILE__PRESENTED_BY:
       return getPresentedBy() != null;
     case SemanticsPackage.SERVICE_PROFILE__HAS_PROCESS:
       return hasProcess != null;
     case SemanticsPackage.SERVICE_PROFILE__SERVICE_CATEGORY:
       return serviceCategory != null;
     case SemanticsPackage.SERVICE_PROFILE__NAME:
       return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
     case SemanticsPackage.SERVICE_PROFILE__HAS_INPUT:
       return hasInput != null && !hasInput.isEmpty();
     case SemanticsPackage.SERVICE_PROFILE__HAS_OUTPUT:
       return hasOutput != null && !hasOutput.isEmpty();
     case SemanticsPackage.SERVICE_PROFILE__HAS_RESULT:
       return hasResult != null && !hasResult.isEmpty();
     case SemanticsPackage.SERVICE_PROFILE__HAS_CONDITION:
       return hasCondition != null && !hasCondition.isEmpty();
     case SemanticsPackage.SERVICE_PROFILE__SERVICE_CLASSIFICATION:
       return SERVICE_CLASSIFICATION_EDEFAULT == null
           ? serviceClassification != null
           : !SERVICE_CLASSIFICATION_EDEFAULT.equals(serviceClassification);
   }
   return super.eIsSet(featureID);
 }
  /**
   * This returns the label text for the adapted class.
   * <!-- begin-user-doc
   * -->
   * <!-- end-user-doc -->
   *
   * @generated NOT
   * @param object the object to be described
   * @return the description of the given object
   */
  @Override
  public String getText(Object object) {
    if (object instanceof CreateDeleteOperation) {
      CreateDeleteOperation op = (CreateDeleteOperation) object;
      EObject modelElement = op.getModelElement();
      int childrenCount = ModelUtil.getAllContainedModelElements(modelElement, false).size();
      String description;

      StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append(modelElement.eClass().getName());
      stringBuilder.append(getModelElementName(op.getModelElementId()));
      String elementClassAndName = stringBuilder.toString();
      if (op.isDelete()) {
        description = "Deleted " + elementClassAndName;
      } else {
        description = "Created " + elementClassAndName;
      }
      if (childrenCount > 0) {
        description += " including " + childrenCount + " sibling(s)";
      }

      EList<ReferenceOperation> subOperations = op.getSubOperations();
      int subOperationCount = subOperations.size();
      if (op.isDelete() && subOperationCount > 0) {
        ReferenceOperation referenceOperation = subOperations.get(subOperationCount - 1);
        if (referenceOperation.getContainmentType().equals(ContainmentType.CONTAINMENT)) {
          description +=
              " from its parent "
                  + getModelElementClassAndName(referenceOperation.getModelElementId());
        }
      }
      return description;
    }
    return super.getText(object);
  }
Ejemplo n.º 22
0
  @Override
  public IScriptDependency addDependency(IScriptDependency dependency) {
    /*
     * Find the list of dependencies for the object of the specified dependency
     */
    final EObject object = dependency.getObject();
    EList<IScriptDependency> dList = getDependencies().get(object);
    if (dList == null) {
      final BasicEMap.Entry<EObject, EList<IScriptDependency>> entry =
          (Entry<EObject, EList<IScriptDependency>>)
              IScriptEngineFactory.eINSTANCE.create(
                  IScriptEnginePackage.Literals.EOBJECT_TO_SCRIPT_DEPENDENCY_LIST_MAP_ENTRY);
      entry.setKey(object);
      getDependencies().add(entry);
      dList = entry.getValue();
      object.eAdapters().add(myDependencyAdapter);
    }

    /*
     * See if we have an identical entry of the list
     */
    for (final IScriptDependency d : dList) {
      if (d.equals(dependency)) return d;
    }
    dList.add(dependency);

    return dependency;
  }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__PARENT_OBJECT:
       return parentObject != null;
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__MEMBER:
       return member != null && !member.isEmpty();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__PERSISTENT_CONFIG:
       return persistentConfig != null && !persistentConfig.isEmpty();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__VALIDATOR_CONFIG:
       return validatorConfig != null;
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__SEARCH_METHOD:
       return searchMethod != null && !searchMethod.isEmpty();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__ABBREVIATION:
       return ABBREVIATION_EDEFAULT == null
           ? abbreviation != null
           : !ABBREVIATION_EDEFAULT.equals(abbreviation);
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__EXTENSIBLE:
       return isSetExtensible();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__NEED_EQUALS:
       return isSetNeedEquals();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__NEED_HISTORY:
       return isSetNeedHistory();
     case BEDiagramPackage.BUSINESS_ENTITY_TYPE__PARENT:
       return true;
   }
   return super.eIsSet(featureID);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case SpdPackage.SOFT_PKG__TITLE:
       return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
     case SpdPackage.SOFT_PKG__AUTHOR:
       return author != null && !author.isEmpty();
     case SpdPackage.SOFT_PKG__DESCRIPTION:
       return DESCRIPTION_EDEFAULT == null
           ? description != null
           : !DESCRIPTION_EDEFAULT.equals(description);
     case SpdPackage.SOFT_PKG__PROPERTY_FILE:
       return propertyFile != null;
     case SpdPackage.SOFT_PKG__DESCRIPTOR:
       return descriptor != null;
     case SpdPackage.SOFT_PKG__IMPLEMENTATION:
       return implementation != null && !implementation.isEmpty();
     case SpdPackage.SOFT_PKG__USES_DEVICE:
       return usesDevice != null && !usesDevice.isEmpty();
     case SpdPackage.SOFT_PKG__ID:
       return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
     case SpdPackage.SOFT_PKG__NAME:
       return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
     case SpdPackage.SOFT_PKG__TYPE:
       return isSetType();
     case SpdPackage.SOFT_PKG__VERSION:
       return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
   }
   return super.eIsSet(featureID);
 }
Ejemplo n.º 25
0
 private void markAsFragment(final Multimap<TerminalRule, AbstractRule> calledFrom) {
   Set<TerminalRule> _keySet = calledFrom.keySet();
   final Function1<TerminalRule, Boolean> _function =
       (TerminalRule it) -> {
         boolean _isFragment = it.isFragment();
         return Boolean.valueOf((!_isFragment));
       };
   Iterable<TerminalRule> _filter = IterableExtensions.<TerminalRule>filter(_keySet, _function);
   final Function1<TerminalRule, Boolean> _function_1 =
       (TerminalRule it) -> {
         Collection<AbstractRule> _get = calledFrom.get(it);
         return Boolean.valueOf(this.allAreTerminalRules(_get));
       };
   Iterable<TerminalRule> _filter_1 =
       IterableExtensions.<TerminalRule>filter(_filter, _function_1);
   final Function1<TerminalRule, Boolean> _function_2 =
       (TerminalRule it) -> {
         EObject _eContainer = it.eContainer();
         EList<AbstractRule> _hiddenTokens = ((Grammar) _eContainer).getHiddenTokens();
         boolean _contains = _hiddenTokens.contains(it);
         return Boolean.valueOf((!_contains));
       };
   Iterable<TerminalRule> _filter_2 =
       IterableExtensions.<TerminalRule>filter(_filter_1, _function_2);
   final Consumer<TerminalRule> _function_3 =
       (TerminalRule it) -> {
         it.setFragment(true);
       };
   _filter_2.forEach(_function_3);
 }
Ejemplo n.º 26
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case SQLTablesPackage.TABLE__COLUMNS:
       return columns != null && !columns.isEmpty();
     case SQLTablesPackage.TABLE__SUPERTABLE:
       return supertable != null;
     case SQLTablesPackage.TABLE__SUBTABLES:
       return subtables != null && !subtables.isEmpty();
     case SQLTablesPackage.TABLE__SCHEMA:
       return schema != null;
     case SQLTablesPackage.TABLE__UDT:
       return udt != null;
     case SQLTablesPackage.TABLE__TRIGGERS:
       return triggers != null && !triggers.isEmpty();
     case SQLTablesPackage.TABLE__INDEX:
       return index != null && !index.isEmpty();
     case SQLTablesPackage.TABLE__SELF_REF_COLUMN_GENERATION:
       return selfRefColumnGeneration != SELF_REF_COLUMN_GENERATION_EDEFAULT;
     case SQLTablesPackage.TABLE__INSERTABLE:
       return isInsertable() != INSERTABLE_EDEFAULT;
     case SQLTablesPackage.TABLE__UPDATABLE:
       return isUpdatable() != UPDATABLE_EDEFAULT;
   }
   return super.eIsSet(featureID);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DELEGATES:
       return delegates != null && !delegates.isEmpty();
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__IS_DELEGATED_BY:
       return isDelegatedBy != null && !isDelegatedBy.isEmpty();
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__NAME:
       return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DESCRIPTION:
       return DESCRIPTION_EDEFAULT == null
           ? description != null
           : !DESCRIPTION_EDEFAULT.equals(description);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__CATEGORY:
       return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__SOURCE_DESCR:
       return SOURCE_DESCR_EDEFAULT == null
           ? sourceDescr != null
           : !SOURCE_DESCR_EDEFAULT.equals(sourceDescr);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__OWNER_DESCR:
       return OWNER_DESCR_EDEFAULT == null
           ? ownerDescr != null
           : !OWNER_DESCR_EDEFAULT.equals(ownerDescr);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ID:
       return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ANY:
       return any != null;
   }
   return super.eIsSet(featureID);
 }
Ejemplo n.º 28
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public boolean eIsSet(int featureID) {
   switch (featureID) {
     case GraphPackage.GRAPH__EDGES:
       return edges != null && !edges.isEmpty();
     case GraphPackage.GRAPH__NODES:
       return nodes != null && !nodes.isEmpty();
     case GraphPackage.GRAPH__GRAPH_LABELS:
       return graphLabels != null && !graphLabels.isEmpty();
     case GraphPackage.GRAPH__NODE_LABELS:
       return nodeLabels != null && !nodeLabels.isEmpty();
     case GraphPackage.GRAPH__DYNAMIC_LABELS:
       return dynamicLabels != null && !dynamicLabels.isEmpty();
     case GraphPackage.GRAPH__NUM_EDGES:
       return getNumEdges() != NUM_EDGES_EDEFAULT;
     case GraphPackage.GRAPH__NUM_NODES:
       return getNumNodes() != NUM_NODES_EDEFAULT;
     case GraphPackage.GRAPH__NUM_GRAPH_LABELS:
       return getNumGraphLabels() != NUM_GRAPH_LABELS_EDEFAULT;
     case GraphPackage.GRAPH__NUM_NODE_LABELS:
       return getNumNodeLabels() != NUM_NODE_LABELS_EDEFAULT;
     case GraphPackage.GRAPH__NUM_DYNAMIC_LABELS:
       return getNumDynamicLabels() != NUM_DYNAMIC_LABELS_EDEFAULT;
     case GraphPackage.GRAPH__UNRESOLVED_IDENTIFIABLES:
       return unresolvedIdentifiables != null && !unresolvedIdentifiables.isEmpty();
     case GraphPackage.GRAPH__DECORATORS:
       return decorators != null && !decorators.isEmpty();
     case GraphPackage.GRAPH__TIME:
       return time != null;
   }
   return super.eIsSet(featureID);
 }
Ejemplo n.º 29
0
 public boolean canLayout(ILayoutContext context) {
   // return true, if pictogram element is linked to an EClass
   PictogramElement pe = context.getPictogramElement();
   if (!(pe instanceof ContainerShape)) return false;
   EList<EObject> businessObjects = pe.getLink().getBusinessObjects();
   return businessObjects.size() == 1 && businessObjects.get(0) instanceof EClass;
 }
  @Test(timeout = 1000)
  public void checkParserResult() throws Exception {
    final String text = this.getTextFromFile("res/Test0030_ObjectLikeMacro.c");
    final Preprocess Preprocess_0_Var = this.parseHelper.parse(text);
    this.valHelper.assertNoErrors(Preprocess_0_Var);

    Assert.assertNotNull(Preprocess_0_Var);
    // 0
    final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup();
    Assert.assertNotNull(GroupOpt_1_Var);
    final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines();
    Assert.assertNotNull(Lines_1_list);
    Assert.assertEquals(3, Lines_1_list.size());
    // 1
    final Code Code_2_Var = (Code) Lines_1_list.get(0);
    Assert.assertNotNull(Code_2_Var);
    Assert.assertEquals("int foo1 = BAR;", Code_2_Var.getCode());
    // 2
    final PreprocessorDirectives PreprocessorDirectives_3_Var =
        (PreprocessorDirectives) Lines_1_list.get(1);
    Assert.assertNotNull(PreprocessorDirectives_3_Var);
    // 3
    final DefineObjectMacro DefineObjectMacro_4_Var =
        (DefineObjectMacro) PreprocessorDirectives_3_Var.getDirective();
    Assert.assertNotNull(DefineObjectMacro_4_Var);
    Assert.assertEquals("BAR", DefineObjectMacro_4_Var.getIdent());
    Assert.assertEquals("0", DefineObjectMacro_4_Var.getString());
    // 4
    final Code Code_5_Var = (Code) Lines_1_list.get(2);
    Assert.assertNotNull(Code_5_Var);
    Assert.assertEquals("int foo2 = BAR;", Code_5_Var.getCode());
  }