Exemplo n.º 1
0
 public String getNameByLoc(Location loc) {
   if (loc == null) return null;
   Set<Entry<String, ClaimedResidence>> set = residences.entrySet();
   ClaimedResidence res = null;
   String name = null;
   synchronized (residences) {
     for (Entry<String, ClaimedResidence> key : set) {
       res = key.getValue();
       if (res.containsLoc(loc)) {
         name = key.getKey();
         break;
       }
     }
   }
   if (name == null) return null;
   String szname = res.getSubzoneNameByLoc(loc);
   if (szname != null) {
     return name + "." + szname;
   }
   return name;
 }
Exemplo n.º 2
0
 public ClaimedResidence getByLoc(Location loc) {
   if (loc == null) return null;
   ClaimedResidence res = null;
   boolean found = false;
   Set<Entry<String, ClaimedResidence>> set = residences.entrySet();
   synchronized (residences) {
     for (Entry<String, ClaimedResidence> key : set) {
       res = key.getValue();
       if (res.containsLoc(loc)) {
         found = true;
         break;
       }
     }
   }
   if (!found) {
     return null;
   }
   ClaimedResidence subres = res.getSubzoneByLoc(loc);
   if (subres == null) {
     return res;
   }
   return subres;
 }