summaryrefslogtreecommitdiffstats
path: root/lookup/ResultScore.java
diff options
context:
space:
mode:
Diffstat (limited to 'lookup/ResultScore.java')
-rw-r--r--lookup/ResultScore.java101
1 files changed, 101 insertions, 0 deletions
diff --git a/lookup/ResultScore.java b/lookup/ResultScore.java
new file mode 100644
index 0000000..2044fda
--- /dev/null
+++ b/lookup/ResultScore.java
@@ -0,0 +1,101 @@
+//OUTDATED: no longer used: 06.06.2011
+
+package lookup;
+
+import helper.ListBTS;
+import helper.ListGPS;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import DataStructure.GPScoordinate;
+import DataStructure.GSMMap;
+import DataStructure.SingleBTS;
+
+public class ResultScore {
+ ArrayList<ScoreElement> scores = new ArrayList<ScoreElement>();
+ GSMMap map;
+
+ /**
+ * Gets score for every Coordinate
+ *
+ * @param list
+ */
+ public ResultScore(GSMMap map) {
+ this.map = map;
+
+ }
+
+ public ArrayList<ScoreElement> find(List<SingleBTS> MR, double thresholdDBm) {
+ // looks like threshold_dB has to be as high as 25dBm
+ ArrayList<GPScoordinate> places = map.find(MR, thresholdDBm);
+ GPScoordinate[] content = ListGPS.content(places);
+ for (GPScoordinate curr_content : content) {
+ // take every Coordinate once. Build a ScoreElement with it.Traverse
+ // all found places
+ ScoreElement curr_score = new ScoreElement(curr_content);
+ for (GPScoordinate curr_place : places) {
+ // count how often this place got marked
+ curr_score.inc_occurence(curr_place);
+ }
+ scores.add(curr_score);
+
+ // traverse every coordinate from gsm.find. check every tile if all
+ // mesurements match. if not, score gets low
+
+ // then, check BTS relations!
+
+ }
+
+ // check scores. compare it with map
+
+ // HACK: hardcoded ratio between 877 and 880
+ for (int i = 0; i < scores.size(); i++) {
+ ScoreElement score_at_i = scores.get(i);
+ scores.set(i, ratioboost(score_at_i, MR));
+
+ }
+
+ return scores;
+ }
+
+ private ScoreElement ratioboost(ScoreElement place, List<SingleBTS> MR) {
+ // MR are the measured values during a call
+ // ArrayList<SingleBTS> list = map.getBTSList(place.gps);
+ // compare list with MR. Ratio between 877 and 880
+
+ while (ListBTS.contains(MR, 880) && ListBTS.contains(MR, 877)) {
+ SingleBTS r880 = ListBTS.removeARFCN(MR, 880);
+ SingleBTS r877 = ListBTS.removeARFCN(MR, 877);
+ if (r880.getDldB() > -46 || r877.getDldB() > -46) {
+ continue;
+ }
+ double ratio_MR = r880.getDldB() - r877.getDldB();
+ // compare ratio with gsmmap. Get a number between 100 and 0 %
+ // double ratioscore = 0; // zero means absolutly no match
+ ArrayList<SingleBTS> maplist = map.getBTSList(place.gps);
+ // check if map has both BTS at this place
+ if (ListBTS.contains(maplist, 880)
+ && ListBTS.contains(maplist, 877)) {
+ double ratio_map = ListBTS.getARFCN(maplist, 880).getDldB()
+ - ListBTS.getARFCN(maplist, 877).getDldB();
+ // calculate distance in %
+ if (ratio_MR >= ratio_map) {
+ place.occurrence += (ratio_map / ratio_MR * 100);
+ } else if (ratio_MR < ratio_map) {
+ place.occurrence += (ratio_MR / ratio_map * 100);
+ }
+
+ }
+
+ }
+
+ return place;
+ }
+
+}
+
+class ratio {
+ SingleBTS first;
+ SingleBTS second;
+}