package com.android.main;

import java.util.Vector;

import android.graphics.Bitmap;
import android.graphics.RectF;

public class Channel {
	public double []oneSecData;
	public double [] oriData;
	public double [] FFTResultData;
	public int [] XAxis;
	private Buffer buffer;
	private final int sampleRate = buffer.sRate;
	public FIRFilterImplementation filter;
	private final int secondForFFT = 4;//once modify here, modify in FrequencyDomainActivity.class as well.
	public boolean isSelected;
	public Bitmap picWhite,picGray,picPowerDensity;
	public String channelName;
	public int picX,picY,picWidth, picHeight;
	public RectF rectf;
	public double [] sumAlpha,sumBeta,sumTheta;//theta: 4~7.75, alpha: 8~13, beta:13.25~26
	public double [] sumThetaAfterScale, sumAlphaAfterScale, sumBetaAfterScale;
	public static int indexOfSumAlpha;
	private static String[] nameTable = {"FPZ","FZ","F3","F4","F7","F8","FCZ","CZ","C3","C4","PZ","P3","P4","T5","T6","OZ"};
	public double tempThetaMax,tempAlphaMax,tempBetaMax;//used to scale the graph in PowerDensity.java
	public double meanTheta, meanAlpha, meanBeta;//used to draw skullmap in PowerDensityandSkullmapActivity.java
	public Vector list;
	public Channel(String name){
		channelName = nameTable[Integer.parseInt(name)];
		oneSecData = new double[sampleRate];
		oriData = new double[secondForFFT*sampleRate];
		FFTResultData = new double [secondForFFT/2*sampleRate];
		XAxis = new int[secondForFFT/2*sampleRate];
		filter = new FIRFilterImplementation();
		isSelected = false;
		sumAlpha = new double[3600];//60min * 60(sec/min)
		sumBeta = new double[3600];
		sumTheta = new double[3600];
		sumThetaAfterScale = new double[3600];
		sumBetaAfterScale = new double[3600];
		sumAlphaAfterScale = new double[3600];
		indexOfSumAlpha=0;
		tempThetaMax = 0;
		tempAlphaMax = 0;
		tempBetaMax = 0;
		meanTheta = 0;
		meanAlpha = 0;
		meanBeta = 0;
	}
	//This initialization is used in Buffer.java
	public Channel(Buffer b){
		oneSecData = new double[sampleRate];
		list = new Vector();
	}
	//This initialization is used by getMean() of DrawFFTThread.java
	public Channel(int a){
		oneSecData = new double[sampleRate];
	}
	public void setPicXY(int xaxis,int yaxis,int width,int height){
		picX = xaxis;
		picY = yaxis;
		picWidth = width;
		picHeight = height;
		rectf = new RectF(picX,picY,picWidth,picHeight);
	}
}
