package sql;

import sql.InfoPackage;
import etc.Constants;

public class DataParser {
	private static String data;
	
	public DataParser() {
		
	}
	
	public DataParser(InfoPackage pack) {
		data = "|";
		data = data.concat(String.valueOf(pack.getDate(1)));
		data = data.concat("|");
		data = data.concat(String.valueOf(pack.getDate(2)));
		data = data.concat("|");
		int [] actions = pack.getActions();
		int index = 0;
		while(actions[index] != 0 && index < 500) {
			switch(actions[index]) {
			case Constants.DIR_LEFT:
				data = data.concat("l");
				break;
			case Constants.DIR_RIGHT:
				data = data.concat("r");
				break;
			case Constants.DIR_UP:
				data = data.concat("u");
				break;
			case Constants.DIR_DOWN:
				data = data.concat("d");
				break;
			}
			index++;
		}
		
		data = data.concat("|");
	}
	
	public String getData() {
		return data;
	}
}

@@ -810,16 +810,120 @@
 t(%22%7C%22);%0A
+%09%09%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09data = data.concat(pack.getSurvey(i));%0A%09%09%09data = data.concat(%22%7C%22);%0A%09%09%7D%0A
 %09%7D%0A%09%0A%09pu

Add survey support to DataParser.