// Path: geo-locator/src/edu/cmu/geolocator/resource/ResourceFactory.java
// public class ResourceFactory {
// 
//   private static CollaborativeIndex collaborativeIndex = CollaborativeIndex.getInstance();
// 
//   private static AdmCode2GazCandidateMap adminCode2GazCandidateMap = AdmCode2GazCandidateMap
//           .getInstance();
// 
//   private static CCodeAdj2CTRYtype countryCode2CountryMap = CCodeAdj2CTRYtype
//           .getInstance();
// 
//   private static FeatureCode2Map featurecode2map = FeatureCode2Map.getInstance();
//   /**
//    * @return the collaborativeIndex
//    */
//   public static CollaborativeIndex getClbIndex() {
//     return collaborativeIndex;
//   }
// 
//   /**
//    * return the GazEntryAndInfo type given the admin code.
//    * @return the adminCode2GazCandidateMap
//    */
//   public static AdmCode2GazCandidateMap getAdminCode2GazCandidateMap() {
//     return adminCode2GazCandidateMap;
//   }
// 
//   /**
//    * return the Country type given the country code.
//    * @return the countryCode2CountryMap
//    * 
//    */
//   public static CCodeAdj2CTRYtype getCountryCode2CountryMap() {
//     return countryCode2CountryMap;
//   }
// 
//   public static FeatureCode2Map getFeatureCode2Map() {
//     // TODO Auto-generated method stub
//     return featurecode2map;
//   }
// }
// 
// Path: geo-locator/src/edu/cmu/geolocator/resource/gazindexing/CollaborativeIndex/InfoFields.java
// public class InfoFields {
// 
//   public static String id = "ID";
// 
//   public static String name = "ORIGINAL-NAME";
// 
//   public static String alternativeNamesCount = "ALTNAME-COUNT";
// 
//   public static String longitude = "LONGTITUDE";
// 
//   public static String latitude = "LATITUDE";
// 
//   public static String population = "POPULATION";
// 
//   public static String countryCode = "COUNTRY-CODE";
// 
//   public static String adm1Code = "ADM1-CODE";
// 
//   public static String adm2Code = "ADM2-CODE";
// 
//   public static String adm3Code = "ADM3-CODE";
// 
//   public static String adm4Code = "ADM4-CODE";
// 
//   public static String featureClass = "FEATURE-CLASS";
// 
//   public static String feature = "FEATURE";
// 
//   public static String timezone = "TIMEZONE";
// }


import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.apache.lucene.document.Document;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.IntArrayData;
import edu.cmu.geolocator.resource.ResourceFactory;
import edu.cmu.geolocator.resource.gazindexing.CollaborativeIndex.InfoFields;
import edu.stanford.nlp.util.StringUtils;
  private boolean f_userLocCountryAgree;

  private boolean f_userLocStateAgree;

  public void setF_singleCandidate(boolean b) {
    // TODO Auto-generated method stub
    this.f_singleCandidate = b;
  }

  public boolean getF_singleCandidate() {
    // TODO Auto-generated method stub
    return this.f_singleCandidate;
  }

  public boolean getF_isCountry() {
    // TODO Auto-generated method stub
    return this.isCountry();
  }

  public void setF_userLocOverlap(ArrayList<ArrayList<Document>>matrixDocs, List<LocEntityAnnotation> userLocs) {
    // TODO Auto-generated method stub
    if(userLocs ==null || userLocs.size()==0){
      //all default are false. No need to set to false explicitly.
      return;
    }
    for (ArrayList<Document> docs : matrixDocs){
      if(docs==null||docs.size()==0)
        continue;
      for (Document doc : docs){
        String dc = doc.get(InfoFields.countryCode);
// Path: geo-locator/src/edu/cmu/geolocator/resource/ResourceFactory.java
// public class ResourceFactory {
// 
//   private static CollaborativeIndex collaborativeIndex = CollaborativeIndex.getInstance();
// 
//   private static AdmCode2GazCandidateMap adminCode2GazCandidateMap = AdmCode2GazCandidateMap
//           .getInstance();
// 
//   private static CCodeAdj2CTRYtype countryCode2CountryMap = CCodeAdj2CTRYtype
//           .getInstance();
// 
//   private static FeatureCode2Map featurecode2map = FeatureCode2Map.getInstance();
//   /**
//    * @return the collaborativeIndex
//    */
//   public static CollaborativeIndex getClbIndex() {
//     return collaborativeIndex;
//   }
// 
//   /**
//    * return the GazEntryAndInfo type given the admin code.
//    * @return the adminCode2GazCandidateMap
//    */
//   public static AdmCode2GazCandidateMap getAdminCode2GazCandidateMap() {
//     return adminCode2GazCandidateMap;
//   }
// 
//   /**
//    * return the Country type given the country code.
//    * @return the countryCode2CountryMap
//    * 
//    */
//   public static CCodeAdj2CTRYtype getCountryCode2CountryMap() {
//     return countryCode2CountryMap;
//   }
// 
//   public static FeatureCode2Map getFeatureCode2Map() {
//     // TODO Auto-generated method stub
//     return featurecode2map;
//   }
// }
// 
// Path: geo-locator/src/edu/cmu/geolocator/resource/gazindexing/CollaborativeIndex/InfoFields.java
// public class InfoFields {
// 
//   public static String id = "ID";
// 
//   public static String name = "ORIGINAL-NAME";
// 
//   public static String alternativeNamesCount = "ALTNAME-COUNT";
// 
//   public static String longitude = "LONGTITUDE";
// 
//   public static String latitude = "LATITUDE";
// 
//   public static String population = "POPULATION";
// 
//   public static String countryCode = "COUNTRY-CODE";
// 
//   public static String adm1Code = "ADM1-CODE";
// 
//   public static String adm2Code = "ADM2-CODE";
// 
//   public static String adm3Code = "ADM3-CODE";
// 
//   public static String adm4Code = "ADM4-CODE";
// 
//   public static String featureClass = "FEATURE-CLASS";
// 
//   public static String feature = "FEATURE";
// 
//   public static String timezone = "TIMEZONE";
// }


// Path: geo-locator/src/edu/cmu/geolocator/model/CandidateAndFeature.java
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.apache.lucene.document.Document;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.IntArrayData;
import edu.cmu.geolocator.resource.ResourceFactory;
import edu.cmu.geolocator.resource.gazindexing.CollaborativeIndex.InfoFields;
import edu.stanford.nlp.util.StringUtils;

  private boolean f_userLocCountryAgree;

  private boolean f_userLocStateAgree;

  public void setF_singleCandidate(boolean b) {
    // TODO Auto-generated method stub
    this.f_singleCandidate = b;
  }

  public boolean getF_singleCandidate() {
    // TODO Auto-generated method stub
    return this.f_singleCandidate;
  }

  public boolean getF_isCountry() {
    // TODO Auto-generated method stub
    return this.isCountry();
  }

  public void setF_userLocOverlap(ArrayList<ArrayList<Document>>matrixDocs, List<LocEntityAnnotation> userLocs) {
    // TODO Auto-generated method stub
    if(userLocs ==null || userLocs.size()==0){
      //all default are false. No need to set to false explicitly.
      return;
    }
    for (ArrayList<Document> docs : matrixDocs){
      if(docs==null||docs.size()==0)
        continue;
      for (Document doc : docs){
        String dc = doc.get(InfoFields.countryCode);
        String ds = doc.get(InfoFields.adm1Code);