Java Code Examples for org.eclipse.emf.common.util.ECollections#emptyEList()
The following examples show how to use
org.eclipse.emf.common.util.ECollections#emptyEList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaintedValueAnalyser.java From n4js with Eclipse Public License 1.0 | 6 votes |
private boolean assignedSymbolIsAnnotatedWith(Symbol assignedSymbol, String annotationName) { EObject decl = SymbolDeclaration.get(assignedSymbol, ts); EList<Annotation> annotations = ECollections.emptyEList(); if (decl instanceof N4FieldDeclaration) { N4FieldDeclaration fieldDecl = (N4FieldDeclaration) decl; annotations = fieldDecl.getAnnotations(); } if (decl instanceof VariableDeclaration) { VariableDeclaration varDecl = (VariableDeclaration) decl; annotations = varDecl.getAnnotations(); } for (Annotation ann : annotations) { String name = ann.getName(); return annotationName.equals(name); } return false; }
Example 2
Source File: ELists.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * 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; }
Example 3
Source File: CheckConfigurationPropertiesGenerator.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * 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()); } } }
Example 4
Source File: N4JSModel.java From n4js with Eclipse Public License 1.0 | 5 votes |
private EList<ProjectReference> getAllProvidedRuntimeLibraries(N4JSProject project) { ProjectDescription description = getProjectDescription(project); if (description == null) return ECollections.emptyEList(); EList<ProjectReference> runtimeLibraries = description.getProvidedRuntimeLibraries(); if (runtimeLibraries == null) return ECollections.emptyEList(); return runtimeLibraries; }
Example 5
Source File: GlobalizeComponentImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * <!-- 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 (); } }
Example 6
Source File: AlarmsEventsConnectionImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Endpoint> getPossibleEndpoints ( final Exporter exporter ) { if ( ! ( exporter instanceof AlarmsEventsExporter ) ) { return ECollections.emptyEList (); } return exporter.getEndpoints (); }
Example 7
Source File: DataAccessConnectionImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Endpoint> getPossibleEndpoints ( final Exporter exporter ) { if ( ! ( exporter instanceof DataAccessExporter ) ) { return ECollections.emptyEList (); } return exporter.getEndpoints (); }
Example 8
Source File: ChangeTreeProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public EObjectChange(EObject eObject) { this(eObject, ECollections.emptyEList()); }
Example 9
Source File: ChangeTreeProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public EList<FeatureChange> getChanges() { return changes == null ? ECollections.emptyEList() : changes; }
Example 10
Source File: ELists.java From dsl-devkit with Eclipse Public License 1.0 | 3 votes |
/** * Converts an {@link EList} of type S to an {@link EList} T, where T is a subtype of S. * * @param <S> * original list type, supertype of T * @param <T> * target list type, subtype of S * @param from * list to convert * @return converted list */ @SuppressWarnings("unchecked") public static <S, T extends S> EList<T> convertToSubtype(final EList<S> from) { if (from == null) { return ECollections.emptyEList(); } return (EList<T>) from; }
Example 11
Source File: ELists.java From dsl-devkit with Eclipse Public License 1.0 | 3 votes |
/** * Converts an {@link EList} of type T to an {@link EList} S, where S is a supertype of T. * * @param <S> * original list type, supertype of T * @param <T> * target list type, subtype of S * @param from * list to convert * @return converted list */ @SuppressWarnings("unchecked") public static <S, T extends S> EList<S> convertToSupertype(final EList<T> from) { if (from == null) { return ECollections.emptyEList(); } return (EList<S>) from; }
Example 12
Source File: JSONValueImpl.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<EObject> getChildren() { return ECollections.<EObject>emptyEList(); }
Example 13
Source File: AbstractGenericDatabaseSettingsImpl.java From neoscada with Eclipse Public License 1.0 | 2 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<String> getBundles () { return ECollections.emptyEList (); }