summaryrefslogtreecommitdiffstats
path: root/lookup/GSMLut.java
blob: 7b870014ee9bca50414e6f94b4a5194f44513965 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package lookup;

import helper.ListGPS;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

import DataStructure.GPScoordinate;
import DataStructure.GSMMap;
import DataStructure.SingleBTS;

/**
 * Throw in one or more MR (BTS-list). Get Score Element with possible
 * Coordinates. This GSMLut uses ScoreElements to represent coordinates and
 * their possibility. NOT USED!!!!
 * 
 * @author richy
 * 
 */
public class GSMLut {
	// private GSMMap map;
	private SingleBTS[] content;
	private ArrayList<ILut> lookups = new ArrayList<ILut>();

	/**
	 * Create inverse of map
	 * 
	 * @param map
	 *            GSMmap to use
	 */
	public GSMLut(GSMMap map) {
		// this.map = map;
		content = map.getUniqueBTSlist(); // check if content also contains
											// E-Plus arfcn!
		for (SingleBTS current : content) {
			// create a LUT for every BTS
			lookups.add(new BTSLut(current.ARFCN, map, 20, 20));
			// traverse the whole GSMmap, add values to BTSLut
		}

	}

	public LinkedList<GPScoordinate> find(List<SingleBTS> MR) {
		// traverse lookups. Build result array
		// LinkedList<LinkedList<GPScoordinate>> set = new
		// LinkedList<LinkedList<GPScoordinate>>();
		LinkedList<GPScoordinate> set = new LinkedList<GPScoordinate>();
		for (ILut lut : lookups) {
			set.addAll(lut.get(MR));
			// set.add(lut.get(MR));
		}
		// no intersect
		// return ListGPS.intersect(set);
		return set;
	}

	/**
	 * Returns Score Elements. No intersect is done. Only common Coordinates are
	 * counted. This should be a better way to start!
	 * 
	 * @param MR
	 * @return
	 */
	public LinkedList<ScoreElement> findWithScore(List<SingleBTS> MR) {
		LinkedList<GPScoordinate> resultset = find(MR);
		// get unique coords
		GPScoordinate[] unique = ListGPS.content(resultset);
		ArrayList<ScoreElement> scores = new ArrayList<ScoreElement>(
				unique.length);
		for (GPScoordinate coord : unique) {
			scores.add(new ScoreElement(coord));
		}
		// score elements are initialized. traverse the whole result set now
		ListIterator<GPScoordinate> itr = resultset.listIterator();
		for (int i = 0; i < scores.size(); i++) {
			while (itr.hasNext()) {

			}
			// reset itr
		}

		return null;

	}

}