    01: import java.awt.Graphics2D;
    02: import java.awt.geom.Point2D;
    03: import java.awt.geom.Rectangle2D;
    04: import java.io.Serializable;
    05:
    06: /**
    07:    A node in a graph.
    08: */
    09: public interface Node extends Serializable, Cloneable
    10: {
    11:    /**
    12:       Draw the node.
    13:       @param g2 the graphics context
    14:    */
    15:    void draw(Graphics2D g2);
    16:
    17:    /**
    18:       Translates the node by a given amount.
    19:       @param dx the amount to translate in the x-direction
    20:       @param dy the amount to translate in the y-direction
    21:    */
    22:    void translate(double dx, double dy);
    23:
    24:    /**
    25:       Tests whether the node contains a point.
    26:       @param aPoint the point to test
    27:       @return true if this node contains aPoint
    28:    */
    29:    boolean contains(Point2D aPoint);
    30:
    31:    /**
    32:       Get the best connection point to connect this node
    33:       with another node. This should be a point on the boundary
    34:       of the shape of this node.
    35:       @param aPoint an exterior point that is to be joined
    36:       with this node
    37:       @return the recommended connection point
    38:    */
    39:    Point2D getConnectionPoint(Point2D aPoint);
    40:
    41:    /**
    42:       Get the bounding rectangle of the shape of this node
    43:       @return the bounding rectangle
    44:    */
    45:    Rectangle2D getBounds();
    46:
    47:    Object clone();
    48: }