Package de.uka.ipd.sdq.dsexplore.helper
Class EMFHelper
- java.lang.Object
-
- de.uka.ipd.sdq.dsexplore.helper.EMFHelper
-
public class EMFHelper extends Object
Also seeEcoreUtil
for more helper functions likeEcoreUtil.equals(EObject, EObject)
to test for equality.
-
-
Constructor Summary
Constructors Constructor Description EMFHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
checkIdentity(EObject i1, EObject i2)
Checks for two PCM model elements whether they are the same, i.e.static boolean
contains(Collection<? extends EObject> coll, EObject i)
Implements an identifier-based contains.static Candidates
createEMFCandidates(Collection<DSEIndividual> individuals)
static List<org.palladiosimulator.pcm.allocation.AllocationContext>
getAllUsedAllocationContexts(org.palladiosimulator.pcm.allocation.Allocation allocation)
static List<org.palladiosimulator.pcm.core.composition.AssemblyContext>
getAllUsedAssemblyContexts(org.palladiosimulator.pcm.core.entity.ComposedProvidingRequiringEntity composite)
Recursively get all contained AssemblyContexts in one flat list.static List<org.palladiosimulator.pcm.repository.PassiveResource>
getPassiveResources(List<org.palladiosimulator.pcm.repository.Repository> repositoryList)
static int
indexOfByID(List<? extends org.palladiosimulator.pcm.core.entity.Entity> entities, String id)
static EObject
loadFromXMIFile(String fileName, EPackage ePackage)
Deprecated.useloadFromXMIFile(URI, EPackage)
insteadstatic EObject
loadFromXMIFile(URI fileName, EPackage ePackage)
Copied From de.uka.ipd.sdq.pcmsolver.models.PCMInstance.static EObject
loadFromXMIFile(URI uri, ResourceSet resourceSet, EPackage ePackage)
static boolean
retainAll(Collection<? extends de.uka.ipd.sdq.identifier.Identifier> collection, Collection<? extends EObject> itemsToRetain)
static org.palladiosimulator.pcm.core.entity.Entity
retrieveEntityByID(List<? extends EObject> entities, EObject object)
static org.palladiosimulator.pcm.core.entity.Entity
retrieveEntityByID(List<? extends org.palladiosimulator.pcm.core.entity.Entity> entities, String id)
static void
saveToXMIFile(EObject modelToSave, URI fileName)
Save the given EObject to the file given by filename.
-
-
-
Method Detail
-
checkIdentity
public static boolean checkIdentity(EObject i1, EObject i2)
Checks for two PCM model elements whether they are the same, i.e. whether they have the same ID. The model elements have to be derived from Identifier. Note that two systems might use the same assembly contexts and components, but still are two different systems. If one of the Identifiers in null, false is returned.- Parameters:
i1
- One Identifieri2
- Another Identifier- Returns:
- true if i1.getId().equals(i2.getId()), false otherwise
-
contains
public static boolean contains(Collection<? extends EObject> coll, EObject i)
Implements an identifier-based contains. Calls#checkIdentity(Identifier, Identifier)
to compare theIdentifier
i with the contents of the collection.- Parameters:
coll
-i
-- Returns:
- true if there is an
Identifier
in coll with an id equal to i.getID().
-
retainAll
public static boolean retainAll(Collection<? extends de.uka.ipd.sdq.identifier.Identifier> collection, Collection<? extends EObject> itemsToRetain)
-
saveToXMIFile
public static void saveToXMIFile(EObject modelToSave, URI fileName)
Save the given EObject to the file given by filename.- Parameters:
modelToSave
- The EObject to savefileName
- The filename where to save.
-
loadFromXMIFile
public static EObject loadFromXMIFile(URI fileName, EPackage ePackage)
Copied From de.uka.ipd.sdq.pcmsolver.models.PCMInstance.- Parameters:
fileName
- the filename specifying the file to load from- Returns:
- The EObject loaded from the file
-
loadFromXMIFile
public static EObject loadFromXMIFile(URI uri, ResourceSet resourceSet, EPackage ePackage)
-
retrieveEntityByID
public static org.palladiosimulator.pcm.core.entity.Entity retrieveEntityByID(List<? extends EObject> entities, EObject object)
-
retrieveEntityByID
public static org.palladiosimulator.pcm.core.entity.Entity retrieveEntityByID(List<? extends org.palladiosimulator.pcm.core.entity.Entity> entities, String id)
-
indexOfByID
public static int indexOfByID(List<? extends org.palladiosimulator.pcm.core.entity.Entity> entities, String id)
-
createEMFCandidates
public static Candidates createEMFCandidates(Collection<DSEIndividual> individuals)
-
getPassiveResources
public static List<org.palladiosimulator.pcm.repository.PassiveResource> getPassiveResources(List<org.palladiosimulator.pcm.repository.Repository> repositoryList)
-
getAllUsedAssemblyContexts
public static List<org.palladiosimulator.pcm.core.composition.AssemblyContext> getAllUsedAssemblyContexts(org.palladiosimulator.pcm.core.entity.ComposedProvidingRequiringEntity composite)
Recursively get all contained AssemblyContexts in one flat list.
-
getAllUsedAllocationContexts
public static List<org.palladiosimulator.pcm.allocation.AllocationContext> getAllUsedAllocationContexts(org.palladiosimulator.pcm.allocation.Allocation allocation)
-
loadFromXMIFile
public static EObject loadFromXMIFile(String fileName, EPackage ePackage)
Deprecated.useloadFromXMIFile(URI, EPackage)
instead
-
-