summaryrefslogtreecommitdiffstats
path: root/Parse/CalcVariance.java
blob: 1aaccc9a8f4c63dbe1eb2595c696a52cf86e7dc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// OLD! no longer used! 06.06.2011

package Parse;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Timestamp;

import DataStructure.SingleBTS;

public class CalcVariance {
	static SingleBTS[] btsarray;

	public static void Calc(sqlreader sql, Timestamp start, Timestamp end,
			int ARFCN, int place) throws ClassNotFoundException, SQLException,
			IOException {
		btsarray = sql.btsarray;

		// create output File
		File outputUL = new File("varianz/Ort " + place + " UL-" + sql.IMSI
				+ ".txt");
		File outputDL = new File("varianz/Ort " + place + " DL-" + sql.IMSI
				+ ".txt");
		FileWriter streamUL = new FileWriter(outputUL);
		FileWriter streamDL = new FileWriter(outputDL);
		BufferedWriter UL = new BufferedWriter(streamUL);
		BufferedWriter DL = new BufferedWriter(streamDL);

		for (SingleBTS current : btsarray) {
			if (current.time.getTime() >= start.getTime()
					&& current.time.getTime() <= end.getTime()
					&& current.ARFCN == ARFCN) {
				if (current.getUldB() != 0)
					UL.write((int) current.getUldB() + ";");
				if (current.getDldB() != 0)
					DL.write((int) current.getDldB() + ";");

			}
		}
		UL.close();
		DL.close();
		streamUL.close();
		streamDL.close();

		Class.forName("com.mysql.jdbc.Driver");
		// open connection
		Connection cn = DriverManager.getConnection(
				"jdbc:mysql://132.230.4.13:3306/logging", "richard",
				"uh237Aug.ad7");
		cn.setReadOnly(true);
		System.out.println("Connected to SQL");
		// prepare a statement to the connection cn
		// Statement st_MR = cn.createStatement();

		// Timestamp start = new Timestamp(2011, 04, 05, 13, 42, 28, 0);
		// Timestamp end = new Timestamp(2011, 04, 05, 13, 42, 28, 0);

	}

}