In order to plan the paths of edges in class diagrams, several initial changes are needed:
A way to represent the path of an edge
A way to store the paths of edges
A way to classify edges so that their paths can be planned in a predictable order
To meet these requirements 3 classes: EdgePath, EdgeStorage, and EdgePriority were added.
Representing and storing the paths of edges
An EdgePath class was added, which represents the path of an edge in a class diagram as a list of Points. An EdgeStorage class was created, which maps the edges of a class diagram to EdgePaths.
Once the Layouter class is implemented, it will plan the EdgePaths of edges in a class diagram and store them in EdgeStorage. Then, these stored paths can be used to draw clean, readable class diagrams without edge overlapping.
The EdgeStorage class has several public methods, including a method which allows users to store an Edge and its EdgePath, and a method to get the stored EdgePath of an Edge. Notably, EdgeStorage has a clearStorage() method which clears all entries of edges and their EdgePaths. This is necessary because EdgeStorage must be cleared and refilled whenever the diagram changes.
Establishing a priority classification for edges
An enumerated type EdgePriority was added which classifies class diagram edges. This way, all edges of a higher EdgePriority are planned before edges of lower EdgePriority. Classifying edges using an enumerated type is less error-prone than using the Edge class hierarchy. For example, Inheritance and Implementation edges are both considered GeneralizationEdges, and many different edges can be self-edges. The EdgePriority enumerated type has several public methods which are useful for edge
classification.
The order of EdgePriority is as follows (where Inheritance edges have the highest priority):
Inheritance
Implementation
Aggregation
Composition
Association
Dependency
Self-edges
Other (non-class diagram edges)
Tests for EdgePath, EdgePriority, and EdgeStorage were also added.
In order to plan the paths of edges in class diagrams, several initial changes are needed:
To meet these requirements 3 classes:
EdgePath
,EdgeStorage
, andEdgePriority
were added.Representing and storing the paths of edges
An
EdgePath
class was added, which represents the path of an edge in a class diagram as a list ofPoint
s. AnEdgeStorage
class was created, which maps the edges of a class diagram toEdgePath
s.Once the
Layouter
class is implemented, it will plan theEdgePath
s of edges in a class diagram and store them inEdgeStorage
. Then, these stored paths can be used to draw clean, readable class diagrams without edge overlapping.The
EdgeStorage
class has several public methods, including a method which allows users to store anEdge
and itsEdgePath
, and a method to get the storedEdgePath
of anEdge
. Notably,EdgeStorage
has aclearStorage()
method which clears all entries of edges and theirEdgePath
s. This is necessary becauseEdgeStorage
must be cleared and refilled whenever the diagram changes.Establishing a priority classification for edges
An enumerated type
EdgePriority
was added which classifies class diagram edges. This way, all edges of a higherEdgePriority
are planned before edges of lowerEdgePriority
. Classifying edges using an enumerated type is less error-prone than using the Edge class hierarchy. For example, Inheritance and Implementation edges are both consideredGeneralizationEdges
, and many different edges can be self-edges. TheEdgePriority
enumerated type has several public methods which are useful for edge classification.The order of EdgePriority is as follows (where Inheritance edges have the highest priority):
Tests for
EdgePath
,EdgePriority
, andEdgeStorage
were also added.