// Path: NavigationDG/src/org/dg/openAIL/IdPair.java
// public class IdPair<A, B> {
//     private A first;
//     private B second;
// 
//     public IdPair(A first, B second) {
//    
//     	this.first = first;
//     	this.second = second;
//     }
//     public IdPair(IdPair<A, B> tmp) {
//  	   
//     	this.first = tmp.first;
//     	this.second = tmp.second;
//     }
//     public A getFirst() {
//     	return first;
//     }
// 
//     public void setFirst(A first) {
//     	this.first = first;
//     }
// 
//     public B getSecond() {
//     	return second;
//     }
// 
//     public void setSecond(B second) {
//     	this.second = second;
//     }
// } 
// 
// Path: NavigationDG/src/org/dg/wifi/MyScanResult.java
// public class MyScanResult {
// 	public MyScanResult(String _BSSID, int _level) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = "";
// 	}
// 	
// 	public MyScanResult(String _BSSID, int _level, String _networkName) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = _networkName;
// 	}
// 	
// 	public MyScanResult(String _BSSID, int _level, String _networkName, int _frequency) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = _networkName;
// 		frequency = _frequency;
// 	}
// 	
// 	
// 	public int level, frequency;	
// 	public String BSSID;
// 	public String networkName;
// }


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.PriorityQueue;
import org.dg.openAIL.IdPair;
import org.dg.wifi.MyScanResult;
import android.os.Environment;
import android.util.Log;
import android.util.Pair;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

		// We add the element
		queueOfWiFiMatchesToCheck.add(linkToTest);

	}

	/**
	 * Method used to reduce the size of queue
	 */
	private void reduceTheSizeOfQueue() {
		Log.d(moduleLogName, "There is a need to clear queue, size : "
				+ queueOfWiFiMatchesToCheck.size());

		Comparator<WiFiPlaceMatch> wiFiPlaceComparator = new WiFiPlaceMatchIdComparator();
		PriorityQueue<WiFiPlaceMatch> newQueue = new PriorityQueue<WiFiPlaceMatch>(
				parameters.maxQueueSize, wiFiPlaceComparator);
		for (int i = 0; i < parameters.fractionOfQueueAfterReduction
				* parameters.maxQueueSize; i++) {
			newQueue.add(queueOfWiFiMatchesToCheck.poll());
		}
		queueOfWiFiMatchesToCheck = newQueue;
		Log.d(moduleLogName,
				"Reduced queue size: " + queueOfWiFiMatchesToCheck.size());
	}

	/**
	 * Method used to reduce the size of the place database
	 */
	private void reduceTheSizeOfPlaceDatabase() {
		Log.d(moduleLogName, "We need to reduce the database size as it is =" + placeDatabase.size());
// Path: NavigationDG/src/org/dg/openAIL/IdPair.java
// public class IdPair<A, B> {
//     private A first;
//     private B second;
// 
//     public IdPair(A first, B second) {
//    
//     	this.first = first;
//     	this.second = second;
//     }
//     public IdPair(IdPair<A, B> tmp) {
//  	   
//     	this.first = tmp.first;
//     	this.second = tmp.second;
//     }
//     public A getFirst() {
//     	return first;
//     }
// 
//     public void setFirst(A first) {
//     	this.first = first;
//     }
// 
//     public B getSecond() {
//     	return second;
//     }
// 
//     public void setSecond(B second) {
//     	this.second = second;
//     }
// } 
// 
// Path: NavigationDG/src/org/dg/wifi/MyScanResult.java
// public class MyScanResult {
// 	public MyScanResult(String _BSSID, int _level) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = "";
// 	}
// 	
// 	public MyScanResult(String _BSSID, int _level, String _networkName) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = _networkName;
// 	}
// 	
// 	public MyScanResult(String _BSSID, int _level, String _networkName, int _frequency) {
// 		BSSID = _BSSID;
// 		level = _level;
// 		networkName = _networkName;
// 		frequency = _frequency;
// 	}
// 	
// 	
// 	public int level, frequency;	
// 	public String BSSID;
// 	public String networkName;
// }


// Path: NavigationDGWithSubmodules/OpenAIL/openAILdemo/src/main/java/org/dg/wifi/WiFiPlaceRecognition.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.PriorityQueue;
import org.dg.openAIL.IdPair;
import org.dg.wifi.MyScanResult;
import android.os.Environment;
import android.util.Log;
import android.util.Pair;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;


		// We add the element
		queueOfWiFiMatchesToCheck.add(linkToTest);

	}

	/**
	 * Method used to reduce the size of queue
	 */
	private void reduceTheSizeOfQueue() {
		Log.d(moduleLogName, "There is a need to clear queue, size : "
				+ queueOfWiFiMatchesToCheck.size());

		Comparator<WiFiPlaceMatch> wiFiPlaceComparator = new WiFiPlaceMatchIdComparator();
		PriorityQueue<WiFiPlaceMatch> newQueue = new PriorityQueue<WiFiPlaceMatch>(
				parameters.maxQueueSize, wiFiPlaceComparator);
		for (int i = 0; i < parameters.fractionOfQueueAfterReduction
				* parameters.maxQueueSize; i++) {
			newQueue.add(queueOfWiFiMatchesToCheck.poll());
		}
		queueOfWiFiMatchesToCheck = newQueue;
		Log.d(moduleLogName,
				"Reduced queue size: " + queueOfWiFiMatchesToCheck.size());
	}

	/**
	 * Method used to reduce the size of the place database
	 */
	private void reduceTheSizeOfPlaceDatabase() {
		Log.d(moduleLogName, "We need to reduce the database size as it is =" + placeDatabase.size());
		List<Pair<Integer, List<MyScanResult>>> tmp = new ArrayList<Pair<Integer, List<MyScanResult>>>();