Java 类org.eclipse.emf.common.util.ECollections 实例源码

项目:n4js    文件:VariableDeclarationOrBindingImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<VariableDeclaration> getVariableDeclarations() {
    EList<VariableDeclaration> _switchResult = null;
    boolean _matched = false;
    if (this instanceof VariableDeclaration) {
        _matched=true;
        _switchResult = ECollections.<VariableDeclaration>toEList(java.util.Collections.<VariableDeclaration>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<VariableDeclaration>newArrayList(((VariableDeclaration) this))));
    }
    if (!_matched) {
        if (this instanceof VariableBinding) {
            _matched=true;
            _switchResult = ECollections.<VariableDeclaration>toEList(Iterators.<VariableDeclaration>filter(this.eAllContents(), VariableDeclaration.class));
        }
    }
    if (!_matched) {
        _switchResult = ECollections.<VariableDeclaration>toEList(java.util.Collections.<VariableDeclaration>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<VariableDeclaration>newArrayList()));
    }
    return _switchResult;
}
项目:n4js    文件:ParameterizedTypeRefStructuralImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    }
    else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        }
        else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
项目:n4js    文件:ThisTypeRefStructuralImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    }
    else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        }
        else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
项目:n4js    文件:BoundThisTypeRefImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    }
    else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        }
        else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
项目:n4js    文件:StructuralTypeRefImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    }
    else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        }
        else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
项目:n4js    文件:ParameterizedTypeRefStructural_IMImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TStructMember> getStructuralMembers() {
    EList<TStructMember> _xifexpression = null;
    TStructuralType _structuralType = this.getStructuralType();
    boolean _tripleNotEquals = (_structuralType != null);
    if (_tripleNotEquals) {
        _xifexpression = this.getStructuralType().getOwnedMembers();
    }
    else {
        EList<TStructMember> _xifexpression_1 = null;
        boolean _isEmpty = this.getAstStructuralMembers().isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            _xifexpression_1 = this.getAstStructuralMembers();
        }
        else {
            _xifexpression_1 = this.getGenStructuralMembers();
        }
        _xifexpression = _xifexpression_1;
    }
    return ECollections.<TStructMember>unmodifiableEList(_xifexpression);
}
项目:neoscada    文件:AbstractComponentItemCreator.java   
protected <T extends Item> T addItem ( final T item, final CustomizationRequest customizationRequest, final Set<MasterListener<T>> masterListeners )
{
    final List<String> originalLocalTags = new ArrayList<> ( customizationRequest.getLocalTags () ); // we do need a copy

    customizeItem ( item, customizationRequest );

    // set the name after customizing
    final List<String> hier = new LinkedList<> ();
    hier.addAll ( customizationRequest.getHierarchy () );
    hier.addAll ( customizationRequest.getLocalTags () );
    item.setName ( Names.makeHierarchy ( hier ) ); // FIXME: should allow a different naming scheme
    logger.debug ( "Setting item name: {}", item.getName () );

    if ( item.getInformation () == null )
    {
        item.setInformation ( OsgiFactory.eINSTANCE.createItemInformation () );
    }
    // apply the hierarchy afterwards ... overriding!
    ECollections.setEList ( item.getInformation ().getHierarchy (), customizationRequest.getHierarchy () );

    itemAdded ( item, customizationRequest, originalLocalTags, masterListeners );

    return item;
}
项目:xtext-extras    文件:JvmAnnotationReferenceImplCustom.java   
@Override
public EList<JvmAnnotationValue> getValues() {
    EList<JvmAnnotationValue> explicitValues = getExplicitValues();
    List<JvmOperation> operations = Lists.newArrayList(getAnnotation().getDeclaredOperations());
    if (operations.size() <= explicitValues.size()) {
        return ECollections.unmodifiableEList(explicitValues);
    }
    Set<JvmOperation> seenOperations = Sets.newHashSetWithExpectedSize(operations.size());
    BasicEList<JvmAnnotationValue> result = new BasicEList<JvmAnnotationValue>(operations.size());
    for(JvmAnnotationValue value: explicitValues) {
        seenOperations.add(value.getOperation());
        result.add(value);
    }
    for(JvmOperation operation: operations) {
        if (seenOperations.add(operation)) {
            JvmAnnotationValue defaultValue = operation.getDefaultValue();
            if (defaultValue != null) {
                result.add(defaultValue);
            }
        }
    }
    return ECollections.unmodifiableEList(result);
}
项目:NoSQLDataEngineering    文件:NoSQLSchemaServices.java   
public List<EntityVersion> getEVersionsForIndexBranch(NoSQLSchema model)
{
    List<EntityVersion> result = new ArrayList<EntityVersion>();

    ECollections.sort(model.getEntities(), new Comparator<Entity>()
    {
        public int compare(Entity e0, Entity e1)
        {
            return e0.getName().compareTo(e1.getName());
        }
    });

    for (Entity entity : model.getEntities())
        for (EntityVersion eVersion : entity.getEntityversions())
            result.add(eVersion);

    return result;
}
项目:NoSQLDataEngineering    文件:NoSQLSchemaServices.java   
public List<EntityVersion> getEVersionsFromEVersion(EntityVersion eVersion)
{
    List<EntityVersion> result = new ArrayList<EntityVersion>();
    NoSQLSchema model = (NoSQLSchema)eVersion.eContainer().eContainer();

    ECollections.sort(model.getEntities(), new Comparator<Entity>()
    {
        public int compare(Entity e0, Entity e1)
        {
            return e0.getName().compareTo(e1.getName());
        }
    });

    for (Entity entity : model.getEntities())
        for (EntityVersion evInEntity : entity.getEntityversions())
            if (evInEntity.isRoot() && (evInEntity == eVersion || SchemaCollector.getEVersionsFromSchema(evInEntity).contains(eVersion)))
                result.add(evInEntity);

    return result;
}
项目:dsl-devkit    文件:ELists.java   
/**
 * Filters an {@link EList} of type T to contain only elements matching the provided predicate.
 *
 * @param <T>
 *          list element type
 * @param unfiltered
 *          unfiltered list
 * @param predicate
 *          to apply
 * @return filtered list
 */
public static <T> EList<T> filter(final EList<T> unfiltered, final Predicate<? super T> predicate) {
  if (unfiltered == null) {
    return ECollections.emptyEList();
  }
  if (predicate == null) {
    throw new IllegalArgumentException("predicate must not be null"); //$NON-NLS-1$
  }
  EList<T> filtered = new BasicEList<T>(unfiltered.size() / 2); // Initial guess: half the original size
  for (T t : unfiltered) {
    if (predicate.apply(t)) {
      filtered.add(t);
    }
  }
  return filtered;
}
项目:dsl-devkit    文件:CheckConfigurationPropertiesGenerator.java   
/**
 * Generate properties for languages or legacy catalogs.
 *
 * @param section
 *          the section
 * @param properties
 *          the properties
 */
private void generatePropertiesForCatalogsInConfigurableSection(final ConfigurableSection section, final Properties properties) {
  String language = null;
  EList<ConfiguredCatalog> configuredCatalogs = ECollections.emptyEList();

  if (section instanceof CheckConfiguration) {
    configuredCatalogs = ((CheckConfiguration) section).getLegacyCatalogConfigurations();
  } else if (section instanceof ConfiguredLanguageValidator) {
    language = ((ConfiguredLanguageValidator) section).getLanguage();
    configuredCatalogs = ((ConfiguredLanguageValidator) section).getCatalogConfigurations();
  }

  for (ConfiguredCatalog catalog : configuredCatalogs) {
    Set<Check> configuredChecks = Sets.newHashSet();
    for (ConfiguredCheck configuredCheck : catalog.getCheckConfigurations()) {
      generatePropertiesForConfiguredCheck(properties, language, configuredCheck);
      configuredChecks.add(configuredCheck.getCheck());
    }
    for (Check unconfiguredCheck : Sets.difference(Sets.newHashSet(catalog.getCatalog().getAllChecks()), configuredChecks)) {
      putInheritedProperties(properties, language, unconfiguredCheck, catalog, ECollections.emptyEList());
    }
  }
}
项目:menthor-xcore    文件:ClassifierImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<Classifier> siblings() {
    ArrayList<Classifier> result = CollectionLiterals.<Classifier>newArrayList();
    EList<Classifier> _parents = this.parents();
    for (final Classifier p : _parents) {
        EList<Classifier> _children = p.children();
        for (final Classifier sibling : _children) {
            boolean _equals = sibling.equals(this);
            boolean _not = (!_equals);
            if (_not) {
                result.add(sibling);
            }
        }
    }
    return ECollections.<Classifier>toEList(result);
}
项目:menthor-xcore    文件:ClassifierImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<EndPoint> ends() {
    ArrayList<EndPoint> result = CollectionLiterals.<EndPoint>newArrayList();
    Model _model = this.getModel();
    EList<Relationship> _allRelationships = _model.allRelationships();
    for (final Relationship rel : _allRelationships) {
        boolean _isEnd = rel.isEnd(this);
        if (_isEnd) {
            EList<EndPoint> _endPoints = rel.getEndPoints();
            for (final EndPoint ep : _endPoints) {
                {
                    final Classifier type_ = ep.getEndType();
                    boolean _notEquals = (!Objects.equal(type_, null));
                    if (_notEquals) {
                        boolean _equals = type_.equals(this);
                        boolean _not = (!_equals);
                        if (_not) {
                            result.add(ep);
                        }
                    }
                }
            }
        }
    }
    return ECollections.<EndPoint>toEList(result);
}
项目:OpenSPIFe    文件:CompressChainOperation.java   
/**
 * Given a list representing a selection, return a list
 * with the following properties:
 * 
 * 1. the list is in temporal order (all elements will have a start time)
 * 2. each element in the returned list was in the source list
 * 3. each element in the returned list is in some chain
 * 4. no two elements in the returned list are from the same chain
 * 
 * @param list
 * @return
 */
public static List<? extends EPlanElement> getRepresentativePlanElements(Collection<? extends EPlanElement> list) {
    Map<TemporalChain, EPlanElement> chainToRepresentativeMap = createChainToRepresentiveMap(list);
    EList<EPlanElement> representatives = new BasicEList<EPlanElement>(chainToRepresentativeMap.values());
    ECollections.sort(representatives, new Comparator<EPlanElement>() {
        @Override
        public int compare(EPlanElement o1, EPlanElement o2) {
            Date start1 = o1.getMember(TemporalMember.class).getStartTime();
            Date start2 = o2.getMember(TemporalMember.class).getStartTime();
            Amount<Duration> duration = DateUtils.subtract(start1, start2);
            int comparison = duration.compareTo(DateUtils.ZERO_DURATION);
            if (comparison != 0) {
                return comparison;
            }
            return PlanUtils.INHERENT_ORDER.compare(o1, o2);
        }
    });
    return representatives;
}
项目:OpenSPIFe    文件:ChainOperation.java   
private void reorderElements(List<EPlanChild> allPlanElements, EPlanElement firstElement, int insertionIndex) {
    this.newOrder = allPlanElements;
    ISelection selection = new StructuredSelection(allPlanElements);
    this.transferable = modifier.getTransferable(selection);
    EList<EPlanChild> oldOrder = new BasicEList<EPlanChild>(allPlanElements);
    ECollections.sort(oldOrder, PlanStructureComparator.INSTANCE);
    this.oldOrder = oldOrder;
    this.origin = modifier.getLocation(transferable);
    TemporalChainTransferExtension.setTransferableChains(transferable, Collections.<TemporalChain>emptySet());
    EPlanElement parent = (EPlanElement)firstElement.eContainer();
    if (insertionIndex == 0) {
        this.destination = new PlanInsertionLocation(parent, InsertionSemantics.ON, allPlanElements);
    } else {
        EPlanElement element = EPlanUtils.getChildren(parent).get(insertionIndex - 1);
        this.destination = new PlanInsertionLocation(element, InsertionSemantics.AFTER, allPlanElements);
    }
}
项目:OpenSPIFe    文件:MoveSelectedHandler.java   
@Override
protected Map<EPlanElement, Date> getChangedTimes(EList<EPlanElement> sortedElements) {
    IEditorPart editor = getActiveEditor();
    Shell shell = editor.getSite().getShell();
    ECollections.sort(sortedElements, TemporalChainUtils.CHAIN_ORDER);
    EPlanElement planElement = sortedElements.get(0);
    Date referenceDate = planElement.getMember(TemporalMember.class).getStartTime();
    MoveSelectedDialog dialog = new MoveSelectedDialog(shell, referenceDate);
    int code = dialog.open();
    if (code != Window.OK) {
        return Collections.emptyMap();
    }
    Map<EPlanElement, Date> map = new HashMap<EPlanElement, Date>();
    Amount<Duration> offset = dialog.getOffset();
    for (EPlanElement pe : sortedElements) {
        TemporalMember member = pe.getMember(TemporalMember.class);
        Date startTime = member.getStartTime();
        Date newTime = DateUtils.add(startTime, offset);
        map.put(pe, newTime);
    }
    return map;
}
项目:OpenSPIFe    文件:CopyManyTimesHandler.java   
@Override
public Object execute(ExecutionEvent event) {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    EList<EPlanElement> elements = getSelectedTemporalElements(selection);
    if (elements.size() > 0) {
        IEditorPart editor = getActiveEditor();
        if (editor == null) {
            return null;
        }
        CopyManyTimesInputValidator validator = new CopyManyTimesInputValidator();
        InputDialog d = new InputDialog(editor.getSite().getShell(), actionName, "How many copies do you want to make?", "", validator);
        int code = d.open();
        int nCopies = validator.getValue(); // this line must be after d.open();
        if ((code == Window.OK) && (nCopies > 0) && (nCopies < 101)) {
            ECollections.sort(elements, TemporalChainUtils.CHAIN_ORDER);
            makinCopies(elements, nCopies);
        }
    }
    return null;
}
项目:OpenSPIFe    文件:DrudgerySavingHandler.java   
@Override
public Object execute(ExecutionEvent event) {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    EList<EPlanElement> elements = getSelectedTemporalElements(selection);
    ECollections.sort(elements, TemporalChainUtils.CHAIN_ORDER);
    EPlan plan = EPlanUtils.getPlan(elements.get(0));
    Map<EPlanElement, Date> startTimes = getChangedTimes(elements);
    // create moves for children            
    IPlanModifier modifier = PlanModifierMember.get(plan).getModifier();
    TemporalExtentsCache cache = new TemporalExtentsCache(plan);
    Map<EPlanElement, TemporalExtent> changedTimes = new LinkedHashMap<EPlanElement, TemporalExtent>();
    for (EPlanElement element: startTimes.keySet()) {
        Date start = startTimes.get(element);
        Map<EPlanElement, TemporalExtent> extents = modifier.moveToStart(element, start, cache);
        changedTimes.putAll(extents);
        if (!extents.containsKey(element)) {
            TemporalMember member = element.getMember(TemporalMember.class);
            TemporalExtent extent = member.getExtent();
            changedTimes.put(element, extent.moveToStart(start));
        }
    }
    IUndoableOperation op = new SetExtentsOperation(actionVerb, plan, changedTimes, cache);
    IUndoContext undoContext = TransactionUtils.getUndoContext(plan);
    CommonUtils.execute(op, undoContext);
    return null;
}
项目:emfstore-rest    文件:ModelUtil.java   
/**
 * Computes the checksum for a given {@link IdEObjectCollection}.
 * The checksum for a collection is independent of the order of the
 * collection's elements at the root level.
 * 
 * @param collection
 *            the collection for which to compute a checksum
 * @return the computed checksum
 * 
 * @throws SerializationException
 *             in case any errors occur during computation of the checksum
 */
public static long computeChecksum(IdEObjectCollection collection) throws SerializationException {

    final ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
    // TODO: do we need to instantiate the factory registry each time?
    resourceSetImpl.setResourceFactoryRegistry(new ResourceFactoryRegistry());
    final XMIResource res = (XMIResource) resourceSetImpl.createResource(VIRTUAL_URI);
    ((ResourceImpl) res).setIntrinsicIDToEObjectMap(new HashMap<String, EObject>());
    final IdEObjectCollection copy = copyIdEObjectCollection(collection, res);

    ECollections.sort(copy.getModelElements(), new Comparator<EObject>() {
        public int compare(EObject o1, EObject o2) {
            return copy.getModelElementId(o1).getId().compareTo(copy.getModelElementId(o2).getId());
        }
    });

    final String serialized = copiedEObjectToString(copy, res);
    return computeChecksum(serialized);
}
项目:tool    文件:DiagramSynchronizer.java   
private void createContentsIfNecessary(final View theElementView) {
    final EObject theElement = theElementView.getElement();
    final EList<Property> ownedAttributes = asEList(getOwnedAttributes(theElement));
    if (!ownedAttributes.isEmpty()) {
        final View theOwnedAttributeCompartment = getTheAttributeCompartment(theElementView);
        for (final Property p : ownedAttributes) {
            getOrCreateTheView(p, theOwnedAttributeCompartment);
        }
        @SuppressWarnings("unchecked")
        final EList<View> attributeViews = theOwnedAttributeCompartment.getPersistedChildren();
        ECollections.sort(attributeViews, new Comparator<View>() {
            @Override
            public int compare(final View left, final View right) {
                return Integer.compare(indexOf(ownedAttributes, left.getElement(), 0),
                        indexOf(ownedAttributes, right.getElement(), 0));
            }
        });
    }
    for (final Generalization g : getGeneralizations(theElement)) {
        getOrCreateTheView(g, theElementView.getDiagram());
    }
}
项目:tool    文件:NamespaceMerger.java   
@Override
protected void copyContainment(final EReference eReference, final EObject eObject, final EObject copyEObject) {
    if (UMLPackage.Literals.CLASSIFIER.isInstance(eObject) && eObject.eIsSet(eReference) && eReference.isMany()
            && !((Collection<?>) eObject.eGet(eReference)).isEmpty()) {
        @SuppressWarnings("unchecked")
        final EList<EObject> source = (EList<EObject>) eObject.eGet(eReference);
        @SuppressWarnings("unchecked")
        final EList<EObject> target = (EList<EObject>) copyEObject.eGet(getTarget(eReference));
        target.addAll(copyAll(source));
        final Namespace original = (Namespace) eObject;
        ECollections.sort(target, new Comparator<EObject>() {
            @Override
            public int compare(final EObject left, final EObject right) {
                return Integer.compare(indexOf(source, original.getOwnedMember(getName(left)), 0),
                        indexOf(source, original.getOwnedMember(getName(right)), 0));
            }
        });
    } else {
        super.copyContainment(eReference, eObject, copyEObject);
    }
}
项目:NIEM-Modeling-Tool    文件:DiagramSynchronizer.java   
private void createContentsIfNecessary(final View theElementView) {
    final EObject theElement = theElementView.getElement();
    final EList<Property> ownedAttributes = asEList(getOwnedAttributes(theElement));
    if (!ownedAttributes.isEmpty()) {
        final View theOwnedAttributeCompartment = getTheAttributeCompartment(theElementView);
        for (final Property p : ownedAttributes) {
            getOrCreateTheView(p, theOwnedAttributeCompartment);
        }
        @SuppressWarnings("unchecked")
        final EList<View> attributeViews = theOwnedAttributeCompartment.getPersistedChildren();
        ECollections.sort(attributeViews, new Comparator<View>() {
            @Override
            public int compare(final View left, final View right) {
                return Integer.compare(indexOf(ownedAttributes, left.getElement(), 0),
                        indexOf(ownedAttributes, right.getElement(), 0));
            }
        });
    }
    for (final Generalization g : getGeneralizations(theElement)) {
        getOrCreateTheView(g, theElementView.getDiagram());
    }
}
项目:NIEM-Modeling-Tool    文件:NamespaceMerger.java   
@Override
protected void copyContainment(final EReference eReference, final EObject eObject, final EObject copyEObject) {
    if (UMLPackage.Literals.CLASSIFIER.isInstance(eObject) && eObject.eIsSet(eReference) && eReference.isMany()
            && !((Collection<?>) eObject.eGet(eReference)).isEmpty()) {
        @SuppressWarnings("unchecked")
        final EList<EObject> source = (EList<EObject>) eObject.eGet(eReference);
        @SuppressWarnings("unchecked")
        final EList<EObject> target = (EList<EObject>) copyEObject.eGet(getTarget(eReference));
        target.addAll(copyAll(source));
        final Namespace original = (Namespace) eObject;
        ECollections.sort(target, new Comparator<EObject>() {
            @Override
            public int compare(final EObject left, final EObject right) {
                return Integer.compare(indexOf(source, original.getOwnedMember(getName(left)), 0),
                        indexOf(source, original.getOwnedMember(getName(right)), 0));
            }
        });
    } else {
        super.copyContainment(eReference, eObject, copyEObject);
    }
}
项目:MMINT    文件:ModelRelMerge.java   
private @NonNull ModelRel merge(@NonNull ModelRel rel1, @NonNull ModelRel rel2, @NonNull Model model1,
                                @Nullable Model model2, @NonNull MID instanceMID) throws MMINTException {

    ModelRel mergedRel = null;
    String mergedRelName = rel1.getName() + MERGE_SEPARATOR + rel2.getName();
    if (rel1 instanceof BinaryModelRel && rel2 instanceof BinaryModelRel) { // binary merge
        mergedRel = rel1.getMetatype().createBinaryInstanceAndEndpoints(null, mergedRelName, model1, model2,
                                                                        instanceMID);
    }
    else { // unary merge, or binary merge with nary rel
        EList<Model> models = (model2 == null) ?
            ECollections.asEList(model1) :
            ECollections.asEList(model1, model2);
        mergedRel = rel1.getMetatype().createInstanceAndEndpoints(null, mergedRelName, models, instanceMID);
    }
    populate(mergedRel, rel1, instanceMID);
    populate(mergedRel, rel2, instanceMID);

    return mergedRel;
}
项目:emfviews    文件:VirtualEObject.java   
@Override
public EList<EObject> eContents() {
  // @Optimize: maybe use an iterator?

  List<EObject> contents = new ArrayList<>();

  for (EReference ref : eClass().getEAllContainments()) {
    if (ref.isMany()) {
      @SuppressWarnings("unchecked")
      List<EObject> list = (List<EObject>) eGet(ref);
      if (list != null) {
        for (EObject o : list) {
          contents.add(virtualizer.getVirtual(o));
        }
      }
    } else {
      EObject value = (EObject) eGet(ref);
      if (value != null) {
        contents.add(virtualizer.getVirtual(value));
      }
    }
  }

  return ECollections.unmodifiableEList(contents);
}
项目:emfviews    文件:Viewpoint.java   
private EList<EObject> buildVirtualContents() {
  List<EObject> contents = new ArrayList<>();

  // The order of packages in the virtual contents matters. We use the order
  // specified by the contributing models, and the virtual package is last.
  for (EPackage p : contributingEPackages) {
    contents.add((EObject) virtualResourceSet.getPackageRegistry().get(p.getNsURI()));
  }

  // The virtual package is not included if there are no new concepts.
  if (virtualPackage != null) {
    contents.add(getVirtual(virtualPackage));
  }

  return ECollections.unmodifiableEList(contents);
}
项目:n4js    文件:VariableDeclarationContainerImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<VariableDeclaration> getVarDecl() {
    final Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>> _function = new Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>>() {
        public EList<VariableDeclaration> apply(final VariableDeclarationOrBinding it) {
            return it.getVariableDeclarations();
        }
    };
    return ECollections.<VariableDeclaration>toEList(Iterables.<VariableDeclaration>concat(XcoreEListExtensions.<VariableDeclarationOrBinding, EList<VariableDeclaration>>map(this.getVarDeclsOrBindings(), _function)));
}
项目:n4js    文件:VariableStatementImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<VariableDeclaration> getVarDecl() {
    final Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>> _function = new Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>>() {
        public EList<VariableDeclaration> apply(final VariableDeclarationOrBinding it) {
            return it.getVariableDeclarations();
        }
    };
    return ECollections.<VariableDeclaration>toEList(Iterables.<VariableDeclaration>concat(XcoreEListExtensions.<VariableDeclarationOrBinding, EList<VariableDeclaration>>map(this.getVarDeclsOrBindings(), _function)));
}
项目:n4js    文件:N4JSModel.java   
private EList<ProvidedRuntimeLibraryDependency> getAllProvidedRuntimeLibraries(N4JSProject project) {
    URI projectLocation = project.getLocation();
    if (projectLocation == null)
        return ECollections.emptyEList();

    ProjectDescription description = getProjectDescription(projectLocation);
    if (description == null)
        return ECollections.emptyEList();

    EList<ProvidedRuntimeLibraryDependency> runtimeLibraries = description.getAllProvidedRuntimeLibraries();
    if (runtimeLibraries == null)
        return ECollections.emptyEList();

    return runtimeLibraries;
}
项目:n4js    文件:DocletImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<LineTag> lineTags(final String title) {
    final Function1<LineTag, Boolean> _function = new Function1<LineTag, Boolean>() {
        public Boolean apply(final LineTag it) {
            String _title = it.getTitle().getTitle();
            return Boolean.valueOf(Objects.equal(_title, title));
        }
    };
    return ECollections.<LineTag>toEList(IterableExtensions.<LineTag>filter(this.getLineTags(), _function));
}
项目:BIMplatform    文件:IfcModel.java   
private void sortPrimitiveList(EList<IdEObject> list) {
    ECollections.sort(list, new Comparator<IdEObject>() {
        @Override
        public int compare(IdEObject o1, IdEObject o2) {
            return comparePrimitives(o1, o2);
        }
    });
}
项目:neoscada    文件:AverageModuleImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public EList<InputSpecification> getKnownInputs ()
{
    if ( this.knownInputs == null )
    {
        final BasicEList<InputSpecification> inputs = ECollections.newBasicEList ();
        inputs.add ( Components.createInput ( "input" ) );
        this.knownInputs = ECollections.unmodifiableEList ( inputs );
    }
    return this.knownInputs;
}
项目:neoscada    文件:AverageModuleImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public EList<OutputSpecification> getKnownOutputs ()
{
    if ( this.knownOutputs == null )
    {
        final BasicEList<OutputSpecification> outputs = ECollections.newBasicEList ();
        for ( final AverageReferenceType type : AverageReferenceType.values () )
        {
            outputs.add ( Components.createOutput ( type.getLiteral (), DataType.FLOAT ) );
        }
        this.knownOutputs = ECollections.unmodifiableEList ( outputs );
    }
    return this.knownOutputs;
}
项目:neoscada    文件:FormulaModuleImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public EList<OutputSpecification> getKnownOutputs ()
{
    if ( this.knownOutputs == null )
    {
        final BasicEList<OutputSpecification> outputs = ECollections.newBasicEList ();
        outputs.add ( Components.createOutput ( "output", null ) );
        this.knownOutputs = ECollections.unmodifiableEList ( outputs );
    }
    return this.knownOutputs;
}
项目:neoscada    文件:MovingAverageModuleImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<InputSpecification> getKnownInputs ()
{
    if ( this.knownInputs == null )
    {
        final BasicEList<InputSpecification> inputs = ECollections.newBasicEList ();
        inputs.add ( Components.createInput ( "input" ) );
        this.knownInputs = ECollections.unmodifiableEList ( inputs );
    }
    return this.knownInputs;
}
项目:neoscada    文件:MovingAverageModuleImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<OutputSpecification> getKnownOutputs ()
{
    if ( this.knownOutputs == null )
    {
        final BasicEList<OutputSpecification> outputs = ECollections.newBasicEList ();
        for ( final MovingAverageReferenceType type : MovingAverageReferenceType.values () )
        {
            outputs.add ( Components.createOutput ( type.getLiteral (), DataType.FLOAT ) );
        }
        this.knownOutputs = ECollections.unmodifiableEList ( outputs );
    }
    return this.knownOutputs;
}
项目:neoscada    文件:GlobalizeComponentImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<MasterServer> getMasterOn ()
{
    if ( getSourceMaster () != null && getSourceMaster ().getMaster () != null )
    {
        return ECollections.singletonEList ( getSourceMaster ().getMaster () );
    }
    else
    {
        return ECollections.emptyEList ();
    }
}
项目:neoscada    文件:ArduinoDriverImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public EList<Endpoint> getEndpoints ()
{
    final EList<Endpoint> result = ECollections.newBasicEList ();
    for ( final Exporter exporter : getExporter () )
    {
        result.addAll ( exporter.getEndpoints () );
    }
    return result;
}
项目:neoscada    文件:ParserDriverImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public EList<Endpoint> getEndpoints ()
{
    final EList<Endpoint> result = ECollections.newBasicEList ();
    for ( final Exporter exporter : getExporter () )
    {
        result.addAll ( exporter.getEndpoints () );
    }
    return result;
}