/*
 * Vertex.java
 *
 * Created on December 2, 2003, 11:37 PM
 */

/**
 *
 * @author  linyuan
 */
public class Vertex extends Selectable {
    
    int x;
    
    int y;
    
    int r;
    
    java.util.List edges = null;
    
    /** Creates a new instance of Vertex */
    public Vertex() {
    }
    
    double distance(int x, int y) {
        double temp=Math.sqrt(0.0+(this.x-x)*(this.x-x)+(this.y-y)*(this.y-y));
        if(temp<=this.r) return 0;
        else return temp;
    }
    

    public Vertex(int x, int y) {
        this.x=x;
        this.y=y;
        this.r=5;
        edges=new java.util.LinkedList();
    }
    
    public void draw(java.awt.Graphics g) {
        if(isSelected()) g.setColor(selectedColor);
        else g.setColor(color);
        g.fillOval(x-r,y-r,2*r,2*r);
    }
   
    
}

