Book a Demo

Author Topic: Some strangeness in the header  (Read 3957 times)

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Some strangeness in the header
« on: April 10, 2005, 10:37:58 pm »
Two C# classes, both with exactly the same attributes.  One generates code with the line
    using Arrays;
in the "header".

The other doesn't.  Any clues????

YIPB
bruce

"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

AdamHearn

  • EA User
  • **
  • Posts: 58
  • Karma: +0/-0
    • View Profile
Re: Some strangeness in the header
« Reply #1 on: April 11, 2005, 01:21:17 am »
I've seen this type of behaviour before. Never worked out what the steps are to get it to do this and more importantly, stop doing it!

In my case the code generation has pulled in a 'using' for a package that [from what I can see] is not used. I have to edit the generated code manually to remove it :(

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Some strangeness in the header
« Reply #2 on: April 11, 2005, 03:35:26 pm »
Further investigation reveals that the one with the spurious using has:

NType=3 (No other class in the db has an Ntype of 3)
PDATA3=";ARGS=;" (No other class in the db has this)

and
Visibility=Public
Persistence=Transient
Cardinality=1

Does anyone know what the first two mean?

SIPB
bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Some strangeness in the header
« Reply #3 on: April 11, 2005, 04:03:08 pm »
NType is used for templated classes.

NType=0 means no templates.
NType=1 means that it is a parameterised class
NType=2 means that it is an instantiated class
NType=3 mean that it is both.

PDATA3 is related.

ARGS specifies what arguments the class has been given (NTypes 2 and 3), that this is blank is really saying that there is none.

The parameterised information is also stored in PDATA3.

I don't think that's related to the spurious generation though.  I created a class like this and generated from it and it didn't create the problem.

It's not in the Imports field of the generate code dialog is it?  Either that or there would be an Arrays class somewhere in your model and one class has a classifier referring to it somehow.  (Or there's a bug...  I don't like that idea though.)

Simon
« Last Edit: April 11, 2005, 04:30:20 pm by simonm »

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Some strangeness in the header
« Reply #4 on: April 11, 2005, 04:24:23 pm »
<  :-[ :-[ :-[ >

Somewhere else in the model is a little tutorial I made for a colleague in a package called "Arrays" - guess what - in that package is a class with the same name as the type of one of the attributes in this class.

</   :-[ :-[ :-[ >

This is a bit disconcerting however!  Just because a type exists "somewhere" in a model, why should the code generator create an import?

bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Some strangeness in the header
« Reply #5 on: April 11, 2005, 04:39:23 pm »
What it would come down to is this.

One of your classes (and the attributes in it) would have been created before the Arrays package.  Because of that the classifier on that attribute will still be nothing.

However, when you created the second class, EA, being incredibly helpful (maybe at the moment you're thinking it's helpful like a two year old would be) sees that the type that you entered matches a class in the model and sets the classifier for it.

As soon as that classifier is set EA does (and should) create an import in the code generation.

Simon

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Some strangeness in the header
« Reply #6 on: April 11, 2005, 09:32:33 pm »
 >:(
Not happy, Jan.

OK I created two of the classifier classes in widely different parts of the model.

Now the import statement generated is *Y&#%& random (*read "appears to depend in a mildly erratic fashion depending on the order of creation, order of last usage of the elements concerned or the order (as in powerset) of the frustration experienced by the user).

I do not like it Sam-I-Am,  I do not like software that makes arbitrary decisions on my behalf.

bug email follows... as soon as I can get some useable trace.

bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.