static Collection createEmptyCollection(EStructuralFeature feature) { Class clazz = feature.getEType().getInstanceClass(); if (EList.class.isAssignableFrom(clazz)) { return new BasicEList(); } if (List.class.isAssignableFrom(clazz)) { return new ArrayList(); } if (Set.class.isAssignableFrom(clazz)) { return new HashSet(); } throw new IllegalArgumentException("Unable to create collection for " + clazz); }
/** * Creates a mutable {@link BasicEList>} containing the given elements. * @return a mutable {@link BasicEList>} containing the given elements. * @since 2.9 */ public static <T> BasicEList<T> newBasicEList(T... elements) { BasicEList<T> result = new BasicEList<T>(elements.length); for (T t : elements) { result.add(t); } return result; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public EList<String> getFieldNames() { BasicEList<String> result = new BasicEList<String>(); result.addAll(JsonMetadata.INSTANCE.getJsonFeatures(eClass()).keySet()); result.addAll(getUnmatched().keySet()); return result; }
list.grow(listSize); for (int i = 0; i < listSize; i++) { if (feature.getEAnnotation("twodimensionalarray") != null) { newObject.eSet(newObject.eClass().getEStructuralFeature("List"), result); list.addUnique(newObject); } else { IdEObject referencedObject = null; list.add(referencedObject); } else { list.addUnique(referencedObject); BasicEList<Object> list = new BasicEList<Object>(listSize); for (int i = 0; i < listSize; i++) { Object reference = readPrimitiveValue(feature.getEType(), buffer, query); if (reference != null) { list.addUnique(reference);
public static EList<Type> getReferencedTypes(final Type type) { BasicEList<Type> types = new BasicEList<Type>(); types.add(type); if ((type instanceof Entity)) { Entity entityType = ((Entity) type); EList<Property> _properties = entityType.getProperties(); for (final Property property : _properties) { EList<Type> _referencedTypes = Utils.getReferencedTypes(property); types.addAll(_referencedTypes); } Entity _superType = entityType.getSuperType(); types.add(_superType); } return types; }
/** * Checks for folder mappings to populate the {@link #prefixMaps prefix maps}. */ @Override protected void didAdd(Entry<URI, URI> entry) { if (((MappingEntryImpl)entry).isPrefixMapEntry) { int length = entry.getKey().segmentCount(); if (prefixMaps == null) { prefixMaps = new BasicEList<List<Entry<URI, URI>>>(); } for (int i = prefixMaps.size() - 1; i <= length; ++i) { prefixMaps.add(new BasicEList<Entry<URI, URI>>()); } prefixMaps.get(length).add(entry); } }
public boolean addAllUnique(int index, Entry.Internal [] entries, int start, int end) { modCount = -1; BasicEList<Entry.Internal> collection = new BasicEList<Entry.Internal>(); if (start == 0) { collection.setData(end, entries); } else { collection.grow(end - start); for (int i = start; i < end; ++i) { collection.add(entries[i]); } } return featureMap.addAllUnique(index, collection); }
public static EList<Entity> getReferencedEntities(final FunctionBlock fb) { BasicEList<Entity> entities = new BasicEList<Entity>(); EList<Type> _referencedTypes = Utils.getReferencedTypes(fb); for (final Type type : _referencedTypes) { boolean _and = false; if (!(type instanceof Entity)) { _and = false; } else { boolean _contains = entities.contains(((Entity) type)); boolean _not = (!_contains); _and = _not; } if (_and) { entities.add(((Entity) type)); } } return entities; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> */ public void removeEAnnotationDetail(EAnnotation eAnnotation, String key) { if (eAnnotation != null) { BasicEList deferredRemove = new BasicEList(); Iterator eAnnotationDetailsIterator = eAnnotation.getDetails().iterator(); while(eAnnotationDetailsIterator.hasNext()) { EStringToStringMapEntryImpl currentMapEntry = (EStringToStringMapEntryImpl)eAnnotationDetailsIterator.next(); if (currentMapEntry.getTypedKey().equalsIgnoreCase(key)) { deferredRemove.add(currentMapEntry); } } for (Iterator iter = deferredRemove.iterator(); iter.hasNext();) { eAnnotation.getDetails().remove(iter.next()); } } }
public NotificationChain basicAdd(E object, NotificationChain notifications) { super.add(object); return notifications; }
public FeatureIteratorImpl(EObject eObject) { super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data()); }
private void moveESetting(Object[] oldSettings, Object[] newSettings, int oldIndex, EStructuralFeature sf, int newIndex) { // See if single vs many. if (!sf.isMany()) newSettings[newIndex] = oldSettings[oldIndex]; // Great, we can just move it over. else { // Many is more difficult. Need to create a new dynamic list of right type, and // then just copy over the data from the old one. We create new one by doing a simple eGet. // This will construct an empty one with no notifications going out. // Note: This is extremelly implementation dependent. We will be throwing away the old // oldMany, so it is ok to reuse the actual array of data for the newMany. BasicEList newMany = (BasicEList) eGet(sf); BasicEList oldMany = (BasicEList) oldSettings[oldIndex]; newMany.setData(oldMany.size(), oldMany.data()); } }
public NotificationChain basicRemove(Object object, NotificationChain notifications) { super.remove(object); return notifications; }
@Override public boolean addAll(Collection<? extends E> collection) { ensureSafety(); return super.addAll(collection); }
@Override public EList<XExpression> getExplicitArguments() { BasicEList<XExpression> result = new BasicEList<XExpression>(); if (getMemberCallTarget()!=null) result.add(getMemberCallTarget()); result.addAll(getMemberCallArguments()); return result; }
/** * Checks for folder mappings to populate the {@link #prefixMaps prefix maps}. */ @Override protected void didAdd(Entry<URI, URI> entry) { if (((MappingEntryImpl)entry).isPrefixMapEntry) { int length = entry.getKey().segmentCount(); if (prefixMaps == null) { prefixMaps = new BasicEList<List<Entry<URI, URI>>>(); } for (int i = prefixMaps.size() - 1; i <= length; ++i) { prefixMaps.add(new BasicEList<Entry<URI, URI>>()); } prefixMaps.get(length).add(entry); } }
public boolean addAllUnique(int index, Entry.Internal [] entries, int start, int end) { modCount = -1; BasicEList<Entry.Internal> collection = new BasicEList<Entry.Internal>(); if (start == 0) { collection.setData(end, entries); } else { collection.grow(end - start); for (int i = start; i < end; ++i) { collection.add(entries[i]); } } return featureMap.addAllUnique(index, collection); }
public static EList<org.eclipse.vorto.core.api.model.datatype.Enum> getReferencedEnums(final FunctionBlock fb) { BasicEList<org.eclipse.vorto.core.api.model.datatype.Enum> enums = new BasicEList<org.eclipse.vorto.core.api.model.datatype.Enum>(); EList<Type> _referencedTypes = Utils.getReferencedTypes(fb); for (final Type type : _referencedTypes) { boolean _and = false; if (!(type instanceof org.eclipse.vorto.core.api.model.datatype.Enum)) { _and = false; } else { boolean _contains = enums.contains(((org.eclipse.vorto.core.api.model.datatype.Enum) type)); boolean _not = (!_contains); _and = _not; } if (_and) { enums.add(((org.eclipse.vorto.core.api.model.datatype.Enum) type)); } } return enums; }
public NotificationChain basicAdd(E object, NotificationChain notifications) { super.add(object); return notifications; }
public FeatureIteratorImpl(EObject eObject) { super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data()); }