public final class EmfHelper extends Object
EcoreUtil for more helper functions like
EcoreUtil.equals(EObject, EObject) to test for equality.| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkIdentity(org.eclipse.emf.ecore.EObject identifier1,
org.eclipse.emf.ecore.EObject identifier2)
Checks for two PCM model elements whether they are the same, i.e.
|
static boolean |
contains(Collection<? extends org.eclipse.emf.ecore.EObject> coll,
org.eclipse.emf.ecore.EObject identity)
Implements an identifier-based contains.
|
static org.eclipse.emf.ecore.EObject |
loadFromXMIFile(String fileName,
org.eclipse.emf.ecore.EPackage ePackage)
Loads the root object from an EMF File.
|
static org.eclipse.emf.ecore.EObject |
loadFromXMIFile(String fileName,
org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
org.eclipse.emf.ecore.EPackage ePackage)
Loads the root object from an EMF File.
|
static boolean |
retainAll(Collection<? extends de.uka.ipd.sdq.identifier.Identifier> collection,
Collection<? extends org.eclipse.emf.ecore.EObject> itemsToRetain)
|
static void |
saveToXMIFile(org.eclipse.emf.ecore.EObject modelToSave,
String fileName)
Save the given EObject to the file given by filename.
|
public static boolean checkIdentity(org.eclipse.emf.ecore.EObject identifier1,
org.eclipse.emf.ecore.EObject identifier2)
identifier1 - One Identifieridentifier2 - Another Identifierpublic static boolean contains(Collection<? extends org.eclipse.emf.ecore.EObject> coll, org.eclipse.emf.ecore.EObject identity)
checkIdentity(EObject, EObject) to compare the Identifier i with
the contents of the collection.coll - A collection of objects.identity - An identity to search for.Identifier in coll with an id equal to
i.getID().public static boolean retainAll(Collection<? extends de.uka.ipd.sdq.identifier.Identifier> collection, Collection<? extends org.eclipse.emf.ecore.EObject> itemsToRetain)
Collection.retainAll(Collection) for Identifiers based
on checkIdentity(EObject, EObject). This method will leave all identifiers
in collection that describe an object is itemsToRetain.collection - A collection of identifiers.itemsToRetain - The items whose identifiers should be left in
collection.true only if an element was removed from collection.public static void saveToXMIFile(org.eclipse.emf.ecore.EObject modelToSave,
String fileName)
throws IOException
modelToSave - The EObject to savefileName - The filename where to save.IOException - If accessing the file fails.public static org.eclipse.emf.ecore.EObject loadFromXMIFile(String fileName, org.eclipse.emf.ecore.EPackage ePackage)
fileName - Name of the file to load from.ePackage - The package to load for.public static org.eclipse.emf.ecore.EObject loadFromXMIFile(String fileName, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.EPackage ePackage)
fileName - Name of the file to load from.resourceSet - The resource set to load.ePackage - The package to load for.