/* --------------------------
 * Kliento klase SRGMCustomer
 */
package lt.ktu.mockus.srgm;

import java.util.ArrayList;

public class SRGMCustomer
{
	public StockContainer[] dZbuy  = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZbuy new double[501];
	public StockContainer[] dZsell = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZsell new double[501];
	public StockContainer[] dZbuy1  = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZbuy new double[501];
	public StockContainer[] dZsell1 = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZsell new double[51];
	public StockContainer[] dZbuy2  = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZbuy new double[501];
	public StockContainer[] dZsell2 = null;//{ new StockContainer(), new StockContainer(), new StockContainer() };	//double dZsell new double[501];
	public double[] dZpred  = null;//{ 0, 0 ,0 };   // Spejamas akciju kursas
	public double[] dProfit = null;//{ 0, 0, 0 };
	public double[] dProfAll = null;//{ 0, 0, 0 };
	public ArrayList iN = null;//{ 0, 0, 0 };			//akciju kiekis
	public int[] iIterN = null;//{ 0, 0, 0 }; //iteracija
	public int iStrategy = 0;	//MBA losimo strategija
	public double[] Delta  = null;//{ 0, 0 ,0 };
	
	public void prepareStorage( int stockCount )
	{
		dZbuy  = new StockContainer[stockCount];
		dZsell = new StockContainer[stockCount];
		dZbuy1  = new StockContainer[stockCount];
		dZsell1 = new StockContainer[stockCount];
		dZbuy2  = new StockContainer[stockCount];
		dZsell2 = new StockContainer[stockCount];
		dZpred = new double[stockCount];
		dProfit = new double[stockCount];
		dProfAll = new double[stockCount];
		Delta = new double[stockCount];
		iIterN = new int[stockCount];
		
		if ( iN == null )
			iN = new ArrayList();
		
		for (int i = 0; iN.size() < stockCount; i++)
			iN.add( new Integer(0) );
			
		for (int i = 0; i < stockCount; i++)
		{
			//System.out.println("i:"+i);
			dZbuy[i] = new StockContainer();
			dZsell[i] = new StockContainer();
			dZbuy1[i] = new StockContainer();
			dZsell1[i] = new StockContainer();
			dZbuy2[i] = new StockContainer();
			dZsell2[i] = new StockContainer();
		}
		
	}
	
	public void setInitialData(double dZbuy, double dZsell, double dZbuy1, double dZsell1, double dZbuy2, double dZsell2,
								double dZpred,
								double dProfit,
								double dProfAll,
								int iN,
								int iIterN,
								int stockNo, double Delta)
	{
		//System.out.println("s:"+stockNo);
		//this.dZbuy[stockNo] = new StockContainer();
		this.dZbuy[stockNo].add(iIterN, dZbuy);
		
		//this.dZsell[stockNo] = new StockContainer();
		this.dZsell[stockNo].add(iIterN, dZsell);	//this.dZsell[iIterN]=dZsell;
		
		this.dZbuy1[stockNo].add(iIterN, dZbuy1);
		
		//this.dZsell[stockNo] = new StockContainer();
		this.dZsell1[stockNo].add(iIterN, dZsell1);	//this.dZsell[iIterN]=dZsell;
		
		this.dZbuy2[stockNo].add(iIterN, dZbuy2);
		
		//this.dZsell[stockNo] = new StockContainer();
		this.dZsell2[stockNo].add(iIterN, dZsell2);	//this.dZsell[iIterN]=dZsell;
		
		this.dZpred[stockNo]=dZpred;  // Spejamas akciju kursas
		
		this.iN.set(stockNo, new Integer(iN) );
		
		this.iIterN[stockNo]=iIterN;
		
		this.dProfit[stockNo]=dProfit;
		this.dProfAll[stockNo]=dProfAll;
		this.Delta[stockNo]=Delta;
	}
	
		
	public String toString(int stockNo)
	{
		return "dZpred:" + this.dZpred[stockNo] + " dProfit:" + this.dProfit[stockNo] + " dProfAll:" + this.dProfAll[stockNo] +
			" iN:" + ((Integer)this.iN.get(stockNo)).intValue() + " iIterN:" + this.iIterN[stockNo] + " iStrategy:" + this.iStrategy;
	}
}
