Login | Register
My pages Projects Community openCollabNet

5.8. Reverse Engineering Subsystem

Purpose: Provide a central registration point for language reverse engineering modules as well as common reverse engineering methods for all languages.

The Reverse Engineering subsystem is located in org.argouml.uml.reveng.

The Reverse Engineering Subsystem is a Control subsystem. See Section 4.5, “View and Control subsystems”.

  • All language reverse engineering modules must implement the org.argouml.uml.reveng.ImportInterface interface.

  • All modules must implement the org.argouml.moduleloader.ModuleInterface interface.

  • At initialization time, each language registers themselves using org.argouml.uml.reveng.ImportManager.

5.8.1. Common import code

In late 2006, the source importers were restructured to make them GUI independent and move as much functionality as possible to common code. Things such as source file selection and class diagram creation which previously had been provided by the specific language importers are now provided as common services, simplifying creation of new language importers. These services also include a GUI independent method for requesting, saving, and restoring any language-specific settings (not fully implemented).

5.8.2. Diagram layout algorithms

The classes in org.argouml.uml.diagram.static_structure.layout.* hold the Class diagram layout code. No layout for other diagram types yet. It's based on a ranking scheme for classes and interfaces. The rank of a class/interface depends on the total number of (direct or indirect) super-classes. So if class B extends A (with rank(A)=0), then rank(B)=1. If C extends B, then rank(C)=2 since it has 2 super-classes A,B. An implemented interface is treated similar to a extended class. The objects are placed in rows then, that depend on their rank. rank(0)=1st row. rank(1) =2nd row (below the 1st one) etc. Example:

In the next diagram, a link goes to an object that is not in the row above:

In this case, insert virtual objects which are linked to the actual target and link to them:

The objects are sorted within their row then to minimize crossing links between them. Compute the average value of the vertical positions of all linked objects in the row above. Example: we have 2 ranks, 0 and 1, with 3 classes each:

A B C : rank 0

D E F : rank 1

We give the super-classes an index in their rank (assuming that they are already sorted):

A:0, B:1, C:2

D, E, F have the following links (A, B, C could be interfaces, so I allow links to multiple super-classes here):

D -> C

E -> A and C

F -> A and B

Compute the average value of the indexes:

D = 2 (C has index 2 / 1 link)

E = 0 + 2 / 2 = 1 (A=0, C=2 divide by 2 links)

F = 0 + 1 / 2 = 0.5 (A=0, B=1, 2 links)

Then sort the subclasses by that value:

F(is 0.5), E(is 1), D(is 2)

So the placement is:

A B C

(here are the links, but I can hardly paint them as ASCIIs)

F E D