Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » resolving a reference to an object, instead of obtaining a copy
resolving a reference to an object, instead of obtaining a copy [message #502006] Fri, 04 December 2009 17:30 Go to next message
Esther is currently offline EstherFriend
Messages: 8
Registered: July 2009
Junior Member
Hi Dimitris,

I have a model that stores references to objects in other models.
When I load this model and try to access the referred objects, I
obtain a copy of them instead of the real ones. Do you know how
could I get the real ones?

(All models are passed as parameters to an EOL file that I'm executing).

Thx,
Esther
Re: resolving a reference to an object, instead of obtaining a copy [message #502041 is a reply to message #502006] Fri, 04 December 2009 21:10 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi Esther,

Can you be a bit more specific here: What do you mean when you speak of
a 'copy'? How do you distinguish these objects from each other?

Steffen

Esther wrote:
> Hi Dimitris,
>
> I have a model that stores references to objects in other models.
> When I load this model and try to access the referred objects, I
> obtain a copy of them instead of the real ones. Do you know how
> could I get the real ones?
>
> (All models are passed as parameters to an EOL file that I'm executing).
>
> Thx,
> Esther
Re: resolving a reference to an object, instead of obtaining a copy [message #502217 is a reply to message #502041] Mon, 07 December 2009 09:22 Go to previous messageGo to next message
Esther is currently offline EstherFriend
Messages: 8
Registered: July 2009
Junior Member
Hi Steffen,

Yes, I was a bit ambiguous... Let's suppose I have two
models A and B, and the objects in A have an attribute
that refers to objects in B. First I store the referred
object in a variable:

var v := object_in_A.referred_object;

Then I traverse the objects in B and compare them with
v by using '=':

for (b in B!v_type.allInstances())
if (b = v)
'I found the object'.println();

The condition evaluates to false in all cases. I also found
that the hashCodes of the elements in B are different from
v's hashCode. Nonetheless, the attribue values in 'v' are what
I expected, it is just that I do not obtain the same object.

Cheers,
Esther

Steffen Zschaler escribió:
> Hi Esther,
>
> Can you be a bit more specific here: What do you mean when you speak of
> a 'copy'? How do you distinguish these objects from each other?
>
> Steffen
>
> Esther wrote:
>> Hi Dimitris,
>>
>> I have a model that stores references to objects in other models.
>> When I load this model and try to access the referred objects, I
>> obtain a copy of them instead of the real ones. Do you know how
>> could I get the real ones?
>>
>> (All models are passed as parameters to an EOL file that I'm executing).
>>
>> Thx,
>> Esther
Re: resolving a reference to an object, instead of obtaining a copy [message #502231 is a reply to message #502217] Mon, 07 December 2009 10:30 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
On an update to this, Esther has now sent me the necessary files
(metamodels/models/eol) so that I can have a closer look at this.

Cheers,
Dimitris

Esther wrote:
> Hi Steffen,
>
> Yes, I was a bit ambiguous... Let's suppose I have two
> models A and B, and the objects in A have an attribute
> that refers to objects in B. First I store the referred
> object in a variable:
>
> var v := object_in_A.referred_object;
>
> Then I traverse the objects in B and compare them with
> v by using '=':
>
> for (b in B!v_type.allInstances())
> if (b = v)
> 'I found the object'.println();
>
> The condition evaluates to false in all cases. I also found
> that the hashCodes of the elements in B are different from
> v's hashCode. Nonetheless, the attribue values in 'v' are what
> I expected, it is just that I do not obtain the same object.
>
> Cheers,
> Esther
>
> Steffen Zschaler escribió:
>> Hi Esther,
>>
>> Can you be a bit more specific here: What do you mean when you speak
>> of a 'copy'? How do you distinguish these objects from each other?
>>
>> Steffen
>>
>> Esther wrote:
>>> Hi Dimitris,
>>>
>>> I have a model that stores references to objects in other models.
>>> When I load this model and try to access the referred objects, I
>>> obtain a copy of them instead of the real ones. Do you know how
>>> could I get the real ones?
>>>
>>> (All models are passed as parameters to an EOL file that I'm executing).
>>>
>>> Thx,
>>> Esther


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: resolving a reference to an object, instead of obtaining a copy [message #583485 is a reply to message #502006] Fri, 04 December 2009 21:10 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi Esther,

Can you be a bit more specific here: What do you mean when you speak of
a 'copy'? How do you distinguish these objects from each other?

Steffen

Esther wrote:
> Hi Dimitris,
>
> I have a model that stores references to objects in other models.
> When I load this model and try to access the referred objects, I
> obtain a copy of them instead of the real ones. Do you know how
> could I get the real ones?
>
> (All models are passed as parameters to an EOL file that I'm executing).
>
> Thx,
> Esther
Re: resolving a reference to an object, instead of obtaining a copy [message #583569 is a reply to message #502041] Mon, 07 December 2009 09:22 Go to previous message
Esther is currently offline EstherFriend
Messages: 8
Registered: July 2009
Junior Member
Hi Steffen,

Yes, I was a bit ambiguous... Let's suppose I have two
models A and B, and the objects in A have an attribute
that refers to objects in B. First I store the referred
object in a variable:

var v := object_in_A.referred_object;

Then I traverse the objects in B and compare them with
v by using '=':

for (b in B!v_type.allInstances())
if (b = v)
'I found the object'.println();

The condition evaluates to false in all cases. I also found
that the hashCodes of the elements in B are different from
v's hashCode. Nonetheless, the attribue values in 'v' are what
I expected, it is just that I do not obtain the same object.

Cheers,
Esther

Steffen Zschaler escribió:
> Hi Esther,
>
> Can you be a bit more specific here: What do you mean when you speak of
> a 'copy'? How do you distinguish these objects from each other?
>
> Steffen
>
> Esther wrote:
>> Hi Dimitris,
>>
>> I have a model that stores references to objects in other models.
>> When I load this model and try to access the referred objects, I
>> obtain a copy of them instead of the real ones. Do you know how
>> could I get the real ones?
>>
>> (All models are passed as parameters to an EOL file that I'm executing).
>>
>> Thx,
>> Esther
Re: resolving a reference to an object, instead of obtaining a copy [message #583582 is a reply to message #502217] Mon, 07 December 2009 10:30 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
On an update to this, Esther has now sent me the necessary files
(metamodels/models/eol) so that I can have a closer look at this.

Cheers,
Dimitris

Esther wrote:
> Hi Steffen,
>
> Yes, I was a bit ambiguous... Let's suppose I have two
> models A and B, and the objects in A have an attribute
> that refers to objects in B. First I store the referred
> object in a variable:
>
> var v := object_in_A.referred_object;
>
> Then I traverse the objects in B and compare them with
> v by using '=':
>
> for (b in B!v_type.allInstances())
> if (b = v)
> 'I found the object'.println();
>
> The condition evaluates to false in all cases. I also found
> that the hashCodes of the elements in B are different from
> v's hashCode. Nonetheless, the attribue values in 'v' are what
> I expected, it is just that I do not obtain the same object.
>
> Cheers,
> Esther
>
> Steffen Zschaler escribió:
>> Hi Esther,
>>
>> Can you be a bit more specific here: What do you mean when you speak
>> of a 'copy'? How do you distinguish these objects from each other?
>>
>> Steffen
>>
>> Esther wrote:
>>> Hi Dimitris,
>>>
>>> I have a model that stores references to objects in other models.
>>> When I load this model and try to access the referred objects, I
>>> obtain a copy of them instead of the real ones. Do you know how
>>> could I get the real ones?
>>>
>>> (All models are passed as parameters to an EOL file that I'm executing).
>>>
>>> Thx,
>>> Esther


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Previous Topic:Problem using EVL on a UML 2.1 meta-model?
Next Topic:Problem using EVL on a UML 2.1 meta-model?
Goto Forum:
  


Current Time: Fri Apr 19 20:26:01 GMT 2024

Powered by FUDForum. Page generated in 0.02926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top