Roassal2 - edges building

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

Roassal2 - edges building

Leo Perard
Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

--
Cheers,
Leo Perard
University of Lille 1

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

Re: Roassal2 - edges building

abergel
First of all, bravo! Beautiful picture! I share it


What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
The visualization you want is not a simple one, so I suggest to use a builder for that. 

Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b build.
b view
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Cheers,
Alexandre



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



On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:

Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
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: Roassal2 - edges building

Leo Perard
I like this syntax:
b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

I will try to implement it in my own builder to adapt with my project. Thanks =)


On Thu, May 15, 2014 at 1:11 AM, Alexandre Bergel <[hidden email]> wrote:
First of all, bravo! Beautiful picture! I share it


What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
The visualization you want is not a simple one, so I suggest to use a builder for that. 

Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b build.
b view
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Cheers,
Alexandre



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



On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:

Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
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




--
Cheers,
Leo Perard
University of Lille 1

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

Re: Roassal2 - edges building

Tudor Girba-2
I dislike that if: :).

Doru


On Thu, May 15, 2014 at 10:39 AM, Leo Perard <[hidden email]> wrote:
I like this syntax:
b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

I will try to implement it in my own builder to adapt with my project. Thanks =)


On Thu, May 15, 2014 at 1:11 AM, Alexandre Bergel <[hidden email]> wrote:
First of all, bravo! Beautiful picture! I share it


What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
The visualization you want is not a simple one, so I suggest to use a builder for that. 

Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b build.
b view
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Cheers,
Alexandre



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



On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:

Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
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




--
Cheers,
Leo Perard
University of Lille 1

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




--

"Every thing has its own flow"

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

Re: Roassal2 - edges building

abergel
I have actually introduced #if: on purpose to be provocative, to trigger a discussion. 

Consider the following script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle;
if: [ :c | c inheritsFrom: RTLayout ];
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b nodes
rectangle;
if: [ :c | c inheritsFrom: RTShape ];
size: #numberOfMethods; 
color: (Color green alpha: 0.5).

b nodes color: Color gray.

b edges
connectFrom: #superclass;
if: [ :f :t | t numberOfMethods > 10 ];
useInLayout.

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This produce the visualization 

The same script, in Mondrian, without #if:, you would write:
-=-=-=-=-=-=-=-=-=-=-=-=
b := RTMondrianViewBuilder new.

b shape rectangle 
size: #numberOfMethods;
color: (Color blue alpha: 0.5).
b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTLayout ]).

b shape rectangle 
size: #numberOfMethods;
color: (Color green alpha: 0.5).
b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTShape ]).

b shape circle 
color: Color gray.
b nodes: ((RTObject withAllSubclasses reject: [ :c | c inheritsFrom: RTShape ]) reject: [ :c | c inheritsFrom: RTLayout ]).

b edges: (RTObject withAllSubclasses select: [ :c | c numberOfMethods > 10 ]) from: #superclass  to: #yourself.

b forceBasedLayout.
b open
-=-=-=-=-=-=-=-=-=-=-=-=

For a result as:

You have to manually associate the same with what has to be painted. 
Using the #if:, I use a declarative syntax, a bit like in Prolog. 

This example clearly illustrates the benefit of having #if:. Maybe it could have been called #scope: or something else. But having a condition attached to a shape is handy, at least in this situation.

Alexandre

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



On May 18, 2014, at 8:32 AM, Tudor Girba <[hidden email]> wrote:

I dislike that if: :).

Doru


On Thu, May 15, 2014 at 10:39 AM, Leo Perard <[hidden email]> wrote:
I like this syntax:
b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

I will try to implement it in my own builder to adapt with my project. Thanks =)


On Thu, May 15, 2014 at 1:11 AM, Alexandre Bergel <[hidden email]> wrote:
First of all, bravo! Beautiful picture! I share it

<Screen Shot 2014-05-14 at 7.04.09 PM.png>

What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
The visualization you want is not a simple one, so I suggest to use a builder for that. 

Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b build.
b view
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

<Screen Shot 2014-05-14 at 7.10.49 PM.png>


Cheers,
Alexandre



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



On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:

Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
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




-- 
Cheers,
Leo Perard
University of Lille 1

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




-- 
www.tudorgirba.com

"Every thing has its own flow"
_______________________________________________
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: Roassal2 - edges building

Tudor Girba-2
Hi,

Yes, having a conditional shape is useful, but not for cases when you already have distinct objects. For example, in the case asked by Leo, we already have "RTObject" and "RTObject allSubclasses". There should be no need for the if.

So, what I am suggesting is that we should have both mechanisms.

Doru


On Mon, May 19, 2014 at 8:55 PM, Alexandre Bergel <[hidden email]> wrote:
I have actually introduced #if: on purpose to be provocative, to trigger a discussion. 

Consider the following script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle;
if: [ :c | c inheritsFrom: RTLayout ];

size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b nodes
rectangle;
if: [ :c | c inheritsFrom: RTShape ];
size: #numberOfMethods; 
color: (Color green alpha: 0.5).

b nodes color: Color gray.

b edges
connectFrom: #superclass;
if: [ :f :t | t numberOfMethods > 10 ];
useInLayout.


b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This produce the visualization 

The same script, in Mondrian, without #if:, you would write:
-=-=-=-=-=-=-=-=-=-=-=-=
b := RTMondrianViewBuilder new.

b shape rectangle 

size: #numberOfMethods;
color: (Color blue alpha: 0.5).
b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTLayout ]).

b shape rectangle 
size: #numberOfMethods;
color: (Color green alpha: 0.5).
b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTShape ]).

b shape circle 
color: Color gray.
b nodes: ((RTObject withAllSubclasses reject: [ :c | c inheritsFrom: RTShape ]) reject: [ :c | c inheritsFrom: RTLayout ]).

b edges: (RTObject withAllSubclasses select: [ :c | c numberOfMethods > 10 ]) from: #superclass  to: #yourself.

b forceBasedLayout.
b open
-=-=-=-=-=-=-=-=-=-=-=-=

For a result as:

You have to manually associate the same with what has to be painted. 
Using the #if:, I use a declarative syntax, a bit like in Prolog. 

This example clearly illustrates the benefit of having #if:. Maybe it could have been called #scope: or something else. But having a condition attached to a shape is handy, at least in this situation.

Alexandre

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



On May 18, 2014, at 8:32 AM, Tudor Girba <[hidden email]> wrote:

I dislike that if: :).

Doru


On Thu, May 15, 2014 at 10:39 AM, Leo Perard <[hidden email]> wrote:
I like this syntax:
b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

I will try to implement it in my own builder to adapt with my project. Thanks =)


On Thu, May 15, 2014 at 1:11 AM, Alexandre Bergel <[hidden email]> wrote:
First of all, bravo! Beautiful picture! I share it

<Screen Shot 2014-05-14 at 7.04.09 PM.png>


What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
The visualization you want is not a simple one, so I suggest to use a builder for that. 

Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTGraphBuilder new.

b nodes
rectangle
size: #numberOfMethods; 
color: (Color blue alpha: 0.5).

b edges
connectFrom: RTObject withAllSubclasses;
if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].

b layout force. 
b global minSize: 5.
b addAll: RTObject withAllSubclasses.
b build.
b view
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

<Screen Shot 2014-05-14 at 7.10.49 PM.png>



Cheers,
Alexandre



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



On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:

Hi,

I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
I try to be more explicit with a stupid example.

I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
The only way to do that is to use the method RTEdge class>>#from:toAll:
I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
Here the code from the example :

view := RTView new.
objects := RTObject withAllSubclasses.
elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
elements @ RTPopup new.
view addAll: elements.

from := objects select: [ :o | o numberOfMethods < 10 ].
to := objects select: [ :o | o numberOfMethods >= 100].
from := view elementsFromModels: from.
to := view elementsFromModels: to.
from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].

RTForceBasedLayout on: elements.
view @ RTDraggableView .
view open

Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.

I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
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




-- 
Cheers,
Leo Perard
University of Lille 1

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




-- 
www.tudorgirba.com

"Every thing has its own flow"
_______________________________________________
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




--

"Every thing has its own flow"

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

Re: Roassal2 - edges building

abergel
I agree. Yesterday, I introduced #seed: when defining edges.

You can now do:

-=-=-=-=-=-=-=-=-=
| b m |
m := MooseModel root first.

b := RTGraphBuilder new.
b nodes color: Color blue.
b edges
        seed: m allInheritanceDefinitions;
        connectFrom: #to;
        connectTo: #from;
        useInLayout.
b layout tree.
b addAll: m allModelClasses.
-=-=-=-=-=-=-=-=-=

We probably need #seed: for the nodes as well.

Alexandre

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



On May 19, 2014, at 3:48 PM, Tudor Girba <[hidden email]> wrote:

> Hi,
>
> Yes, having a conditional shape is useful, but not for cases when you already have distinct objects. For example, in the case asked by Leo, we already have "RTObject" and "RTObject allSubclasses". There should be no need for the if.
>
> So, what I am suggesting is that we should have both mechanisms.
>
> Doru
>
>
> On Mon, May 19, 2014 at 8:55 PM, Alexandre Bergel <[hidden email]> wrote:
> I have actually introduced #if: on purpose to be provocative, to trigger a discussion.
>
> Consider the following script:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> b := RTGraphBuilder new.
>
> b nodes
>
> rectangle;
> if: [ :c | c inheritsFrom: RTLayout ];
>
> size: #numberOfMethods;
> color: (Color blue alpha: 0.5).
>
> b nodes
> rectangle;
> if: [ :c | c inheritsFrom: RTShape ];
> size: #numberOfMethods;
> color: (Color green alpha: 0.5).
>
> b nodes color: Color gray.
>
> b edges
> connectFrom: #superclass;
> if: [ :f :t | t numberOfMethods > 10 ];
> useInLayout.
>
>
> b layout force.
> b global minSize: 5.
> b addAll: RTObject withAllSubclasses.
> b open
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> This produce the visualization
> <Screen Shot 2014-05-19 at 2.51.08 PM.png>
>
> The same script, in Mondrian, without #if:, you would write:
> -=-=-=-=-=-=-=-=-=-=-=-=
> b := RTMondrianViewBuilder new.
>
> b shape rectangle
>
> size: #numberOfMethods;
> color: (Color blue alpha: 0.5).
> b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTLayout ]).
>
> b shape rectangle
> size: #numberOfMethods;
> color: (Color green alpha: 0.5).
> b nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTShape ]).
>
> b shape circle
> color: Color gray.
> b nodes: ((RTObject withAllSubclasses reject: [ :c | c inheritsFrom: RTShape ]) reject: [ :c | c inheritsFrom: RTLayout ]).
>
> b edges: (RTObject withAllSubclasses select: [ :c | c numberOfMethods > 10 ]) from: #superclass  to: #yourself.
>
> b forceBasedLayout.
> b open
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> For a result as:
> <Screen Shot 2014-05-19 at 2.51.17 PM.png>
>
> You have to manually associate the same with what has to be painted.
> Using the #if:, I use a declarative syntax, a bit like in Prolog.
>
> This example clearly illustrates the benefit of having #if:. Maybe it could have been called #scope: or something else. But having a condition attached to a shape is handy, at least in this situation.
>
> Alexandre
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> On May 18, 2014, at 8:32 AM, Tudor Girba <[hidden email]> wrote:
>
>> I dislike that if: :).
>>
>> Doru
>>
>>
>> On Thu, May 15, 2014 at 10:39 AM, Leo Perard <[hidden email]> wrote:
>> I like this syntax:
>> b edges
>> connectFrom: RTObject withAllSubclasses;
>> if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].
>>
>> I will try to implement it in my own builder to adapt with my project. Thanks =)
>>
>>
>> On Thu, May 15, 2014 at 1:11 AM, Alexandre Bergel <[hidden email]> wrote:
>> First of all, bravo! Beautiful picture! I share it
>>
>> <Screen Shot 2014-05-14 at 7.04.09 PM.png>
>>
>>
>> What you are saying make perfect sense. My answer is that yes, you probably want this behavior. However, I think that your script is the right one since you are dealing with Roassal directly.
>> The visualization you want is not a simple one, so I suggest to use a builder for that.
>>
>> Here is an example:
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> b := RTGraphBuilder new.
>>
>> b nodes
>> rectangle
>> size: #numberOfMethods;
>> color: (Color blue alpha: 0.5).
>>
>> b edges
>> connectFrom: RTObject withAllSubclasses;
>> if: [ :f :t | f == RTObject and: [ t numberOfMethods > 10 ] ].
>>
>> b layout force.
>> b global minSize: 5.
>> b addAll: RTObject withAllSubclasses.
>> b build.
>> b view
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> <Screen Shot 2014-05-14 at 7.10.49 PM.png>
>>
>>
>>
>> Cheers,
>> Alexandre
>>
>>
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> On May 14, 2014, at 5:31 AM, Leo Perard <[hidden email]> wrote:
>>
>>> Hi,
>>>
>>> I just noticed that I can't build edges between two elements if their model do no have "smalltalk link".
>>> I try to be more explicit with a stupid example.
>>>
>>> I want to display RTObject and all its subclasses. And I want an edges between the classes with less than 10 methods and those which have have more than 100 methods. (I'm agree this is stupid this is just for the example).
>>> The only way to do that is to use the method RTEdge class>>#from:toAll:
>>> I can't use the building methods like RTEdge class>>#edgesFromObject:from:to:using:inView.
>>> Here the code from the example :
>>>
>>> view := RTView new.
>>> objects := RTObject withAllSubclasses.
>>> elements := (RTBox new size: #numberOfMethods; color: (Color blue alpha: 0.5)) elementsOn: objects.
>>> elements @ RTPopup new.
>>> view addAll: elements.
>>>
>>> from := objects select: [ :o | o numberOfMethods < 10 ].
>>> to := objects select: [ :o | o numberOfMethods >= 100].
>>> from := view elementsFromModels: from.
>>> to := view elementsFromModels: to.
>>> from do: [ :el | view add: (RTEdge from: el toAll: to) + RTLine ].
>>>
>>> RTForceBasedLayout on: elements.
>>> view @ RTDraggableView .
>>> view open
>>>
>>> Maybe I am wrong and this is the way to proceed but sometime we don't want edges between elements which represents a smalltalk link.
>>>
>>> I really don't know if my request has sense. As I'm new I do not know exactly if there is a sense to build those kind of edges so this is not only a question about Roassal but also a question about software analysis.
>>>
>>> --
>>> Cheers,
>>> Leo Perard
>>> University of Lille 1
>>> _______________________________________________
>>> 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
>>
>>
>>
>>
>> --
>> Cheers,
>> Leo Perard
>> University of Lille 1
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>>
>>
>> --
>> www.tudorgirba.com
>>
>> "Every thing has its own flow"
>> _______________________________________________
>> 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
>
> "Every thing has its own flow"
> _______________________________________________
> 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