org.eclipse.emf.common.util.UniqueEList Java Examples

The following examples show how to use org.eclipse.emf.common.util.UniqueEList. 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: LazyExtentMap.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/** Initialize the map. */
private void init() {
	delegate = new HashMap<EClass, Set<Instance>>();
	for (final Type type : model.getTypes()) {
		final EClass clazz = type.getEClass();
		final EList<EClass> types = new UniqueEList<EClass>(clazz.getEAllSuperTypes());
		types.add(clazz);
		for (final EClass t : types) {
			Set<Instance> instances = delegate.get(t);
			if (instances == null) {
				instances = new HashSet<Instance>();
				delegate.put(t, instances);
			}
			instances.addAll(type.getInstances());
		}
	}
}
 
Example #2
Source File: ExportImplCustom.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public EList<EAttribute> getEAttributes() {
  EList<EAttribute> result = new UniqueEList<EAttribute>();

  // First iterate through the field clause
  for (Attribute attribute : getAttributes()) {
    result.add(attribute.getAttribute());
  }

  return result;
}
 
Example #3
Source File: MetamodelImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<EPackage> getEPackages() {
	final EList<EPackage> ePackages = new UniqueEList<EPackage>();
	for (final MetamodelResource resource : getResources()) {
		ePackages.addAll(resource.getRootPackages());
	}
	return ePackages;
}
 
Example #4
Source File: MetamodelImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@SuppressWarnings("unchecked")
@Override
public <V> EList<V> getInverse(EModelElement metamodelElement, EReference reference) {
	return new UniqueEList<V>((List) EcoreUtils.getInverse(
		metamodelElement, reference, getEPackages()));
}
 
Example #5
Source File: MetamodelImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<EClass> getEAllSubTypes(EClass eClass) {
	final EList<EClass> subTypes = new UniqueEList<EClass>();
	for (final EClass subType : getESubTypes(eClass)) {
		if (!subTypes.contains(subType)) {
			subTypes.add(subType);
		}
		subTypes.addAll(getEAllSubTypes(subType));
	}
	return subTypes;
}
 
Example #6
Source File: ModelImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<Instance> getAllInstances(EClass eClass) {
	final EList<Instance> instances = new UniqueEList<Instance>();

	for (final Type type : getTypes()) {
		if (eClass.isSuperTypeOf(type.getEClass())) {
			instances.addAll(type.getInstances());
		}
	}

	return instances;
}
 
Example #7
Source File: ModelImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<Instance> getInstances(EClass eClass) {
	try {
		final Type type = getType(eClass);
		return new UniqueEList<Instance>(type.getInstances());
	} catch (final NullPointerException e) {
		return new UniqueEList<Instance>();
	}
}