コード例 #1
0
 def __init__(self,
              sourceModel,
              targetModel,
              sourceElement=None):
     #type: (Model, Model, Optional['SourceElement']) -> None
     self.sourceModel=sourceModel
     self.targetModel=targetModel
     self.sourceElement=sourceElement
     from modelscripts.megamodels import Megamodel
     Megamodel.registerModelDependency(self)
コード例 #2
0
ファイル: sources.py プロジェクト: exescribis/ScribesInfra
    def __init__(self, importingSourceFile, importedSourceFile):
        #type: (ModelSourceFile, ModelSourceFile) -> None
        """
        Create the dependency and register it in the metamodel.
        """

        self.importingSourceFile=importingSourceFile
        #type: ModelSourceFile
        """ Source file that contains the import """

        self.importedSourceFile= importedSourceFile
        #type: ModelSourceFile
        """ Imported source file. The target of the import"""

        from modelscripts.megamodels import Megamodel
        Megamodel.registerSourceDependency(self)

        # register model dependency if not already there
        # (it should not be there)
        sm=self.importingSourceFile.model
        tm=self.importedSourceFile.model
        if Megamodel.modelDependency(sm, tm) is None:
            d=ModelDependency(sm, tm)
            Megamodel.registerModelDependency(d)