ROElement>>mostSpecificParentCommonWith:

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

ROElement>>mostSpecificParentCommonWith:

Ben Coman

I was wanting to better understand how to edges are handled in Roassal
and I modified ROElementTest>>testMostSpecificParentCommonWith:  as
follows to get a visual of how it works....
-----
    | el1 el11 el111 el12 el2 el21 view |
    view := ROView new.
    el1 := (ROElement spriteOn: 1) + ROLabel.
    el11 := (ROElement spriteOn: 11) + ROLabel.
    el111 := (ROElement spriteOn: 111) + ROLabel.
    el12 := (ROElement spriteOn: 12) + ROLabel.
    el2 := (ROElement spriteOn: 2) + ROLabel.
    el21 := (ROElement spriteOn: 21) + ROLabel.
   
    el1 add: el11; add: el12.
    el11 add: el111.
    el2 add: el21.
   
    view add: el1; add: el2.

    ROGridLayout on: el11 elements.  
    ROGridLayout on: el1 elements.
    ROGridLayout on: el2 elements.
    ROGridLayout on: view elements.
   
   
    self assert: (el1 mostSpecificParentCommonWith: el2) == view.
    self assert: (el1 mostSpecificParentCommonWith: el21) == view.
   
    self assert: (el1 mostSpecificParentCommonWith: el11) == view.
    self assert: (el12 mostSpecificParentCommonWith: el111) == el1.
   
    self assert: (el11 mostSpecificParentCommonWith: el111) == el11.  
"added by ben coman"
   
view open.
---

I casually added the last assert and the presumed answer, but the
failure which resulted surprised me.  Now I'm actually not sure what the
result should be, or even whether it makes sense for an edge to be
defined between a node and its subnode.  I'd be interested in your thoughts.

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

Re: ROElement>>mostSpecificParentCommonWith:

abergel
> I was wanting to better understand how to edges are handled in Roassal and I modified ROElementTest>>testMostSpecificParentCommonWith:  as follows to get a visual of how it works....
> -----
>   | el1 el11 el111 el12 el2 el21 view |
>   view := ROView new.
>   el1 := (ROElement spriteOn: 1) + ROLabel.
>   el11 := (ROElement spriteOn: 11) + ROLabel.
>   el111 := (ROElement spriteOn: 111) + ROLabel.
>   el12 := (ROElement spriteOn: 12) + ROLabel.
>   el2 := (ROElement spriteOn: 2) + ROLabel.
>   el21 := (ROElement spriteOn: 21) + ROLabel.
>     el1 add: el11; add: el12.
>   el11 add: el111.
>   el2 add: el21.
>     view add: el1; add: el2.
>
>   ROGridLayout on: el11 elements.      ROGridLayout on: el1 elements.
>   ROGridLayout on: el2 elements.
>   ROGridLayout on: view elements.
>       self assert: (el1 mostSpecificParentCommonWith: el2) == view.
>   self assert: (el1 mostSpecificParentCommonWith: el21) == view.
>     self assert: (el1 mostSpecificParentCommonWith: el11) == view.
>   self assert: (el12 mostSpecificParentCommonWith: el111) == el1.
>     self assert: (el11 mostSpecificParentCommonWith: el111) == el11.  "added by ben coman"
>  view open.
> ---

I have updated the test with the right solution.

> I casually added the last assert and the presumed answer, but the failure which resulted surprised me.  Now I'm actually not sure what the result should be, or even whether it makes sense for an edge to be defined between a node and its subnode.  I'd be interested in your thoughts.


#mostSpecificParentCommonWith: return the most common parent object. Edges are added in this object as the following expression shows: (edge from mostSpecificParentCommonWith: edge to).

Using the Mondrian DSL, assume

view node: 1 forIt: [
  view node: 2.
  view node: 3 ].

view node: 4.

view edgeFromAssociation: 2 -> 3.
view edgeFromAssociation: 2 -> 4.

The edge 2->3 is a children of the node 1.
The edge 2->4 is directly added in the ROView.

Does it make sense?

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



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