Class QVToModelCache


  • public class QVToModelCache
    extends Object
    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.
    • 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., the EPackage that corresponds to the model) is already present, it will be overwritten.
        In case null is passed, this method does nothing.
        Parameters:
        modelInstance - An EObject representing 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., the EPackage 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 a ResourceSetPartition of the the global MDSDBlackboard.
        Throws:
        NullPointerException - In case partitionId == 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 case null is passed, this method does nothing.
        Parameters:
        ePackage - An EPackage that describes a meta-model.
      • removeModel

        public void removeModel​(EObject model)
        Removes the given model from the cache, if present.
        This method does nothing, if null is passed or the given model is not cached.
        Parameters:
        model - The EObject to 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 QVToModelCache which 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 - An EPackage that describes a meta-model.
        Returns:
        The model, contained in an Optional and represented as an EObject, that is an instance of the given meta-model, or an empty Optional if none could be found.
        Throws:
        NullPointerException - In case ePackage == 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 - An EPackage that describes a meta-model.
        Returns:
        true if a model of the given type is stored, false otherwise.
        Throws:
        NullPointerException - In case ePackage == null.
        See Also:
        getModelsByType(EPackage)