Home » Modeling » Epsilon » resolving a reference to an object, instead of obtaining a copy
| |
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 |
Esther 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 |
Dimitrios Kolovos 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 #583569 is a reply to message #502041] |
Mon, 07 December 2009 09:22 |
Esther 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 |
Dimitrios Kolovos 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
|
|
|
Goto Forum:
Current Time: Thu Sep 19 10:11:42 GMT 2024
Powered by FUDForum. Page generated in 0.04904 seconds
|