/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package algoritmobr;
/**
 * @author Joel
 * @author Cristian
 */
public class vertice {
         //ver posibilidad de agregar un ID
         private double x;
         private double y;
         
         public vertice(){
             x = 0;
             y = 0;
         }
         
         public vertice(double x, double y){
             this.x = x;
             this.y = y;
         }
         
         public vertice(vertice x){
             if(x!=null)this.setVertice(x.getX(), x.getY());
         }
         
         public double getX(){
             return x;
         }
         public double getY(){
             return y;
         }
         public void setVertice(double X, double Y)
         {
             x=X;
             y=Y;
         }
         public String toString()
         {
             String m;
             m="(";
             if(x-((int)x)==0)
                 m=m+ String.format("%.0f", x);
             else
                 m=m+ String.format("%.2f", x);
             
             m=m+",";
             if(y-((int)y)==0)
                 m=m+ String.format("%.0f", y);
             else
                 m=m+ String.format("%.2f", y);
             return m+")";
         }
         
         @Override
         public boolean equals(Object o){
             if(o instanceof vertice){
                 if(this.x == ((vertice)o).getX() && this.y == ((vertice)o).getY())
                     return true;
                 else
                     return false;
             }
             
             return false;
         }
}

