accessing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

accessing

Andre Hora
we wrote this test


testHasExactlySamePropertiesThan
    "self debug: #testHasExactlySamePropertiesThan"

    | cp |
    "I should have the same entity than a copy of myself"
    self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).

    self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).

the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.


   
    cp := self model entityNamed: LANOutputServer mooseName.
    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
   
    cp := self nodeClass veryDeepCopy.
    cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
    cp propertyNamed: #numberOfLinesOfCode put: 12000. 
    "This property is described as a fame property on the entity kind but not existing on the copy
    so two entities should have different properties"
    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
   
    cp := self nodeClass veryDeepCopy.
    cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
    cp propertyNamed: #NOS ifAbsentPut: 12000. 
    "This property is described but it does not exist on the entity kind
    so two entities should have different properties"
    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
   

Now is there a way to only access the values that are stored in the properties?
Because right now we are using

 allDeclaredProperties

and they include all the instance variable as well.

--
Andre Hora


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: accessing

Tudor Girba-2
Hi,

You can ask a Fame Property if it has a primitive type.

You could use this:
entity mooseDescription allPrimitiveAttributes

Cheers,
Doru


On 15 Jul 2011, at 17:36, Andre Hora wrote:

> we wrote this test
>
>
> testHasExactlySamePropertiesThan
>     "self debug: #testHasExactlySamePropertiesThan"
>
>     | cp |
>     "I should have the same entity than a copy of myself"
>     self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).
>
>     self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).
>
> the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.
>
>
>    
>     cp := self model entityNamed: LANOutputServer mooseName.
>     self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>    
>     cp := self nodeClass veryDeepCopy.
>     cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>     cp propertyNamed: #numberOfLinesOfCode put: 12000.  
>     "This property is described as a fame property on the entity kind but not existing on the copy
>     so two entities should have different properties"
>     self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>    
>     cp := self nodeClass veryDeepCopy.
>     cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>     cp propertyNamed: #NOS ifAbsentPut: 12000.  
>     "This property is described but it does not exist on the entity kind
>     so two entities should have different properties"
>     self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>    
>
> Now is there a way to only access the values that are stored in the properties?
> Because right now we are using
>
>  allDeclaredProperties
>
> and they include all the instance variable as well.
>
> --
> Andre Hora
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Not knowing how to do something is not an argument for how it cannot be done."


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: accessing

Stéphane Ducasse

On Jul 15, 2011, at 7:23 PM, Tudor Girba wrote:

> Hi,
>
> You can ask a Fame Property if it has a primitive type.
>
> You could use this:
> entity mooseDescription allPrimitiveAttributes

what is a primitive types?


>
> Cheers,
> Doru
>
>
> On 15 Jul 2011, at 17:36, Andre Hora wrote:
>
>> we wrote this test
>>
>>
>> testHasExactlySamePropertiesThan
>>    "self debug: #testHasExactlySamePropertiesThan"
>>
>>    | cp |
>>    "I should have the same entity than a copy of myself"
>>    self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).
>>
>>    self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).
>>
>> the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.
>>
>>
>>
>>    cp := self model entityNamed: LANOutputServer mooseName.
>>    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>
>>    cp := self nodeClass veryDeepCopy.
>>    cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>    cp propertyNamed: #numberOfLinesOfCode put: 12000.  
>>    "This property is described as a fame property on the entity kind but not existing on the copy
>>    so two entities should have different properties"
>>    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>
>>    cp := self nodeClass veryDeepCopy.
>>    cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>    cp propertyNamed: #NOS ifAbsentPut: 12000.  
>>    "This property is described but it does not exist on the entity kind
>>    so two entities should have different properties"
>>    self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>
>>
>> Now is there a way to only access the values that are stored in the properties?
>> Because right now we are using
>>
>> allDeclaredProperties
>>
>> and they include all the instance variable as well.
>>
>> --
>> Andre Hora
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "Not knowing how to do something is not an argument for how it cannot be done."
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: accessing

Tudor Girba-2
Fame has the following primitive types: Boolean, String, Number. So, you can check whether a property has one of these types. Anything else will be some attribute in the meta-model.

Doru

 
On 15 Jul 2011, at 21:09, Stéphane Ducasse wrote:

>
> On Jul 15, 2011, at 7:23 PM, Tudor Girba wrote:
>
>> Hi,
>>
>> You can ask a Fame Property if it has a primitive type.
>>
>> You could use this:
>> entity mooseDescription allPrimitiveAttributes
>
> what is a primitive types?
>
>
>>
>> Cheers,
>> Doru
>>
>>
>> On 15 Jul 2011, at 17:36, Andre Hora wrote:
>>
>>> we wrote this test
>>>
>>>
>>> testHasExactlySamePropertiesThan
>>>   "self debug: #testHasExactlySamePropertiesThan"
>>>
>>>   | cp |
>>>   "I should have the same entity than a copy of myself"
>>>   self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).
>>>
>>>   self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).
>>>
>>> the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.
>>>
>>>
>>>
>>>   cp := self model entityNamed: LANOutputServer mooseName.
>>>   self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>
>>>   cp := self nodeClass veryDeepCopy.
>>>   cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>>   cp propertyNamed: #numberOfLinesOfCode put: 12000.  
>>>   "This property is described as a fame property on the entity kind but not existing on the copy
>>>   so two entities should have different properties"
>>>   self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>
>>>   cp := self nodeClass veryDeepCopy.
>>>   cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>>   cp propertyNamed: #NOS ifAbsentPut: 12000.  
>>>   "This property is described but it does not exist on the entity kind
>>>   so two entities should have different properties"
>>>   self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>
>>>
>>> Now is there a way to only access the values that are stored in the properties?
>>> Because right now we are using
>>>
>>> allDeclaredProperties
>>>
>>> and they include all the instance variable as well.
>>>
>>> --
>>> Andre Hora
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>>
>> "Not knowing how to do something is not an argument for how it cannot be done."
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"If you interrupt the barber while he is cutting your hair,
you will end up with a messy haircut."


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: accessing

Stéphane Ducasse

On Jul 15, 2011, at 9:24 PM, Tudor Girba wrote:

> Fame has the following primitive types: Boolean, String, Number. So, you can check whether a property has one of these types. Anything else will be some attribute in the meta-model.

Ok I was not aware of that.
so we could define isProperty
        = self type different from primitive types?

now the problem is that there is a mismatch between fame and moose
        in moose a property is stored in a property dict and this is what we wanted to check
        in fame, moose attributes and properties are mapped to fame properties
so I guess that this is why we got confused and this is also why allDeclaredProperties does not look to cover only the properties
of a moose entities or does it?
Stef

> Doru
>
>
> On 15 Jul 2011, at 21:09, Stéphane Ducasse wrote:
>
>>
>> On Jul 15, 2011, at 7:23 PM, Tudor Girba wrote:
>>
>>> Hi,
>>>
>>> You can ask a Fame Property if it has a primitive type.
>>>
>>> You could use this:
>>> entity mooseDescription allPrimitiveAttributes
>>
>> what is a primitive types?
>>
>>
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 15 Jul 2011, at 17:36, Andre Hora wrote:
>>>
>>>> we wrote this test
>>>>
>>>>
>>>> testHasExactlySamePropertiesThan
>>>>  "self debug: #testHasExactlySamePropertiesThan"
>>>>
>>>>  | cp |
>>>>  "I should have the same entity than a copy of myself"
>>>>  self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).
>>>>
>>>>  self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).
>>>>
>>>> the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.
>>>>
>>>>
>>>>
>>>>  cp := self model entityNamed: LANOutputServer mooseName.
>>>>  self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>>
>>>>  cp := self nodeClass veryDeepCopy.
>>>>  cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>>>  cp propertyNamed: #numberOfLinesOfCode put: 12000.  
>>>>  "This property is described as a fame property on the entity kind but not existing on the copy
>>>>  so two entities should have different properties"
>>>>  self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>>
>>>>  cp := self nodeClass veryDeepCopy.
>>>>  cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
>>>>  cp propertyNamed: #NOS ifAbsentPut: 12000.  
>>>>  "This property is described but it does not exist on the entity kind
>>>>  so two entities should have different properties"
>>>>  self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
>>>>
>>>>
>>>> Now is there a way to only access the values that are stored in the properties?
>>>> Because right now we are using
>>>>
>>>> allDeclaredProperties
>>>>
>>>> and they include all the instance variable as well.
>>>>
>>>> --
>>>> Andre Hora
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "Not knowing how to do something is not an argument for how it cannot be done."
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev