/*CS 302 Point test program
  1/31
*/

import java.awt.Color;  //make sure you understand this


public class PointMain {

  public static void main(String [] args ) {
    //create some points
    Point p1 = new Point();
    Point p2 = new Point(15, 2, Color.blue);
    Point p3 = new Point(p2.getX(), p2.getY()); //make sure you understand this

    //test them   
    System.out.println("The color of p1 is: " + p1.getColor());

    System.out.println("The location of p2 is: (" + p2.getX() + ", " + p2.getY() + ")");
    
    //make p2 be at the same location and have the same color as p1
    p2.move(p1);
    p2.setColor(p1.getColor());
    
    System.out.println("Now the location of p2 is: (" + p2.getX() + ", " + p2.getY() + ")");
    
    //We'd like to make sure that the locations of p1 and p2 are now equal
    //Question: will the next lines work properly?  if not, how would you change this?
    
    boolean equal = (p1 == p2);  //note: == means comparing for equality, e.g. 3==2 is false, 2==2 is true
    System.out.println("P2 and P2 are equal: " + equal);
    
    //above is not comparing the contents of p1 and p2's instance fields, but is comparing the memory locations
    //where p1 and p2 are stored
    
    //correct way:
    System.out.println("P2 and P2 are equal: " + Point.compare(p1, p2));
    
    //another correct way:
    System.out.println("P2 and P2 are equal: " + p1.compareTo(p2));
  }
}
