    01: import java.awt.Graphics2D;
    02: import java.awt.geom.Line2D;
    03: import java.awt.geom.Point2D;
    04: import java.awt.geom.Rectangle2D;
    05: import java.io.Serializable;
    06:
    07: /**
    08:    An edge in a graph.
    09: */
    10: public interface Edge extends Serializable, Cloneable
    11: {
    12:    /**
    13:       Draw the edge.
    14:       @param g2 the graphics context
    15:    */
    16:    void draw(Graphics2D g2);
    17:
    18:    /**
    19:       Tests whether the edge contains a point.
    20:       @param aPoint the point to test
    21:       @return true if this edge contains aPoint
    22:    */
    23:    boolean contains(Point2D aPoint);
    24:
    25:    /**
    26:       Connects this edge to two nodes.
    27:       @param aStart the starting node
    28:       @param anEnd the ending node
    29:    */
    30:    void connect(Node aStart, Node anEnd);
    31:
    32:    /**
    33:       Gets the starting node.
    34:       @return the starting node
    35:    */
    36:    Node getStart();
    37:
    38:    /**
    39:       Gets the ending node.
    40:       @return the ending node
    41:    */
    42:    Node getEnd();
    43:
    44:    /**
    45:       Gets the points at which this edge is connected to
    46:       its nodes.
    47:       @return a line joining the two connection points
    48:    */
    49:    Line2D getConnectionPoints();
    50:
    51:    /**
    52:       Gets the smallest rectangle that bounds this edge.
    53:       The bounding rectangle contains all labels.
    54:       @return the bounding rectangle
    55:    */
    56:    Rectangle2D getBounds(Graphics2D g2);
    57:
    58:    Object clone();
    59: }
    60: