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