Package com.bericotech.clavin.gazetteer

Examples of com.bericotech.clavin.gazetteer.CountryCode


    }
   
    public static List<CountryCode> getUniqueCountries(List<ResolvedLocation> resolvedLocations){
        List<CountryCode> countries = new ArrayList<CountryCode>();
        for(ResolvedLocation resolvedLocation: resolvedLocations){
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            if(country==CountryCode.NULL){  // skip things that aren't in countries (ie. "Asia")
                continue;
            }
            if( !countries.contains(country) ){
                countries.add(country);
View Full Code Here


      HashMap<String,Integer> stateCounts = new HashMap<String,Integer>();
      for (ResolvedLocation resolvedLocation: resolvedLocations){
            if(resolvedLocation.getGeoname().getPrimaryCountryCode()==CountryCode.NULL){
                continue;
            }
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            String adm1Code = resolvedLocation.getGeoname().getAdmin1Code();
            String key = Adm1GeoNameLookup.getKey(country, adm1Code);
            if(!Adm1GeoNameLookup.isValid(key)){    // skip things that aren't actually ADM1 codes
                continue;
            }
View Full Code Here

        HashMap<CountryCode,Integer> countryCounts = new HashMap<CountryCode,Integer>();
        for (ResolvedLocation resolvedLocation: resolvedLocations){
            if(resolvedLocation.getGeoname().getPrimaryCountryCode()==CountryCode.NULL){
                continue;
            }
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            if(!countryCounts.containsKey(country)){
                countryCounts.put(country, 0);
            }
            countryCounts.put(country, countryCounts.get(country)+1);
        }
View Full Code Here

        HashMap<CountryCode,Integer> countryCounts = FocusUtils.getCountryCounts(resolvedLocations);
        if(countryCounts.size()==0){
            return results;
        }
        // find the most mentioned
        CountryCode primaryCountry = null;       
        for(CountryCode countryCode: countryCounts.keySet()){
            if( (primaryCountry==null) || (countryCounts.get(countryCode) > countryCounts.get(primaryCountry)) ){
                primaryCountry = countryCode;
            }
        }
        logger.info("Found primary country "+primaryCountry);
        // return results
        if(primaryCountry!=null) {
            results.add( new FocusLocation(
                    CountryGeoNameLookup.lookup( primaryCountry.name()),countryCounts.get(primaryCountry) )
            );
           for(CountryCode countryCode: countryCounts.keySet()){
                if( countryCode != primaryCountry && countryCounts.get(countryCode) == countryCounts.get(primaryCountry) ){
                    results.add( new FocusLocation(
                            CountryGeoNameLookup.lookup( countryCode.name()),countryCounts.get(countryCode) )
View Full Code Here

TOP

Related Classes of com.bericotech.clavin.gazetteer.CountryCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.