I am trying to find the module of a node during generation. I first tried:
Ibml.logBehavior(this, "getExtensions", "Module " + this.model.module);
And this prints a null value for the module. I was not expecting this, the module in the MPS model is not empty at all. Then I tried to cast the node<...> to SModel from the openapi and then get the SModule (also from the openapi) from that.
SModel sModel = ((SModel) this.model);
SModule sModule = sModel.getModule();
Ibml.logBehavior(this, "getExtensions", "Module " + sModel.getModule());
Ibml.logBehavior(this, "getExtensions", "Module " + sModel.getModule().getClass().getName());
And found that this prints the correct module (sModel.getModule() is not empty and correct. I would have expected the same result, but it seems that there is some subtle distinction between openapi types and node<...> types.
I cast from node<Module> to SModule, but I cannot find a way to get an node<Module> again from an SModule.
I don't quite understand how the node<..> types and the S* types in the openapi interact. Is this described anywhere? Or can someone explain?
The print of the classname shows that the model in question is actually a TransientModelsInModule instance. Would this mean that the first piece of code gets the module of a transient Model, while the second piece of code gets the module of the original model?