Class QVToModelCache
- java.lang.Object
-
- org.palladiosimulator.simulizar.reconfiguration.qvto.util.QVToModelCache
-
-
Constructor Summary
Constructors Constructor Description QVToModelCache(PCMPartitionManager pcmPartitonManager)Initializes a new instance of theQVToModelCacheclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()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.Collection<EObject>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.QVToModelCachesnapshot()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.voidstoreModelFromBlackboardPartition(String partitionId)Stores the model found in the partition of the blackboard that is identified by the given id.
-
-
-
Constructor Detail
-
QVToModelCache
public QVToModelCache(PCMPartitionManager pcmPartitonManager)
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 Detail
-
storeModel
public void storeModel(EObject modelInstance)
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
public final void storeModelFromBlackboardPartition(String partitionId)
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:
storeModel(EObject)
-
removeModelOfType
public void removeModelOfType(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.- Parameters:
ePackage- AnEPackagethat describes a meta-model.
-
removeModel
public void removeModel(EObject model)
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
public QVToModelCache 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
public Collection<EObject> getModelsByType(EPackage ePackage)
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
public boolean containsModelOfType(EPackage ePackage)
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:
getModelsByType(EPackage)
-
-