package jp.ac.kyutech.mns.ist.filter;

import java.awt.Color;

import javax.swing.JOptionPane;

import jp.ac.kyutech.mns.ist.ShortStroke;
import jp.ac.kyutech.mns.ist.SimpleATN;
import jp.ac.kyutech.mns.ist.util.FileReadWriter;
import jp.ac.kyutech.mns.ist.util.NetUtil;

public class SieveSSAction extends BaseSSAction {
	int neat;
	public SieveSSAction(int _neat){
		super();
		neat = _neat;
	}
	/**
	 * ここに，単独チェックでのピックアップ条件を満たしたときの処理を書く
	 * @param ss
	 */
	public void processPickedUp(ShortStroke ss){
		sslist.add(ss);
		ss.animateToFlushColor(Color.green, 1000, 0);
//		ss.addActivity(a1);
//		ss.addActivity(a2);
	}
	public void processNotPickedUp(ShortStroke ss){
		super.processNotPickedUp(ss);
	}
	public void beforePickUp(){
		super.beforePickUp();// clear lists
		//JOptionPane.showMessageDialog(SimpleATN.theapp, "いまから処理を開始します．(SieveSSAction.beforePickUp)");
	}
	public void afterPickUp(){
		System.out.println("Picked: "+sslist.size());
		System.out.println("Not Picked: "+sslist_notpicked.size());
		
		FileReadWriter.bufclear();//筆記統計情報を蓄える前にクリア
//		FileReadWriter.buffer.add("id, gentime, sbackid, penid, paperid, count, len, avg, var,var2 , max, timediff,timed,choten,choten2,rumchoten");//TODO:
//		FileReadWriter.buffer.add("timed,var/oreten,var/rumer");
		
//		FileReadWriter.buffer.add("varsp2/ram, num_choten,num_choten2,numrammer,penid,time,point/dist,point,dist");
		FileReadWriter.buffer.add("penid,neat,numrammer,avg_time,avg_point/dist,var_point/dist,count");

		for(ShortStroke ss: sslist){
//			ss.exportBySieve();
			ss.exportBySieveAverage();
		}
		FileReadWriter.bufSave("neat"+neat+"_stat_average.csv");
		
//		JOptionPane.showMessageDialog(SimpleATN.theapp, "処理がおわりました．(SieveSSAction.afterPickUp)");
		NetUtil.openPDF("neat"+neat+"_stat_average.csv");
	}
}
