예제 #1
0
 private String getLocationKey(Location location) {
   StringBuilder result = new StringBuilder();
   if (location.getCityType() == Location.US_CITY_TYPE) { // in US
     result.append("Z");
     result.append(location.getZipCode());
   } else {
     result.append("C");
     result.append(location.getCityCode());
   }
   return result.toString();
 }
예제 #2
0
 private String getLocationDescription(Location location) {
   StringBuilder result = new StringBuilder();
   result.append(location.getCityName());
   result.append(", ");
   if (location.getCityType() == Location.US_CITY_TYPE) { // in US
     result.append(location.getStateName());
     result.append(" (");
     result.append(location.getZipCode());
     result.append(")");
   } else {
     result.append(location.getCountryName());
   }
   return result.toString();
 }
예제 #3
0
 private String getStationDescription(Station station) {
   StringBuilder result = new StringBuilder();
   result.append(station.getName());
   BigDecimal distance = station.getDistance();
   String distanceUnits = station.getUnit();
   if (distance != null && distanceUnits != null) {
     result.append(" (");
     result.append(distance.toPlainString());
     result.append(" ");
     result.append(distanceUnits);
     result.append(")");
   }
   return result.toString();
 }