/*
 * Created on Jan 27, 2005
 * Shape interface that defines an common set of public methods that
 * all types of shapes should have.
 */
package cs1020;

interface Shape {
    int numOfPoints();
    void draw();
    void scale(double factor);
    void move(int x, int y);
}

/* =================================================================== */

/**
 * Created: Jan 27, 2005
 *
 */
package cs1020;

import java.awt.Color;

/**
 * A point located in the (x,y) coordinate plane.
 */
public class Point implements Shape {
    protected int xCoord;
    protected int yCoord;
    protected Color color;
    
    // Creation of Point objects with no parameters are not allowed
    private Point() {
        System.err.println("Error.");
    }
    
    /** 
     * Creates a new Point with coordinates <code>x</code> and <code>y</code>. 
     * @param x		The x coordinate
     * @param y		The y coordinate
     */
    public Point(int x, int y) {
        xCoord = x;
        yCoord = y;
        color = new Color(0,0,0);
        System.out.println("Point: Constructor");
    }
    
    /** 
     * Creates a new Point with same coordinates as <code>point</code>.
     * @param point		Point whose coordinates are used to create the new Point.  
     */
    public Point(Point point) {
        xCoord = point.xCoord;
        yCoord = point.yCoord;
        color = point.color;
        System.out.println("Point: Constructor");
    }
    
    /** 
     * Returns the number of points
     * @return 	Number of points
     */
    public int numOfPoints() {
        System.out.println("Point: numOfPoints");
        return 1;
    }
    
    /** Draws the Point. */
    public void draw() {
        System.out.println("Point: draw");
    }
    
    /** Scales the point.
     * @param factor	Amount to scale by
     */
    public void scale(double factor) {
        xCoord *= factor;
        yCoord *= factor;
        System.out.println("Point: scale");
    }
    
    /** 
     * Moves the Point to new (x,y) location
     * @param x		The x coordinate
     * @param y 	The y coordinate
     */
    public void move(int x, int y) {
        System.out.println("Point: move");
        xCoord += x;
        yCoord += y;
    }    
}
