Design a new algorithm to draw connections between modules.

DrawConnections Collaboration Graph Task List Legend

This could be last "drawing" stuff we do for a while. Draw them neatly, with right angle turns in the open spaces between modules. Divide each edge into sub-edges based on the number of rows and columns needed for the modules.

Methods Lists by Module for Design: DrawConnections To Task List
ModuleEdge.javaThis defines the north, south, east, or west edge of the rectangle representation of an SGSModule.
13. ModuleEdge()Constructor that takes a type (NORTH, HORIZONTAL) or two and two points or one point and a width or height.
42. addStartPointsAdds an "EndPoint", incomplete object, to this ModuleEdge. The x,y position of this point along the edge will be determined after all method calls and callees have been assigned to edges, so as to minimize the number of crossing lines, etc.
43. addStopPointsAdds an "EndPoint", incomplete object, to this ModuleEdge. The x,y position of this point along the edge will be determined after all method calls and callees have been assigned to edges, so as to minimize the number of crossing lines, etc.
44. getSubEdge(int)Get the SubEdge corresponding to the supplied column or row position. This position is determined by the position of the module that will be on the other side of the connection to an EndPoint on this SubEdge.
45. createSubEdgesChunk up the module's rectangle edges into sub edges based on number of columns and rows determined in module map. These sub edges will enable a smarter way of drawing the connections. Save these sub edges in a Vector data member of ModuleEdge.
54. getNextFreeEndpointReturns the next free endpoint (starting from left or top depending on edge's orientation). This is usually used for getting an endpoint on the calling module's subedge. Uses moduleMap, and the moduleID that this module Edge belongs to. Uses the opposing module ID to detemine this is the right edge (use onNorthEdge, etc. as is used in counting connections).
ModuleSubEdge.javaThis defines a subdivision of each of the north, south, east, or west edges of the rectangle representation of an SGSModule. Each ModuleEdge will maintain a list of its ModuleSubEdges, as each SGSModule will maintain a list of its ModuleEdge.
15. ModuleSubEdge()Constructor that takes a type (NORTH, HORIZONTAL) or two and two points or one point and a width or height.
19. addEndPointAdds a new EndPoint to this sub edge.
24. getCenterPointOfNReturns the endpoint which is the "center" endpoint of the N that are being used up. N is passed in here to the callee module's sub edge. N is the number of callers on the opposite module's sub edge. Done to make sure that we don't draw funky connection lines.
25. getNextFreeEndpointReturns the next free endpoint (starting from left or top depending on edge's orientation). This is usually used for getting an endpoint on the calling module's subedge.
EndPoint.javaThis defines a point on one of the ModuleSubEdges (and therefore one of the edges, and therefore one of the modules). It represents either the calling method end of a Connection object, or the called method of a Connection object.
16. EndPoint()Constructor that (maybe) takes a type (NORTH, HORIZONTAL) or two and DEFINITELY an x,y position (and a method ID?).
32. isFreeReturns true if this EndPoint has not yet been assigned to a Method (either caller or callee).
46. addCounterpartModuleIDAdd the int ID of the module that contains the end point that will be on the other end of the connection from this endpoint. Hopefully, however this value gets set to this endpoint, the endpoint on the other end will look for this endpoint on this edge.
SGSConnection.javaSuperclass for various types of connections that can be drawn between modules. Initially, this will be limited to method calls from one method in a module to a method in another. Superclass maintains the two endpoints, as well as a list of intermediate points along the way. These intermediate points are taken from the "grid of open space points".
27. ConnectionConstructor that accepts two EndPoints.
MethodCall.javaDerived from Connection, this represents a method call from one method in a module to a method in another. This adds method and module information to the Connection object.
26. MethodCallConstructor that accepts two method IDs and their corresponding EndPoints.
30. drawDraw a line connecting all the points. If "getBestPath" works ok, the line should be nice and clean and not writing over anyone.
Graph.javaThis class represents the Graph, which is a graph of modules. The Graph is defined in an XML file which is opened for read by the caller to the Graph constructor. An Graph is made up of a number of SGSModule objects, each of which represents a module to be drawn and, in this initial version, exported to a jpeg or gif file. The main data item in this Graph is a "Document", which is an internal representation of the nodes of an XML document.
0. connectionsNot a method, a two dimensional array that tracks number of connections between two modules, whose IDs are used as subscripts into this array.
7. populateGraphBuilds a Graph using the "nodes" in the supplied XML file.
9. drawDraw each module to the graph. At some point, we'll have some fancy algorithm to put the rectangles in the proper place based on the number of method calls in and out.
17. getTotalConnectionsBetweenModulesReturns the total number of connections between modules, regardless of direction.
20. sortByModuleSort methodCallers vector by module that makes the most calls.
21. sortMethodsByModuleSort methods vector by modules that makes the most calls to the methods. NOTE: This is called before 20 in 12.
31. addToMethodCallListIn case we want to do something fancy with all the drawn method calls (highlight as the cursor goes over them!), we probably will maintain a list in Graph. And maybe this is where we'll end up drawing the connections from as well.
49. getContainingModuleGet the ID of the module of which the supplied method is a member.
50. getModuleByIDReturn the nth module, given a supplied n.
55. getModuleMapReturn the moduleMap for others that may need it (SGSDFSTree)
ModuleMap.javaThis class represents the ModuleMap, which supports the Graph of modules. This class helps lay out the modules of the Graph into a nice grid and helps maintain who's where on the grid.
1. getNumberOfRowsReturn the number of rows (already computed) to be put into this ModuleMap.
2. getNumberOfColumnsReturn the number of columns (already computed) to be put into this ModuleMap.
3. getRowPositionReturn the row position of the supplied module ID.
4. getColumnPositionReturn the column position of the supplied module ID.
8. drawDraw the plots in the right place.
11. drawConnections Use the sortedTotalArray to draw theconnections between modules. Draw connections to/from most connected module to others, the to/from the next most connected, etc.
18. getModuleAtPositionReturns the ID of the module at the supplied row, column position.
33. getModuleHeightReturn the height of each module.
34. getModuleWidthReturn the width of each module.
35. assignConnectionsToModuleSidesGo through the connections, assigning counts to the north, south, east, or west sides of the rectangle representation of the drawn modules.
36. assignConnectionsDirectionally Go through the connections, assigning counts to the north, south, east, or west sides of the rectangle representation of the drawn modules.
37. onNorthEdgeReturn true if connection to row2, column2 from row1, column1 should be placed on module in row1, col1's north edge...many cases.
SGSModule.javaThis class represents a software module, either a class or a C file, which will be analyzed as part of a functional area of a software program. This SGSModule will be drawn on a collaboration graph, represented by the class Graph.
5. SGSModule( String title, String description, Graph containingGraph)A constructor, built from the GUI dialog box (title, description), leaving the rest to be updated by SetAxis and AddMethod dialog boxes.
6. SGSModule( Node methodNode, Graph containingGraph)The constructor, building with a Node info from a parsed XML file (Document)
10. draw( Graphics g, int x, int y, int w, int h)Draw the module to the screen as a rectangle using the supplied x,y and width and height.
12. drawConnectionDraw all the connections to the methods in this module. Draw the labels representing these methods as numbers on the proper edge of the rectangle representing the module. NOTE: This is now called AFTER all subedges and endpoints have been determined.
14. createSubEdgesChunk up the module's rectangle edges into sub edges based on number of columns and rows determined in module map. These sub edges will enable a smarter way of drawing the connections.
38. addToNorthConnections(int n, int module1, int module2)Adds the supplied number to the total of connections that should be drawn off north side of rectangle. Also figures out the counts of connections between the supplied modules based on the connection's direction.
39. addToNorthConnections(int n)Adds the supplied number to the total of connections that should be drawn off north side of rectangle.
40. addNorthConnectionStartsAdds the supplied number of connection origin points from this module's top edge to the suppied module id.
41. addNorthConnectionStopsAdds the supplied number of connection destination points from this module to the suppied module id.
47. drawTheLineUse information about the modules and the supplied positions to draw a nice line, that doesn't overlap other stuff.
48. drawUncalledMethodLabelsDraws the labels of uncalled methods of this module at the appropriate positions on the previously assigned rectangle edge.
51. getStopEdgeDirectionReturns the direction (N,S,E,W) of the edge of this module to which the module whose ID is passed in.
52. getNextEdgePositionBased on the supplied direction, return the next unused edge position usable for a drawn method call. A side effect (not really) is that the number used is incremented. Later, we might use a function to pick positions in some other way (if we want first position to be in the center of the edge).
53. getStartEdgeDirectionReturns the direction (N,S,E,W) of the edge of this module to which the module whose ID is passed in.
SGSMethod.javaThis class represents the SGSMethod, which stores information about a method of a particular SGSModule. The SGSMethod will be drawn as a number in the box that represents the SGSModule
22. getMethodCallersReturn the list of ids of methods that call this method. This is also called before 20 (sortByModule) in 12. (drawConnection).
Vector methodCallersNot really a module, but an important object defined in SGSModule-> drawConnection. Need to note that we get this guy's size to get the use up the right number of endpoints from the subedge.
23. sizeReturns the size of the Vector.
OpenSpace.javaSingleton class that contains all free points that can be used to draw the connections between methods. These free points are made up of those points on the graph which are not "drawn over" by the rectangles which are the modules.
28. getBestPathBased on the two supplied EndPoints, return a list of points that represent the best path that connects them.
29. OpenSpacePointsConstructor that determines all the "open space" points based on what the module map has figured out. Called after moduleMap.draw is done, but before drawConnections.

Design-Driven Task List for DrawConnections Time spent so far: 00:00:00 To Module/Method List

Legend for DrawConnections Collaboration Graph Back To Graph
0. connections [14][10] 1. getNumberOfRows [14][10] 2. getNumberOfColumns
[42][43][12] 3. getRowPosition [42][43][12] 4. getColumnPosition 5. SGSModule( String title, String description, Graph containingGraph)
[7] 6. SGSModule( Node methodNode, Graph containingGraph) 7. populateGraph [9] 8. draw
9. draw [8] 10. draw( Graphics g, int x, int y, int w, int h) [8] 11. drawConnections
[11] 12. drawConnection [10] 13. ModuleEdge() [11] 14. createSubEdges
[14][45] 15. ModuleSubEdge() [14] 16. EndPoint() [14] 17. getTotalConnectionsBetweenModules
[14] 18. getModuleAtPosition [42][43] 19. addEndPoint [12] 20. sortByModule
[12] 21. sortMethodsByModule 22. getMethodCallers [12] 23. size
[12] 24. getCenterPointOfN [12][54] 25. getNextFreeEndpoint [12] 26. MethodCall
[26] 27. Connection [27] 28. getBestPath [8] 29. OpenSpacePoints
[12] 30. draw [12] 31. addToMethodCallList [24] 32. isFree
33. getModuleHeight 34. getModuleWidth [11] 35. assignConnectionsToModuleSides
[35] 36. assignConnectionsDirectionally [36][12] 37. onNorthEdge [36] 38. addToNorthConnections(int n, int module1, int module2)
[38] 39. addToNorthConnections(int n) [38] 40. addNorthConnectionStarts [38] 41. addNorthConnectionStops
[40] 42. addStartPoints [41] 43. addStopPoints [43][42] 44. getSubEdge(int)
[13] 45. createSubEdges [42][43] 46. addCounterpartModuleID [12] 47. drawTheLine
[12] 48. drawUncalledMethodLabels [12] 49. getContainingModule [12] 50. getModuleByID
[12] 51. getStopEdgeDirection [12] 52. getNextEdgePosition [12] 53. getStartEdgeDirection
[12] 54. getNextFreeEndpoint [13][5][6] 55. getModuleMap
Callgraph ("What calls what?") for DrawConnections Module/Method List