コード例 #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();
 }