/***********************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Actuate Corporation - initial API and implementation
 ***********************************************************************/

package org.eclipse.birt.chart.datafeed;

/**
 * StockEntry
 */
public final class StockEntry
{

	private double dOpen;

	private double dLow;

	private double dHigh;

	private double dClose;

	/**
	 * 
	 * @param dOpen
	 * @param dLow
	 * @param dHigh
	 * @param dClose
	 */
	public StockEntry( double dOpen, double dLow, double dHigh, double dClose )
	{
		this.dOpen = dOpen;
		this.dLow = dLow;
		this.dHigh = dHigh;
		this.dClose = dClose;
	}

	/**
	 * 
	 * @param oaFourComponents
	 */
	public StockEntry( Object[] oaFourComponents )
	{
		assert oaFourComponents.length == 4;
		this.dHigh = ( oaFourComponents[0] instanceof Number ) ? ( (Number) oaFourComponents[0] ).doubleValue( )
				: Double.NaN;
		this.dLow = ( oaFourComponents[1] instanceof Number ) ? ( (Number) oaFourComponents[1] ).doubleValue( )
				: Double.NaN;
		this.dOpen = ( oaFourComponents[2] instanceof Number ) ? ( (Number) oaFourComponents[2] ).doubleValue( )
				: Double.NaN;
		this.dClose = ( oaFourComponents[3] instanceof Number ) ? ( (Number) oaFourComponents[3] ).doubleValue( )
				: Double.NaN;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString( )
	{
		return "H" + dHigh + " L" + dLow + " O" + dOpen + " C" + dClose; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
	}

	/**
	 * @return Returns the close.
	 */
	public final double getClose( )
	{
		return dClose;
	}

	/**
	 * @param close
	 *            The close to set.
	 */
	public final void setClose( double close )
	{
		this.dClose = close;
	}

	/**
	 * @return Returns the high.
	 */
	public final double getHigh( )
	{
		return dHigh;
	}

	/**
	 * @param high
	 *            The high to set.
	 */
	public final void setHigh( double high )
	{
		this.dHigh = high;
	}

	/**
	 * @return Returns the low.
	 */
	public final double getLow( )
	{
		return dLow;
	}

	/**
	 * @param low
	 *            The low to set.
	 */
	public final void setLow( double low )
	{
		this.dLow = low;
	}

	/**
	 * @return Returns the open.
	 */
	public final double getOpen( )
	{
		return dOpen;
	}

	/**
	 * @param open
	 *            The open to set.
	 */
	public final void setOpen( double open )
	{
		this.dOpen = open;
	}
}
