
package jp.riken.brain.ni.samuraigraph.base;

/**
 * 
 * @author LANDAU
 *
 * この生成されたコメントの挿入されるテンプレートを変更するため
 * ウィンドウ > 設定 > Java > コード生成 > コードとコメント
 */
public class SGTuple2f implements Cloneable
{

	/**
	 * The x coordinate.
	 */
	public float x;

	/**
	 * The y coordinate.
	 */
	public float y;


	/**
	 * 
	 */
	public SGTuple2f(){}


	/**
	 * Constructs and initializes a SGTuple2d from the specified xy coordinates.
	 * @param x the x coordinate
	 * @param y the y coordinate
	 */
	public SGTuple2f( final float x, final float y )
	{
		this.x = x;
		this.y = y;
	}


	/**
	 * 
	 */
	public SGTuple2f( final SGTuple2f tuple )
	{
		x = tuple.x;
		y = tuple.y;
	}


	/**
	 * 
	 */
	public void setValues( final float x, final float y )
	{
		this.x = x;
		this.y = y;
	}


	/**
	 * 
	 * @param tuple
	 */
	public void setValues( final SGTuple2f tuple )
	{
		if( tuple==null )
		{
			new IllegalArgumentException("tuple==null");
		}
		this.setValues( tuple.x, tuple.y );
	}


	/**
	 * 
	 */
	public String toString()
	{
		final String str = new String("("+x+","+y+")");
		return str;
	}



	/**
	 * 
	 *
	 */
	public void clear()
	{
		this.x = 0.0f;
		this.y = 0.0f;
	}



	/**
	 * 
	 * @return
	 */
	public boolean isInfinite()
	{
		return Float.isInfinite(x) || Float.isInfinite(y);
	}



	/**
	 * 
	 * @return
	 */
	public boolean isNaN()
	{
		return Float.isNaN(x) || Float.isNaN(y);
	}



	/**
	 * 
	 */
	public Object clone()
	{
		try
		{
			return super.clone();
		}
		catch( CloneNotSupportedException ex )
		{
			// this shouldn't happen, since we are Cloneable
			throw new InternalError();
		}
	}


}
