Changeset 6083 in josm


Ignore:
Timestamp:
2013-07-26T10:36:15+02:00 (11 years ago)
Author:
bastiK
Message:

see #8902 - Small performance enhancements (patch by shinigami)

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

Legend:

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

    r5905 r6083  
    244244                }
    245245            });
    246             JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[0]));
     246            JList list = new JList(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()]));
    247247            /* force selection to be active for all entries */
    248248            list.setCellRenderer(new OsmPrimitivRenderer() {
  • trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java

    r5886 r6083  
    7878            if (filerename.isSelected()) {
    7979                String newname = nameText;
    80                 if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1) {
     80                if (newname.indexOf('/') == -1 && newname.indexOf('\\') == -1) {
    8181                    newname = file.getParent() + File.separator + newname;
    8282                }
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r6069 r6083  
    102102                public void run() {
    103103                    try {
    104                         Runtime.getRuntime().exec(cmd.toArray(new String[]{}));
     104                        Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
    105105                    } catch (IOException e) {
    106106                        e.printStackTrace();
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r6069 r6083  
    245245                        } else if (key.equals("K:")) {
    246246                            IgnoreKeyPair tmp = new IgnoreKeyPair();
    247                             int mid = line.indexOf("=");
     247                            int mid = line.indexOf('=');
    248248                            tmp.key = line.substring(0, mid);
    249249                            tmp.value = line.substring(mid+1);
     
    402402                withErrors.put(p, "IPK");
    403403            }
    404             if (checkKeys && key.indexOf(" ") >= 0 && !withErrors.contains(p, "IPK")) {
     404            if (checkKeys && key.indexOf(' ') >= 0 && !withErrors.contains(p, "IPK")) {
    405405                errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"),
    406406                        tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6070 r6083  
    181181        }
    182182
    183         Getopt g = new Getopt("JOSM", args, "hv", los.toArray(new LongOpt[0]));
     183        Getopt g = new Getopt("JOSM", args, "hv", los.toArray(new LongOpt[los.size()]));
    184184
    185185        Map<Option, Collection<String>> argMap = new HashMap<Option, Collection<String>>();
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r6070 r6083  
    524524                SeparatorLayerAction.INSTANCE,
    525525                new LayerListPopup.InfoAction(this)}));
    526         return actions.toArray(new Action[0]);
     526        return actions.toArray(new Action[actions.size()]);
    527527    }
    528528
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r5901 r6083  
    301301        entries.add(new LayerListPopup.InfoAction(this));
    302302
    303         return entries.toArray(new Action[0]);
     303        return entries.toArray(new Action[entries.size()]);
    304304
    305305    }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r6070 r6083  
    530530                Color bkground = new Color(255, 255, 255, 128);
    531531                int lastPos = 0;
    532                 int pos = osdText.indexOf("\n");
     532                int pos = osdText.indexOf('\n');
    533533                int x = 3;
    534534                int y = 3;
     
    543543                    y += (int) lineSize.getHeight();
    544544                    lastPos = pos + 1;
    545                     pos = osdText.indexOf("\n", lastPos);
     545                    pos = osdText.indexOf('\n', lastPos);
    546546                }
    547547
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r6070 r6083  
    249249                wayPointFromTimeStamp.time = startTime;
    250250                String name = wavFile.getName();
    251                 int dot = name.lastIndexOf(".");
     251                int dot = name.lastIndexOf('.');
    252252                if (dot > 0) {
    253253                    name = name.substring(0, dot);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r5762 r6083  
    252252        components.add(SeparatorLayerAction.INSTANCE);
    253253        components.add(new LayerListPopup.InfoAction(this));
    254         return components.toArray(new Action[0]);
     254        return components.toArray(new Action[components.size()]);
    255255    }
    256256
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r6070 r6083  
    165165        {
    166166            String[] a;
    167             if(fileset.indexOf("=") >= 0) {
     167            if(fileset.indexOf('=') >= 0) {
    168168                a = fileset.split("=", 2);
    169169            } else {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java

    r3894 r6083  
    5252    Color convertColor(String colString)
    5353    {
    54         int i = colString.indexOf("#");
     54        int i = colString.indexOf('#');
    5555        Color ret;
    5656        if (i < 0) {
  • trunk/src/org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java

    r5587 r6083  
    9292        // remove trailing slashes
    9393        while(url.endsWith("/")) {
    94             url = url.substring(0, url.lastIndexOf("/"));
     94            url = url.substring(0, url.lastIndexOf('/'));
    9595        }
    9696        return url;
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r6070 r6083  
    349349                for (File f: new File(".").listFiles()) {
    350350                   String s = f.getName();
    351                    int idx = s.indexOf("_");
     351                   int idx = s.indexOf('_');
    352352                   if (idx>=0) {
    353353                        String t=s.substring(0,idx);
     
    359359                for (File f: Main.pref.getPreferencesDirFile().listFiles()) {
    360360                   String s = f.getName();
    361                    int idx = s.indexOf("_");
     361                   int idx = s.indexOf('_');
    362362                   if (idx>=0) {
    363363                        String t=s.substring(0,idx);
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java

    r6070 r6083  
    110110            }
    111111        }
    112         return projections.toArray(new String[0]);
     112        return projections.toArray(new String[projections.size()]);
    113113    }
    114114
     
    134134
    135135        if(args != null) {
    136             String[] array = args.toArray(new String[0]);
     136            String[] array = args.toArray(new String[args.size()]);
    137137
    138138            if (array.length > 1) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

    r5926 r6083  
    157157        String apiUrl = url.trim();
    158158        while(apiUrl.endsWith("/")) {
    159             apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf("/"));
     159            apiUrl = apiUrl.substring(0, apiUrl.lastIndexOf('/'));
    160160        }
    161161        return apiUrl;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r6070 r6083  
    11201120        for (PluginProxy p : pluginList) {
    11211121            String baseClass = p.getPluginInformation().className;
    1122             baseClass = baseClass.substring(0, baseClass.lastIndexOf("."));
     1122            baseClass = baseClass.substring(0, baseClass.lastIndexOf('.'));
    11231123            for (int elpos = 0; elpos < pos; ++elpos) {
    11241124                if (stack[elpos].getClassName().startsWith(baseClass)) {
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r6070 r6083  
    230230                        {
    231231                            String v = (String)entry.getValue();
    232                             int i = v.indexOf(";");
     232                            int i = v.indexOf(';');
    233233                            if(i > 0)
    234234                            {
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r6070 r6083  
    122122                            {
    123123                                urltext = urltext.substring(0,maxlen);
    124                                 int idx = urltext.lastIndexOf("\n");
     124                                int idx = urltext.lastIndexOf('\n');
    125125                                /* cut whole line when not loosing too much */
    126126                                if(maxlen-idx < 200) {
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r5874 r6083  
    255255    {
    256256        int i;
    257         if(ctx == null && text.startsWith("_:") && (i = text.indexOf("\n")) >= 0)
     257        if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0)
    258258        {
    259259            ctx = text.substring(2,i-1);
     
    287287    {
    288288        int i;
    289         if(ctx == null && text.startsWith("_:") && (i = text.indexOf("\n")) >= 0)
     289        if(ctx == null && text.startsWith("_:") && (i = text.indexOf('\n')) >= 0)
    290290        {
    291291            ctx = text.substring(2,i-1);
Note: See TracChangeset for help on using the changeset viewer.