Hi!
Maybe I am confused with something. Why the following expression return 2 and not 1? -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | model importTask importer | model := MooseModel new. model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). importTask := MooseImportClassesTask new. importTask importerClass: SmalltalkImporter. importTask importingContext: (MooseImportingContext new importClass ; importAttribute ; importMethod ; mergeClassAndMetaclass ; yourself). importTask addClass: LANNode. importer := importTask run. model addAll: importer classes. (model allClasses reject: #isStub) size -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Apparently, LANNode is twice in the model. Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
You are confused :). The problem is in the way you add the classes to the model. You should use the InstallElementsOperator which deals with the merging issue. Check the following code: model := MooseModel new. model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). importTask := MooseImportClassesTask new. importTask importerClass: SmalltalkImporter. importTask importingContext: (MooseImportingContext new importClass ; importAttribute ; importMethod ; mergeClassAndMetaclass ; yourself). importTask addClass: LANNode. importer := importTask run. (InstallElementsOperator with: importer on: model) run. (model allClasses reject: #isStub) Cheers, Doru On Wed, Nov 23, 2011 at 4:16 PM, Alexandre Bergel <[hidden email]> wrote: > Hi! > > Maybe I am confused with something. Why the following expression return 2 and not 1? > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > | model importTask importer | > model := MooseModel new. > model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). > > importTask := MooseImportClassesTask new. > importTask importerClass: SmalltalkImporter. > importTask importingContext: (MooseImportingContext new > importClass ; importAttribute ; importMethod ; > mergeClassAndMetaclass ; yourself). > importTask addClass: LANNode. > importer := importTask run. > > model addAll: importer classes. > (model allClasses reject: #isStub) size > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > Apparently, LANNode is twice in the model. > > Cheers, > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > -- www.tudorgirba.com "Every thing has its own flow" _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
This is pretty confusing :-)
If I do "model add: famixClass" I do not see a good reason for having twice the same famixClass in model. Cheers, Alexandre On 23 Nov 2011, at 12:47, Tudor Girba wrote: > Hi, > > You are confused :). > > The problem is in the way you add the classes to the model. You should > use the InstallElementsOperator which deals with the merging issue. > Check the following code: > > model := MooseModel new. > model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). > importTask := MooseImportClassesTask new. > importTask importerClass: SmalltalkImporter. > importTask importingContext: (MooseImportingContext new > importClass ; importAttribute ; importMethod ; > mergeClassAndMetaclass ; yourself). > importTask addClass: LANNode. > importer := importTask run. > (InstallElementsOperator > with: importer > on: model) run. > (model allClasses reject: #isStub) > > Cheers, > Doru > > > On Wed, Nov 23, 2011 at 4:16 PM, Alexandre Bergel > <[hidden email]> wrote: >> Hi! >> >> Maybe I am confused with something. Why the following expression return 2 and not 1? >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> | model importTask importer | >> model := MooseModel new. >> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >> >> importTask := MooseImportClassesTask new. >> importTask importerClass: SmalltalkImporter. >> importTask importingContext: (MooseImportingContext new >> importClass ; importAttribute ; importMethod ; >> mergeClassAndMetaclass ; yourself). >> importTask addClass: LANNode. >> importer := importTask run. >> >> model addAll: importer classes. >> (model allClasses reject: #isStub) size >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> >> Apparently, LANNode is twice in the model. >> >> Cheers, >> Alexandre >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> > > > > -- > www.tudorgirba.com > "Every thing has its own flow" > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Alex,
This is not what you did. You took an internal implementation dictionary and added the values to the model: importer classes is dictionary that is meant to be used internally and not from outside like you did. When you merge meta and instance side, you will have both the Smalltalk instance class and the Smalltalk meta class pointing to the same FAMIXClass object, so if you will simply iterate over the values, you will get twice the FAMIXClass. Please take a look at the MooseCompositeImporterTask>>basicRun Cheers, Doru On Wed, Nov 23, 2011 at 5:02 PM, Alexandre Bergel <[hidden email]> wrote: > This is pretty confusing :-) > > If I do "model add: famixClass" I do not see a good reason for having twice the same famixClass in model. > > Cheers, > Alexandre > > > On 23 Nov 2011, at 12:47, Tudor Girba wrote: > >> Hi, >> >> You are confused :). >> >> The problem is in the way you add the classes to the model. You should >> use the InstallElementsOperator which deals with the merging issue. >> Check the following code: >> >> model := MooseModel new. >> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >> importTask := MooseImportClassesTask new. >> importTask importerClass: SmalltalkImporter. >> importTask importingContext: (MooseImportingContext new >> importClass ; importAttribute ; importMethod ; >> mergeClassAndMetaclass ; yourself). >> importTask addClass: LANNode. >> importer := importTask run. >> (InstallElementsOperator >> with: importer >> on: model) run. >> (model allClasses reject: #isStub) >> >> Cheers, >> Doru >> >> >> On Wed, Nov 23, 2011 at 4:16 PM, Alexandre Bergel >> <[hidden email]> wrote: >>> Hi! >>> >>> Maybe I am confused with something. Why the following expression return 2 and not 1? >>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>> | model importTask importer | >>> model := MooseModel new. >>> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >>> >>> importTask := MooseImportClassesTask new. >>> importTask importerClass: SmalltalkImporter. >>> importTask importingContext: (MooseImportingContext new >>> importClass ; importAttribute ; importMethod ; >>> mergeClassAndMetaclass ; yourself). >>> importTask addClass: LANNode. >>> importer := importTask run. >>> >>> model addAll: importer classes. >>> (model allClasses reject: #isStub) size >>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>> >>> Apparently, LANNode is twice in the model. >>> >>> Cheers, >>> Alexandre >>> -- >>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>> Alexandre Bergel http://www.bergel.eu >>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Moose-dev mailing list >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >> >> >> >> -- >> www.tudorgirba.com >> "Every thing has its own flow" >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > -- www.tudorgirba.com "Every thing has its own flow" _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by abergel
Alex
you are using a low level API, you should use the CompositeImporter as I wrote in the comments. Stef On Nov 23, 2011, at 4:16 PM, Alexandre Bergel wrote: > Hi! > > Maybe I am confused with something. Why the following expression return 2 and not 1? > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > | model importTask importer | > model := MooseModel new. > model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). > > importTask := MooseImportClassesTask new. > importTask importerClass: SmalltalkImporter. > importTask importingContext: (MooseImportingContext new > importClass ; importAttribute ; importMethod ; > mergeClassAndMetaclass ; yourself). > importTask addClass: LANNode. > importer := importTask run. > > model addAll: importer classes. > (model allClasses reject: #isStub) size > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > Apparently, LANNode is twice in the model. > > Cheers, > Alexandre > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Tudor Girba-2
On Nov 23, 2011, at 7:47 PM, Tudor Girba wrote: > Alex, > > This is not what you did. You took an internal implementation > dictionary and added the values to the model: > > importer classes is dictionary that is meant to be used internally and > not from outside like you did. When you merge meta and instance side, > you will have both the Smalltalk instance class and the Smalltalk meta > class pointing to the same FAMIXClass object, so if you will simply > iterate over the values, you will get twice the FAMIXClass. > > Please take a look at the MooseCompositeImporterTask>>basicRun Yes. And just use MooseCompositeImporterTask. Stef > > Cheers, > Doru > > > On Wed, Nov 23, 2011 at 5:02 PM, Alexandre Bergel > <[hidden email]> wrote: >> This is pretty confusing :-) >> >> If I do "model add: famixClass" I do not see a good reason for having twice the same famixClass in model. >> >> Cheers, >> Alexandre >> >> >> On 23 Nov 2011, at 12:47, Tudor Girba wrote: >> >>> Hi, >>> >>> You are confused :). >>> >>> The problem is in the way you add the classes to the model. You should >>> use the InstallElementsOperator which deals with the merging issue. >>> Check the following code: >>> >>> model := MooseModel new. >>> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >>> importTask := MooseImportClassesTask new. >>> importTask importerClass: SmalltalkImporter. >>> importTask importingContext: (MooseImportingContext new >>> importClass ; importAttribute ; importMethod ; >>> mergeClassAndMetaclass ; yourself). >>> importTask addClass: LANNode. >>> importer := importTask run. >>> (InstallElementsOperator >>> with: importer >>> on: model) run. >>> (model allClasses reject: #isStub) >>> >>> Cheers, >>> Doru >>> >>> >>> On Wed, Nov 23, 2011 at 4:16 PM, Alexandre Bergel >>> <[hidden email]> wrote: >>>> Hi! >>>> >>>> Maybe I am confused with something. Why the following expression return 2 and not 1? >>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>>> | model importTask importer | >>>> model := MooseModel new. >>>> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >>>> >>>> importTask := MooseImportClassesTask new. >>>> importTask importerClass: SmalltalkImporter. >>>> importTask importingContext: (MooseImportingContext new >>>> importClass ; importAttribute ; importMethod ; >>>> mergeClassAndMetaclass ; yourself). >>>> importTask addClass: LANNode. >>>> importer := importTask run. >>>> >>>> model addAll: importer classes. >>>> (model allClasses reject: #isStub) size >>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>>> >>>> Apparently, LANNode is twice in the model. >>>> >>>> Cheers, >>>> Alexandre >>>> -- >>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>> Alexandre Bergel http://www.bergel.eu >>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Moose-dev mailing list >>>> [hidden email] >>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>>> >>> >>> >>> >>> -- >>> www.tudorgirba.com >>> "Every thing has its own flow" >>> >>> _______________________________________________ >>> Moose-dev mailing list >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> > > > > -- > www.tudorgirba.com > "Every thing has its own flow" > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Yup!
Check MooseComputeAllPrimitivePropertiesTaskTest in the last Moose Alexandre On 23 Nov 2011, at 18:05, Stéphane Ducasse wrote: > > On Nov 23, 2011, at 7:47 PM, Tudor Girba wrote: > >> Alex, >> >> This is not what you did. You took an internal implementation >> dictionary and added the values to the model: >> >> importer classes is dictionary that is meant to be used internally and >> not from outside like you did. When you merge meta and instance side, >> you will have both the Smalltalk instance class and the Smalltalk meta >> class pointing to the same FAMIXClass object, so if you will simply >> iterate over the values, you will get twice the FAMIXClass. >> >> Please take a look at the MooseCompositeImporterTask>>basicRun > > Yes. And just use MooseCompositeImporterTask. > > Stef > > >> >> Cheers, >> Doru >> >> >> On Wed, Nov 23, 2011 at 5:02 PM, Alexandre Bergel >> <[hidden email]> wrote: >>> This is pretty confusing :-) >>> >>> If I do "model add: famixClass" I do not see a good reason for having twice the same famixClass in model. >>> >>> Cheers, >>> Alexandre >>> >>> >>> On 23 Nov 2011, at 12:47, Tudor Girba wrote: >>> >>>> Hi, >>>> >>>> You are confused :). >>>> >>>> The problem is in the way you add the classes to the model. You should >>>> use the InstallElementsOperator which deals with the merging issue. >>>> Check the following code: >>>> >>>> model := MooseModel new. >>>> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >>>> importTask := MooseImportClassesTask new. >>>> importTask importerClass: SmalltalkImporter. >>>> importTask importingContext: (MooseImportingContext new >>>> importClass ; importAttribute ; importMethod ; >>>> mergeClassAndMetaclass ; yourself). >>>> importTask addClass: LANNode. >>>> importer := importTask run. >>>> (InstallElementsOperator >>>> with: importer >>>> on: model) run. >>>> (model allClasses reject: #isStub) >>>> >>>> Cheers, >>>> Doru >>>> >>>> >>>> On Wed, Nov 23, 2011 at 4:16 PM, Alexandre Bergel >>>> <[hidden email]> wrote: >>>>> Hi! >>>>> >>>>> Maybe I am confused with something. Why the following expression return 2 and not 1? >>>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>>>> | model importTask importer | >>>>> model := MooseModel new. >>>>> model sourceLanguage: ( FAMIXSmalltalkSourceLanguage new ). >>>>> >>>>> importTask := MooseImportClassesTask new. >>>>> importTask importerClass: SmalltalkImporter. >>>>> importTask importingContext: (MooseImportingContext new >>>>> importClass ; importAttribute ; importMethod ; >>>>> mergeClassAndMetaclass ; yourself). >>>>> importTask addClass: LANNode. >>>>> importer := importTask run. >>>>> >>>>> model addAll: importer classes. >>>>> (model allClasses reject: #isStub) size >>>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >>>>> >>>>> Apparently, LANNode is twice in the model. >>>>> >>>>> Cheers, >>>>> Alexandre >>>>> -- >>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>>> Alexandre Bergel http://www.bergel.eu >>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Moose-dev mailing list >>>>> [hidden email] >>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>>>> >>>> >>>> >>>> >>>> -- >>>> www.tudorgirba.com >>>> "Every thing has its own flow" >>>> >>>> _______________________________________________ >>>> Moose-dev mailing list >>>> [hidden email] >>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >>> -- >>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>> Alexandre Bergel http://www.bergel.eu >>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Moose-dev mailing list >>> [hidden email] >>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >>> >> >> >> >> -- >> www.tudorgirba.com >> "Every thing has its own flow" >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |