Class QVToModelCache
java.lang.Object
org.palladiosimulator.simulizar.reconfiguration.qvto.util.QVToModelCache
This cache implementation is used to store models (e.g., PCM models or runtime measurement
models) that can be parameters of QVTo transformations. To store a model in the cache, its
corresponding
EPackage (its meta-model) is used as tag.-
Constructor Summary
ConstructorsConstructorDescriptionQVToModelCache(PCMPartitionManager pcmPartitonManager) Initializes a new instance of theQVToModelCacheclass. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the cache, that is, all models are removed.booleancontainsModelOfType(EPackage ePackage) Gets whether a model of the meta-model represented by the given ePackage is currently in store.getModelsByType(EPackage ePackage) Gets the currently stored model that is an instance of the meta-model represented by the given ePackage.voidremoveModel(EObject model) Removes the given model from the cache, if present.
This method does nothing, ifnullis passed or the given model is not cached.voidremoveModelOfType(EPackage metaModel) Removes all of the currently stored models which are instances of the meta-model represented by the given ePackage.
In casenullis passed, this method does nothing.snapshot()Creates a snapshot of the current state of the cache.
More precisely, this method creates an instance that contains the same models as this one.voidstoreModel(EObject modelInstance) Stores the given model in the cache.final voidstoreModelFromBlackboardPartition(String partitionId) Stores the model found in the partition of the blackboard that is identified by the given id.
-
Constructor Details
-
QVToModelCache
Initializes a new instance of theQVToModelCacheclass.- Parameters:
modelAccess- AnIModelAccessimplementation that is used to access the globally available models such as the PCM models.- Throws:
NullPointerException- In casemodelAccess == null.- See Also:
-
IModelAccess#getBlackboard()IModelAccess#getGlobalPCMModel()
-
-
Method Details
-
storeModel
Stores the given model in the cache. If a model of the same type (denoted by the meta-model, i.e., theEPackagethat corresponds to the model) is already present, it will be overwritten.
In casenullis passed, this method does nothing.- Parameters:
modelInstance- AnEObjectrepresenting a model.
-
storeModelFromBlackboardPartition
Stores the model found in the partition of the blackboard that is identified by the given id. If a model of the same type (denoted by the meta-model, i.e., theEPackagethat corresponds to the model) is already present, it will be overwritten.
If the given id does not identify a partition, or the requested partition is empty, nothing happens.- Parameters:
partitionId- A String which identifies aResourceSetPartitionof the the globalMDSDBlackboard.- Throws:
NullPointerException- In casepartitionId == null.- See Also:
-
removeModelOfType
Removes all of the currently stored models which are instances of the meta-model represented by the given ePackage.
In casenullis passed, this method does nothing.- Parameters:
ePackage- AnEPackagethat describes a meta-model.
-
removeModel
Removes the given model from the cache, if present.
This method does nothing, ifnullis passed or the given model is not cached.- Parameters:
model- TheEObjectto remove from the cache.
-
clear
public void clear()Clears the cache, that is, all models are removed. -
snapshot
Creates a snapshot of the current state of the cache.
More precisely, this method creates an instance that contains the same models as this one.- Returns:
- A
QVToModelCachewhich is a snapshot of the current state of this instance.
-
getModelsByType
Gets the currently stored model that is an instance of the meta-model represented by the given ePackage.- Parameters:
ePackage- AnEPackagethat describes a meta-model.- Returns:
- The model, contained in an
Optionaland represented as anEObject, that is an instance of the given meta-model, or an emptyOptionalif none could be found. - Throws:
NullPointerException- In caseePackage == null.
-
containsModelOfType
Gets whether a model of the meta-model represented by the given ePackage is currently in store.- Parameters:
ePackage- AnEPackagethat describes a meta-model.- Returns:
trueif a model of the given type is stored,falseotherwise.- Throws:
NullPointerException- In caseePackage == null.- See Also:
-