Adrian Kuhn wrote:
On 10 Dec 2007, at 11:29 , Toon Verwaest wrote:
I just had a look at this, and it actually
already automatically
works,
since opposites are defined as One instances of my implementation
of One
to One relations; since they have an opposite. When you write one
of the
opposites; the other one is automatically set. (I don't set the types
automatically yet; but that should only be two lines of code)
Cool!
Now the types also work. For this I just had to change the accessor
(getType) of property to:
if self.hasOpposite():
return self.getOpposite().getOwningClass()
else:
return self.type
Code generation uses these accessors instead of direct access anyway; so
it nicely generates correct type-asserts.
Writing this out to an MSE file with only one
opposite also doesn't
work
[...snip...]
I dont know if writing is necessary, as I understood your usecase is
import of handwritten metamoels, right?
Right. However, I think that we should also try to reduce filesizes
where possible anyhow. This is quite straightforward and applies to all
situations so... why not?
So for those not getting it; I basically implemented the reduction from
5 attribute declarations of two opposite fm3.Property in mse-files to
one attribute in one of these opposite properties. Opposite+type+derived
and opposite+type to just one time opposite.
cheers