/*CS 302
  Definition of the Point class
*/

import java.awt.Color;

class Point {

  //instance fields
  public static final int INITIAL_X = 0;
  public static final int INITIAL_Y = 0;
  
  private int x;
  private int y;
  private Color color;

  //constructors
  public Point() {
    x = INITIAL_X;
    y = INITIAL_Y;
    color = new Color(0, 0, 0); //black
  }
  public Point(int inX, int inY) {
    move(inX, inY);
  }
  public Point(int inX, int inY, Color c) {
    color = c;
    move(inX, inY);
  }

  //static method--compares two points.  
  //Does not need an instance of Point, i.e. can be called as:
  //Point.compare(p, q) where p and q are two Point objects
  public static boolean compare(Point p1, Point p2) {
    return (p1.y == p2.y 
    	    && p1.y == p2.y
	    && p1.color.equals(p2.color));
  }

  //instance methods  
  //mutators
  public void move(int inX, int inY) {
    x = inX;
    y = inY;
  }
  public void move(Point target) {
    x = target.x;
    y = target.y;
  }
  public void setColor(Color c) {
    color = c;
  }
  
  //accessors
  public int getX() { return x; }  //bad style is displayed here... 
  public int getY() { return y; }
  public Color getColor() { return color; } 

  //I've added an illustration of if/else here
  public boolean compareTo(Point p2) {
    if(p2.x == x && p2.y == y && p2.color.equals(color)) {
      return true;
    }
    else {
      return false;
    }
  }

}

