Replace StringBuffer with String

These may be replaced with java.lang.String expressions which results in
simpler and possibly more efficient code
This commit is contained in:
Nelson A. de Oliveira 2013-07-31 15:09:37 -03:00
parent a0de8b31b3
commit 61699455e5
2 changed files with 3 additions and 13 deletions

View file

@ -213,15 +213,9 @@ public class RouteResultPreparation {
double startLon = start.getLongitude();
double endLat = end.getLatitude();
double endLon = end.getLongitude();
StringBuilder add = new StringBuilder();
add.append("loadedTiles = \"").append(ctx.loadedTiles).append("\" ");
add.append("visitedSegments = \"").append(ctx.visitedSegments).append("\" ");
add.append("complete_distance = \"").append(completeDistance).append("\" ");
add.append("complete_time = \"").append(completeTime).append("\" ");
add.append("routing_time = \"").append(ctx.routingTime).append("\" ");
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >", startLat
+ "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, add.toString()));
+ "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + "complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + "routing_time = \"" + ctx.routingTime + "\" "));
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
for (RouteSegmentResult res : result) {
String name = res.getObject().getName();

View file

@ -270,11 +270,7 @@ public class MapUtils {
// System.out.println(buildShortOsmUrl(52.30103d, 4.862927d, 18)); // http://osm.org/go/0E4_JiVhs
// System.out.println(buildShortOsmUrl(40.59d, -115.213d, 9)); // http://osm.org/go/TelHTB--
public static String buildShortOsmUrl(double latitude, double longitude, int zoom){
StringBuilder str = new StringBuilder(10);
str.append(BASE_SHORT_OSM_URL);
str.append(createShortLocString(latitude, longitude, zoom));
str.append("?m");
return str.toString();
return BASE_SHORT_OSM_URL + createShortLocString(latitude, longitude, zoom) + "?m";
}
public static String createShortLocString(double latitude, double longitude, int zoom) {