private static Set<String> getNodeNames(Long id) {
    Set<String> names = new HashSet<String>();

    CityToken parent = addMyName(id, names);

    addChildrenNames(id, names);

    while (parent != null) {
      parent = addMyName(parent.getId(), names);
    }
    return names;
  }
 /** 把id对应节点的所有子节点的名字(递归到所有下级子节点)加入到names中 */
 private static void addChildrenNames(Long id, Set<String> names) {
   List<CityToken> ctList;
   Set<Long> addeds = new HashSet<Long>(); // 已处理的id集合
   Deque<Long> pids = new ArrayDeque<Long>(); // 未处理的id栈
   pids.push(id);
   while (!pids.isEmpty()) {
     Long pid = pids.pop();
     if (addeds.add(pid)) {
       ctList = DataCache.pIdMap.get(pid);
       if (ctList != null) {
         for (int i = 0, n = ctList.size(); i < n; ++i) {
           CityToken ct = ctList.get(i);
           names.add(ct.getName());
           pids.push(ct.getId());
         }
       }
     }
   }
 }
 public String getDetailAddress() {
   if (detailAddress == null) {
     synchronized (originalAddress) {
       if (detailAddress == null) {
         if (townAddressReal != null) {
           detailAddress = subOrigAddr(townAddressReal, townAddress.getName(), true);
         } else if (areaAddressReal != null) {
           detailAddress = subOrigAddr(areaAddressReal, areaAddress.getName(), true);
         } else if (cityAddressReal != null) {
           detailAddress = subOrigAddr(cityAddressReal, cityAddress.getName(), false);
         } else if (provinceAddressReal != null) {
           detailAddress = subOrigAddr(provinceAddressReal, provinceAddress.getName(), false);
         } else {
           detailAddress = originalAddress;
         }
       }
     }
   }
   return detailAddress;
 }
 public synchronized DFA get() {
   if (dfa123 == this) {
     Set<String> nameSet = new HashSet<String>();
     for (Map.Entry<Long, List<CityToken>> e : DataCache.pIdMap.entrySet()) {
       for (CityToken ct : e.getValue()) {
         if (ct.getLevel() <= 3) {
           nameSet.add(ct.getName());
         } else {
           break;
         }
       }
     }
     final DFA dfa = DFA.create(NodeCreater.create(nameSet));
     dfa123 =
         new DFASupplier() {
           public DFA get() {
             return dfa;
           }
         };
     return dfa;
   }
   return dfa123.get();
 }
 /**
  * @param addr 此参数要为标准地址
  * @param realName
  */
 public void setAddr(CityToken addr, String realName) {
   switch (addr.getLevel()) {
     case 1:
       provinceAddress = addr;
       provinceAddressReal = realName;
       break;
     case 2:
       cityAddress = addr;
       cityAddressReal = realName;
       break;
     case 3:
       areaAddress = addr;
       areaAddressReal = realName;
       break;
     case 4:
       townAddress = addr;
       townAddressReal = realName;
       break;
     default:
   }
 }
 public String getTownAddress() {
   if (townAddress == null) return null;
   return townAddress.getName();
 }
 public String getAreaAddress() {
   if (areaAddress == null) return null;
   return areaAddress.getName();
 }
 public String getCityAddress() {
   if (cityAddress == null) return null;
   return cityAddress.getName();
 }
 public String getProvinceAddress() {
   if (provinceAddress == null) return null;
   return provinceAddress.getName();
 }