@Override
	public Location locate(Measurement currentMeasurement) {
		
		if(debug) {
			loadParameters();
		}
		
		Location loc = null;
		
		// get all measurement in database
		List<Measurement> list = measurementHome.getAll();		
		/* check for similarity */
		TreeSet<Measurement> hits = new TreeSet<Measurement>(new MeasurementComparator(currentMeasurement));
		
		for(Measurement m : list) {
			int level = measurementSimilarityLevel(m, currentMeasurement);
			
			if(debug) {
				//debug
				Fingerprint fp = fingerprintHome.getByMeasurementId(m.getId());
				
				if(fp != null) {
					Location l = (Location) fp.getLocation();
					if(l != null) {
						log.log(Level.FINE, "location \"" + l.getMap().getMapName() + l.getSymbolicID() + "\" achieved similarity level " + level);
					}
				}			
				//end debug
			}
			
			if(level > LOCATION_THRESHOLD) {
				hits.add(m);
			}
		}
		
		if (hits.size() > 0) {
			
			Measurement bestMatch = hits.first();
			
			
			Fingerprint f = fingerprintHome.getByMeasurementId(bestMatch.getId());
			
			if(f != null) {
				loc = (Location) f.getLocation();
				loc.setAccuracy(measurementSimilarityLevel(bestMatch, currentMeasurement));
				
				if(debug) {			
					log.log(Level.FINE, "Best match: \"" + loc.getMap().getMapName() + loc.getSymbolicID() + "\" achieved similarity level " + loc.getAccuracy());			
				}
			}
			
	
		}
		
		return loc;
	}