Changeset 6822 in josm


Ignore:
Timestamp:
2014-02-07T01:03:57+01:00 (6 years ago)
Author:
bastiK
Message:

see #8902 - Small performance enhancements / coding style (patch by shinigami, updated, modified)

stringbuilder.diff: StringBuffer => StringBuilder

Location:
trunk/src/org/openstreetmap/josm
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r6380 r6822  
    133133
    134134        protected void alertFilesNotMatchingWithImporter(Collection<File> files, FileImporter importer) {
    135             final StringBuffer msg = new StringBuffer();
     135            final StringBuilder msg = new StringBuilder();
    136136            msg.append("<html>");
    137137            msg.append(
     
    160160
    161161        protected void alertFilesWithUnknownImporter(Collection<File> files) {
    162             final StringBuffer msg = new StringBuffer();
     162            final StringBuilder msg = new StringBuilder();
    163163            msg.append("<html>");
    164164            msg.append(
  • trunk/src/org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java

    r3083 r6822  
    1919
    2020    protected String formatRelation(Relation r) {
    21         StringBuffer sb = new StringBuffer();
     21        StringBuilder sb = new StringBuilder();
    2222        if (r.getName() != null) {
    2323            sb.append("'").append(r.getName()).append("'");
     
    3232    @Override
    3333    public String getMessage() {
    34         StringBuffer sb = new StringBuffer();
     34        StringBuilder sb = new StringBuilder();
    3535        sb.append(tr("Cyclic dependency between relations:"));
    3636        sb.append("[");
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r6798 r6822  
    399399
    400400    public String encodeAsString(String separator) {
    401         StringBuffer sb = new StringBuffer();
     401        StringBuilder sb = new StringBuilder();
    402402        sb.append(minLat).append(separator).append(minLon)
    403403        .append(separator).append(maxLat).append(separator)
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r6643 r6822  
    3939        try {
    4040            BufferedReader in = Utils.openURLReader(resource);
    41             StringBuffer sb = new StringBuffer();
     41            StringBuilder sb = new StringBuilder();
    4242            try {
    4343                for (String line = in.readLine(); line != null; line = in.readLine()) {
     
    146146        // the revision info
    147147        //
    148         StringBuffer sb = new StringBuffer();
     148        StringBuilder sb = new StringBuilder();
    149149        for(Entry<String,String> property: properties.entrySet()) {
    150150            sb.append(property.getKey()).append(":").append(property.getValue()).append("\n");
  • trunk/src/org/openstreetmap/josm/data/imagery/Shape.java

    r6069 r6822  
    3636
    3737    public String encodeAsString(String separator) {
    38         StringBuffer sb = new StringBuffer();
     38        StringBuilder sb = new StringBuilder();
    3939        for (Coordinate c : coords) {
    4040            if (sb.length() != 0) {
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r6380 r6822  
    220220    @Override
    221221    public String toString() {
    222         StringBuffer s = new StringBuffer();
     222        StringBuilder s = new StringBuilder();
    223223        s.append("id:").append(uid);
    224224        if (names.size() == 1) {
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r6316 r6822  
    279279    @Override
    280280    public String toString() {
    281         StringBuffer buf = new StringBuffer("Headers  : ");
     281        StringBuilder buf = new StringBuilder("Headers  : ");
    282282        buf.append(overviewHeaderCount);
    283283        buf.append("\nSub Hdrs : ");
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java

    r6310 r6822  
    296296     */
    297297    public String getDetails() {
    298         StringBuffer buf = new StringBuffer("Sub Grid : ");
     298        StringBuilder buf = new StringBuilder("Sub Grid : ");
    299299        buf.append(subGridName);
    300300        buf.append("\nParent   : ");
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r6793 r6822  
    652652        @Override
    653653        public String toString() {
    654             StringBuffer sb = new StringBuffer();
     654            StringBuilder sb = new StringBuilder();
    655655            sb.append("min=").append(min.x).append(",").append(min.y).append(",");
    656656            sb.append("max=").append(max.x).append(",").append(max.y).append(",");
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r6524 r6822  
    356356            items.add(tr("{0} more...", deletedIds.size() - MAX_DELETED_PRIMITIVE_IN_DIALOG));
    357357        }
    358         StringBuffer sb = new StringBuffer();
     358        StringBuilder sb = new StringBuilder();
    359359        sb.append("<html>");
    360360        sb.append(tr("The following objects could not be copied to the target object<br>because they are deleted in the target dataset:"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r6555 r6822  
    486486        );
    487487
    488         final StringBuffer sb = new StringBuffer();
     488        final StringBuilder sb = new StringBuilder();
    489489        sb.append("<html>").append(msg1).append("</html>");
    490490        if (numNewConflicts > 0) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r6742 r6822  
    715715                }
    716716            }
    717             StringBuffer text = new StringBuffer();
     717            StringBuilder text = new StringBuilder();
    718718            if(ways != 0) {
    719719                text.append(text.length() > 0 ? ", " : "")
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java

    r6084 r6822  
    3232
    3333    protected void renderLabel(Changeset cs) {
    34         StringBuffer sb = new StringBuffer();
     34        StringBuilder sb = new StringBuilder();
    3535        if (cs.isIncomplete()) {
    3636            sb.append(tr("{0} [incomplete]", cs.getId()));
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r6552 r6822  
    277277        protected String buildToolTipText(Bookmark b) {
    278278            Bounds area = b.getArea();
    279             StringBuffer sb = new StringBuffer();
     279            StringBuilder sb = new StringBuilder();
    280280            sb.append("<html>min[latitude,longitude]=<strong>[")
    281281            .append(area.getMinLat()).append(",").append(area.getMinLon()).append("]</strong>")
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r6643 r6822  
    508508
    509509        protected String lineWrapDescription(String description) {
    510             StringBuffer ret = new StringBuffer();
    511             StringBuffer line = new StringBuffer();
     510            StringBuilder ret = new StringBuilder();
     511            StringBuilder line = new StringBuilder();
    512512            StringTokenizer tok = new StringTokenizer(description, " ");
    513513            while(tok.hasMoreElements()) {
     
    520520                    line.append(" ").append(t).append("<br>");
    521521                    ret.append(line);
    522                     line = new StringBuffer();
     522                    line = new StringBuilder();
    523523                }
    524524            }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r6800 r6822  
    140140                )
    141141        );
    142         StringBuffer css = new StringBuffer();
     142        StringBuilder css = new StringBuilder();
    143143        try {
    144144            String line = null;
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java

    r6084 r6822  
    5454        if (cs != null) {
    5555            setIcon(icon);
    56             StringBuffer sb = new StringBuffer();
     56            StringBuilder sb = new StringBuilder();
    5757            if (cs.get("comment") != null) {
    5858                sb.append(cs.getId()).append(" - ").append(cs.get("comment"));
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r6654 r6822  
    3232
    3333    protected String buildChangesetSummary() {
    34         StringBuffer msg = new StringBuffer();
     34        StringBuilder msg = new StringBuilder();
    3535        if (selectedChangeset == null || selectedChangeset.isNew()) {
    3636            msg.append(tr("Objects are uploaded to a <strong>new changeset</strong>."));
     
    141141
    142142    protected void updateSummary() {
    143         StringBuffer sb = new StringBuffer();
     143        StringBuilder sb = new StringBuilder();
    144144        sb.append("<html>");
    145145        sb.append(buildStrategySummary());
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6798 r6822  
    298298                TimeZone tz = TimeZone.getTimeZone(tzStr);
    299299
    300                 String tzDesc = new StringBuffer(tzStr).append(" (")
     300                String tzDesc = new StringBuilder(tzStr).append(" (")
    301301                .append(formatTimezone(tz.getRawOffset() / 3600000.0))
    302302                .append(')').toString();
     
    316316            }
    317317
    318             cbTimezones.setSelectedItem(new StringBuffer(defaultTz.getID()).append(" (")
     318            cbTimezones.setSelectedItem(new StringBuilder(defaultTz.getID()).append(" (")
    319319                    .append(formatTimezone(defaultTz.getRawOffset() / 3600000.0))
    320320                    .append(')').toString());
     
    12951295
    12961296    private String formatTimezone(double timezone) {
    1297         StringBuffer ret = new StringBuffer();
     1297        StringBuilder ret = new StringBuilder();
    12981298
    12991299        if (timezone < 0) {
     
    13211321
    13221322        char sgnTimezone = '+';
    1323         StringBuffer hTimezone = new StringBuffer();
    1324         StringBuffer mTimezone = new StringBuffer();
     1323        StringBuilder hTimezone = new StringBuilder();
     1324        StringBuilder mTimezone = new StringBuilder();
    13251325        int state = 1; // 1=start/sign, 2=hours, 3=minutes.
    13261326        for (int i = 0; i < timezone.length(); i++) {
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

    r6456 r6822  
    253253            }
    254254            setTitle("Geotagged Images" + (entry.getFile() != null ? " - " + entry.getFile().getName() : ""));
    255             StringBuffer osd = new StringBuffer(entry.getFile() != null ? entry.getFile().getName() : "");
     255            StringBuilder osd = new StringBuilder(entry.getFile() != null ? entry.getFile().getName() : "");
    256256            if (entry.getElevation() != null) {
    257257                osd.append(tr("\nAltitude: {0} m", entry.getElevation().longValue()));
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r6643 r6822  
    253253     */
    254254    public String getQueryString() {
    255         StringBuffer sb = new StringBuffer();
     255        StringBuilder sb = new StringBuilder();
    256256        if (uid != null) {
    257257            sb.append("user").append("=").append(uid);
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r6798 r6822  
    179179            rd = new BufferedReader(new InputStreamReader(source));
    180180
    181             StringBuffer sb = new StringBuffer(1024);
     181            StringBuilder sb = new StringBuilder(1024);
    182182            int loopstart_char = rd.read();
    183183            ps = new NMEAParserState();
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r6792 r6822  
    322322     */
    323323    public String getBaseUrl() {
    324         StringBuffer rv = new StringBuffer(serverUrl);
     324        StringBuilder rv = new StringBuilder(serverUrl);
    325325        if (version != null) {
    326326            rv.append("/");
     
    603603     */
    604604    private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor, boolean doAuthenticate, boolean fastFail) throws OsmTransferException {
    605         StringBuffer responseBody = new StringBuffer();
     605        StringBuilder responseBody = new StringBuilder();
    606606        int retries = fastFail ? 0 : getMaxRetries();
    607607
  • trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java

    r6361 r6822  
    135135        try {
    136136            progressMonitor.indeterminateSubTask(tr("Downloading from OSM Server..."));
    137             StringBuffer sb = new StringBuffer();
     137            StringBuilder sb = new StringBuilder();
    138138            sb.append(primitiveType.getAPIName())
    139139            .append("/").append(id).append("/ways");
     
    169169        try {
    170170            progressMonitor.subTask(tr("Contacting OSM Server..."));
    171             StringBuffer sb = new StringBuffer();
     171            StringBuilder sb = new StringBuilder();
    172172            sb.append(primitiveType.getAPIName())
    173173            .append("/").append(id).append("/relations");
  • trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java

    r6792 r6822  
    5757        try {
    5858            monitor.beginTask(tr("Reading changesets..."));
    59             StringBuffer sb = new StringBuffer();
     59            StringBuilder sb = new StringBuilder();
    6060            sb.append("changesets?").append(query.getQueryString());
    6161            InputStream in = getInputStream(sb.toString(), monitor.createSubTaskMonitor(1, true));
     
    9090        try {
    9191            monitor.beginTask(tr("Reading changeset {0} ...",id));
    92             StringBuffer sb = new StringBuffer();
     92            StringBuilder sb = new StringBuilder();
    9393            sb.append("changeset/").append(id);
    9494            InputStream in = getInputStream(sb.toString(), monitor.createSubTaskMonitor(1, true));
     
    134134                }
    135135                i++;
    136                 StringBuffer sb = new StringBuffer();
     136                StringBuilder sb = new StringBuilder();
    137137                sb.append("changeset/").append(id);
    138138                InputStream in = getInputStream(sb.toString(), monitor.createSubTaskMonitor(1, true));
     
    174174        try {
    175175            monitor.beginTask(tr("Downloading changeset content"));
    176             StringBuffer sb = new StringBuffer();
     176            StringBuilder sb = new StringBuilder();
    177177            sb.append("changeset/").append(id).append("/download");
    178178            InputStream in = getInputStream(sb.toString(), monitor.createSubTaskMonitor(1, true));
  • trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java

    r6792 r6822  
    6060        try {
    6161            progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));
    62             StringBuffer sb = new StringBuffer();
     62            StringBuilder sb = new StringBuilder();
    6363            sb.append(primitiveType.getAPIName())
    6464            .append("/").append(id).append("/history");
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r6792 r6822  
    119119        try {
    120120            progressMonitor.indeterminateSubTask(tr("Downloading OSM data..."));
    121             StringBuffer sb = new StringBuffer();
     121            StringBuilder sb = new StringBuilder();
    122122            sb.append(id.getType().getAPIName());
    123123            sb.append("/");
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r6797 r6822  
    761761
    762762    private static void alertFailedPluginUpdate(Component parent, Collection<PluginInformation> plugins) {
    763         StringBuffer sb = new StringBuffer();
     763        StringBuilder sb = new StringBuilder();
    764764        sb.append("<html>");
    765765        sb.append(trn(
     
    11391139        };
    11401140
    1141         final StringBuffer msg = new StringBuffer();
     1141        final StringBuilder msg = new StringBuilder();
    11421142        msg.append("<html>");
    11431143        msg.append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.getPluginInformation().name));
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r6541 r6822  
    248248     */
    249249    public void remember(String preferenceKey) {
    250         StringBuffer value = new StringBuffer();
     250        StringBuilder value = new StringBuilder();
    251251        value.append("x=").append(topLeft.x).append(",")
    252252        .append("y=").append(topLeft.y).append(",")
Note: See TracChangeset for help on using the changeset viewer.