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
ConstructorDescriptionQVToModelCache
(PCMPartitionManager pcmPartitonManager) Initializes a new instance of theQVToModelCache
class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the cache, that is, all models are removed.boolean
containsModelOfType
(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.void
removeModel
(EObject model) Removes the given model from the cache, if present.
This method does nothing, ifnull
is passed or the given model is not cached.void
removeModelOfType
(EPackage metaModel) Removes all of the currently stored models which are instances of the meta-model represented by the given ePackage.
In casenull
is 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.void
storeModel
(EObject modelInstance) Stores the given model in the cache.final void
storeModelFromBlackboardPartition
(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 theQVToModelCache
class.- Parameters:
modelAccess
- AnIModelAccess
implementation 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., theEPackage
that corresponds to the model) is already present, it will be overwritten.
In casenull
is passed, this method does nothing.- Parameters:
modelInstance
- AnEObject
representing 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., theEPackage
that 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 aResourceSetPartition
of 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 casenull
is passed, this method does nothing.- Parameters:
ePackage
- AnEPackage
that describes a meta-model.
-
removeModel
Removes the given model from the cache, if present.
This method does nothing, ifnull
is passed or the given model is not cached.- Parameters:
model
- TheEObject
to 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
QVToModelCache
which 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
- AnEPackage
that describes a meta-model.- Returns:
- The model, contained in an
Optional
and represented as anEObject
, that is an instance of the given meta-model, or an emptyOptional
if 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
- AnEPackage
that describes a meta-model.- Returns:
true
if a model of the given type is stored,false
otherwise.- Throws:
NullPointerException
- In caseePackage == null
.- See Also:
-