/*
 * Copyright 2009-2010 Yuichiro Moriguchi
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.morilib.lisp.painter.geom;

/**
 *
 *
 * @author MORIGUCHI, Yuichiro 2010/12/18
 */
public class MutablePoint2D implements DoublePoint {
	
	/**
	 * 
	 */
	public static final int X = 1;
	
	/**
	 * 
	 */
	public static final int Y = 2;
	
	//
	private double x, y;
	
	/**
	 * 
	 */
	public MutablePoint2D() {}
	
	/**
	 * 
	 * @param x
	 * @param y
	 */
	public MutablePoint2D(double x, double y) {
		this.x = x;
		this.y = y;
	}
	
	/* (non-Javadoc)
	 * @see net.morilib.lisp.painter.geom.Point#get(int)
	 */
	public double get(int no) {
		switch(no) {
		case X:
			return x;
		case Y:
			return y;
		default:
			throw new IllegalArgumentException();
		}
	}

	/* (non-Javadoc)
	 * @see net.morilib.lisp.painter.geom.Point#getInt(int)
	 */
	public int getInt(int no) {
		return (int)get(no);
	}

	/**
	 * @return the x
	 */
	public double getX() {
		return x;
	}

	/**
	 * 
	 * @return
	 */
	public int getXInt() {
		return (int)x;
	}
	
	/**
	 * @param x the x to set
	 */
	public void setX(double x) {
		this.x = x;
	}

	/**
	 * @return the y
	 */
	public double getY() {
		return y;
	}

	/**
	 * 
	 * @return
	 */
	public int getYInt() {
		return (int)y;
	}

	/**
	 * @param y the y to set
	 */
	public void setY(double y) {
		this.y = y;
	}

}
