Ignore:
Timestamp:
2013-08-03T00:12:29+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8902 - Small performance enhancements / coding style (patch by shinigami):

  • while -> foreach
  • for -> for each

plus:

  • cleanup of FileDrop class to make it more integrated into JOSM core + remove warnings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r6087 r6104  
    296296                .getLocalGraphicsEnvironment();
    297297        GraphicsDevice[] gs = ge.getScreenDevices();
    298         for (int j = 0; j < gs.length; j++) {
    299             GraphicsDevice gd = gs[j];
     298        for (GraphicsDevice gd : gs) {
    300299            if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
    301300                virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
     
    346345        int intersect = 0;
    347346        Rectangle bounds = null;
    348         for (int j = 0; j < gs.length; j++) {
    349             GraphicsDevice gd = gs[j];
     347        for (GraphicsDevice gd : gs) {
    350348            if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
    351349                Rectangle b = gd.getDefaultConfiguration().getBounds();
    352                 if (b.height > 0 && b.width/b.height >= 3) /* multiscreen with wrong definition */
    353                 {
     350                if (b.height > 0 && b.width / b.height >= 3) /* multiscreen with wrong definition */ {
    354351                    b.width /= 2;
    355352                    Rectangle is = b.intersection(g);
    356                     int s = is.width*is.height;
    357                     if(bounds == null || intersect < s) {
     353                    int s = is.width * is.height;
     354                    if (bounds == null || intersect < s) {
    358355                        intersect = s;
    359356                        bounds = b;
     
    362359                    b.x += b.width;
    363360                    is = b.intersection(g);
    364                     s = is.width*is.height;
    365                     if(bounds == null || intersect < s) {
     361                    s = is.width * is.height;
     362                    if (bounds == null || intersect < s) {
    366363                        intersect = s;
    367364                        bounds = b;
    368365                    }
    369                 }
    370                 else
    371                 {
     366                } else {
    372367                    Rectangle is = b.intersection(g);
    373                     int s = is.width*is.height;
    374                     if(bounds == null || intersect < s) {
     368                    int s = is.width * is.height;
     369                    if (bounds == null || intersect < s) {
    375370                        intersect = s;
    376371                        bounds = b;
Note: See TracChangeset for help on using the changeset viewer.