I have actually introduced #if: on purpose to be provocative, to trigger a discussion.Consider the following script:-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=b := RTGraphBuilder new.rectangle;
b nodes
if: [ :c | c inheritsFrom: RTLayout ];b nodes
size: #numberOfMethods;
color: (Color blue alpha: 0.5).
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 visualizationThe same script, in Mondrian, without #if:, you would write:-=-=-=-=-=-=-=-=-=-=-=-=b := RTMondrianViewBuilder new.
b shape rectangleb nodes: (RTObject withAllSubclasses select: [ :c | c inheritsFrom: RTLayout ]).
size: #numberOfMethods;
color: (Color blue alpha: 0.5).
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
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
I dislike that if: :).<Screen Shot 2014-05-14 at 7.04.09 PM.png>
Doru
On Thu, May 15, 2014 at 10:39 AM, Leo Perard <leo.perard@gmail.com> 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 <alexandre.bergel@me.com> wrote:
First of all, bravo! Beautiful picture! I share it<Screen Shot 2014-05-14 at 7.10.49 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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On May 14, 2014, at 5:31 AM, Leo Perard <leo.perard@gmail.com> 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
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev