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