1  import java.awt.*;
  2  import java.awt.geom.*;
  3  
  4  /**
  5     An edge that is shaped like a straight line.
  6  */
  7  public class LineEdge extends AbstractEdge
  8  {
  9     public void draw(Graphics2D g2)
 10     {
 11        g2.draw(getConnectionPoints());
 12     }
 13  
 14     public boolean contains(Point2D aPoint)
 15     {
 16        final double MAX_DIST = 2;
 17        return getConnectionPoints().ptSegDist(aPoint) 
 18           < MAX_DIST;
 19     }
 20  }