Changeset 6228 in josm


Ignore:
Timestamp:
2013-09-11T00:14:06+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar - replace array copy loops by more efficient calls to System.arraycopy

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r6206 r6228  
    818818        final int m = Math.min(l, back.length);
    819819        trackVisibility = new boolean[l];
    820         for(int i=0; i < m; i++) {
    821             trackVisibility[i] = back[i];
    822         }
     820        System.arraycopy(back, 0, trackVisibility, 0, m);
    823821        for(int i=m; i < l; i++) {
    824822            trackVisibility[i] = true;
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java

    r6142 r6228  
    4747    JTable table;
    4848
     49    /**
     50     * Constructs a new {@code ChooseTrackVisibilityAction}.
     51     * @param layer The associated GPX layer
     52     */
    4953    public ChooseTrackVisibilityAction(final GpxLayer layer) {
    5054        super(tr("Choose visible tracks"), ImageProvider.get("dialogs/filter"));
     
    217221        // cancel for unknown buttons and copy back original settings
    218222        if (v != 1 && v != 2) {
    219             for (int i = 0; i < layer.trackVisibility.length; i++) {
    220                 layer.trackVisibility[i] = trackVisibilityBackup[i];
    221             }
     223            System.arraycopy(trackVisibilityBackup, 0, layer.trackVisibility, 0, layer.trackVisibility.length);
    222224            Main.map.repaint();
    223225            return;
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java

    r5548 r6228  
    2424    };
    2525
     26    /**
     27     * Constructs a new {@code PuwgProjectionChoice}.
     28     */
    2629    public PuwgProjectionChoice() {
    2730        super(tr("PUWG (Poland)"), "core:puwg", NAMES, tr("PUWG Zone"));
     
    4245    public String[] allCodes() {
    4346        String[] zones = new String[CODES.length];
    44         for (int idx = 0; idx < CODES.length; idx++) {
    45             zones[idx] = CODES[idx];
    46         }
     47        System.arraycopy(CODES, 0, zones, 0, CODES.length);
    4748        return zones;
    4849    }
Note: See TracChangeset for help on using the changeset viewer.