// File: Vertex.java
// Time-stamp: "2005-09-21 23:07:00 calvanese"
// Purpose: Written exam 20/9/2005 - BSc in Computer Science (6CFU)
//          solution part 1

import java.io.*;

public class Vertex {

  // representation of the objects
  private double x;
  private double y;
  private String color;

  // pubblic methods

  public Vertex(double x, double y, String col) {
    this.x = x;
    this.y = y;
    color = col;
  }
  
  public double getX() {
    return x;
  }
  
  public double getY() {
    return y;
  }

  public String getColor() {
    return color;
  }
  
  // method not requested by the specification
  public static Vertex readVertex(BufferedReader br) throws IOException {
    String s = br.readLine();
    if (s != null && !s.equals("")) {
      String[] fields = s.split(" +");
      Vertex v = new Vertex(Double.parseDouble(fields[0]),
                            Double.parseDouble(fields[1]), fields[2]);
      return v;
    } else
      return null;
  }

}
