    01: import java.awt.geom.*;
    02:
    03: /**
    04:    A UML class diagram.
    05: */
    06: public class ClassDiagramGraph extends Graph
    07: {
    08:
    09:    public boolean connect(Edge e, Point2D p1, Point2D p2)
    10:    {
    11:       Node n1 = findNode(p1);
    12:       Node n2 = findNode(p2);
    13:       if (n1 == n2) return false;
    14:       return super.connect(e, p1, p2);
    15:    }
    16:
    17:    public Node[] getNodePrototypes()
    18:    {
    19:       return new Node[] { new ClassNode() };
    20:    }
    21:
    22:    public Edge[] getEdgePrototypes()
    23:    {
    24:       ClassRelationshipEdge[] e = new ClassRelationshipEdge[6];
    25:
    26:       e[0] = new ClassRelationshipEdge();
    27:       e[0].setLineStyle(LineStyle.DOTTED);
    28:       e[0].setEndArrowHead(ArrowHead.V);
    29:
    30:       e[1] = new ClassRelationshipEdge();
    31:       e[1].setBentStyle(BentStyle.VHV);
    32:       e[1].setEndArrowHead(ArrowHead.TRIANGLE);
    33:
    34:       e[2] = new ClassRelationshipEdge();
    35:       e[2].setBentStyle(BentStyle.VHV);
    36:       e[2].setLineStyle(LineStyle.DOTTED);
    37:       e[2].setEndArrowHead(ArrowHead.TRIANGLE);
    38:
    39:       e[3] = new ClassRelationshipEdge();
    40:       e[3].setBentStyle(BentStyle.HVH);
    41:       e[3].setEndArrowHead(ArrowHead.V);
    42:
    43:       e[4] = new ClassRelationshipEdge();
    44:       e[4].setBentStyle(BentStyle.HVH);
    45:       e[4].setStartArrowHead(ArrowHead.DIAMOND);
    46:
    47:       e[5] = new ClassRelationshipEdge();
    48:       e[5].setBentStyle(BentStyle.HVH);
    49:       e[5].setStartArrowHead(ArrowHead.BLACK_DIAMOND);
    50:
    51:       return e;
    52:   }
    53: }
    54:
    55:
    56:
    57:
    58: