Hi,
I'm trying to customize the import context when loading an mse model by using the method MooseModel>>importFromMSEStream: aStream filteredBy: anImportingContext. The main problem is that after creating the MSE model some metrics are missing. For example, numberOfLinesOfCode is always 0 for a class. When I create the model without the importing context the metrics are fine.
The importing context that I'm using has the following fullNamesOfEntitiesToBeExtracted: 'FAMIX.Comment' 'FAMIX.Access' 'FAMIX.Inheritance' 'FAMIX.Invocation' 'FAMIX.Reference' 'FAMIX.Function' 'FAMIX.Method' 'FAMIX.Module' 'FAMIX.Namespace' 'FAMIX.Package' 'FAMIX.AnnotationType' 'FAMIX.Class' 'FAMIX.Enum' 'FAMIX.ParameterType' 'FAMIX.ParameterizedType' 'FAMIX.PrimitiveType' 'FAMIX.TypeAlias' 'FAMIX.EnumValue' 'FAMIX.GlobalVariable' 'FAMIX.ImplicitVariable' 'FAMIX.LocalVariable' 'FAMIX.Parameter' 'FAMIX.UnknownVariable' 'FAMIX.ParameterizableClass' 'FAMIX.AnnotationTypeAttribute'
Any help? Thanks Cheers, Santiago Santiago Vidal _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
Could you provide a reproducible case? Cheers, Doru On 3 Apr 2012, at 20:38, Santiago Vidal wrote: > Hi, > I'm trying to customize the import context when loading an mse model by using the method MooseModel>>importFromMSEStream: aStream filteredBy: anImportingContext. > The main problem is that after creating the MSE model some metrics are missing. For example, numberOfLinesOfCode is always 0 for a class. When I create the model without the importing context the metrics are fine. > > The importing context that I'm using has the following fullNamesOfEntitiesToBeExtracted: 'FAMIX.Comment' 'FAMIX.Access' 'FAMIX.Inheritance' 'FAMIX.Invocation' 'FAMIX.Reference' 'FAMIX.Function' 'FAMIX.Method' 'FAMIX.Module' 'FAMIX.Namespace' 'FAMIX.Package' 'FAMIX.AnnotationType' 'FAMIX.Class' 'FAMIX.Enum' 'FAMIX.ParameterType' 'FAMIX.ParameterizedType' 'FAMIX.PrimitiveType' 'FAMIX.TypeAlias' 'FAMIX.EnumValue' 'FAMIX.GlobalVariable' 'FAMIX.ImplicitVariable' 'FAMIX.LocalVariable' 'FAMIX.Parameter' 'FAMIX.UnknownVariable' 'FAMIX.ParameterizableClass' 'FAMIX.AnnotationTypeAttribute' > > Any help? Thanks > > Cheers, > Santiago > > > > -- > Santiago Vidal > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- www.tudorgirba.com Things happen when they happen, not when you talk about them happening. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Yes,
using this MSE file: http://dl.dropbox.com/u/30937790/180.mse you can run |importingContext contextSelected stream mooseModel|
contextSelected:=#(#Parameter #UnknownVariable #LocalVariable #Class #Invocation #AnnotationType #Package #AnnotationTypeAttribute #EnumValue #GlobalVariable #TypeAlias #Module #Method #Enum #Function #Reference #PrimitiveType #Inheritance #Access #ParameterType #Comment #ParameterizedType #ParameterizableClass #ImplicitVariable #Namespace ).
importingContext := FAMIXStandardImportingContext new. importingContext importAll: contextSelected.
stream := StandardFileStream readOnlyFileNamed: '180.mse'. mooseModel :=MooseModel new importFromMSEStream: stream filteredBy: importingContext. mooseModel name: 'Verveine 180'. mooseModel install.
2012/4/3 Tudor Girba <[hidden email]> Hi, Santiago Vidal _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
I forgot to mention that I'm using a redefined method MooseAbstractImportingContext>>
defineEntityDependencies to take into account classes
defineEntityDependencies | dependenciesElements dependenciesTypes |
"we iterate over all elements (FM3MetaDescriptions) of the metamodel" meta do: [ :element |
"we just keep classes that are not abstract (an abstract class will never be instanciated and therefore will never be a Moose Element)."
"FAMIXClass is an exception since it contains subclasses and can be instantiable" (((element isFM3Class) and: [((self hasSubclasses: element) not)]) or: [element name = 'Class'])
ifTrue: [ fm3Elements add: element. "we retrieve all attributes of this class"
dependenciesElements := (element allAttributes select: [ :each | each isDerived not
and: [( #(#String #Number #Boolean #Object ) includes: each type name) not ] ] ). dependenciesTypes := OrderedCollection new. dependenciesElements do: [ :each |
dependenciesTypes addAll: (self allSubclassTypesNotAbstractFor: each ) ]. entityDependencies at: element name put: dependenciesTypes asSet asOrderedCollection ] ] 2012/4/3 Santiago Vidal <[hidden email]> Yes, Santiago Vidal _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |