Ignore:
Timestamp:
26.01.2012 21:52:34 (4 months ago)
Author:
jttt
Message:

Use static class were appropriate

Location:
trunk/src/org/openstreetmap/josm/data
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r4534 r4874  
    7373        OsmPrimitiveComparator c = new OsmPrimitiveComparator(); 
    7474        c.relationsFirst = true; 
    75         Collections.sort(toDelete, c);  
    76         Collections.sort(toAdd, c);  
    77         Collections.sort(toUpdate, c);  
     75        Collections.sort(toDelete, c); 
     76        Collections.sort(toAdd, c); 
     77        Collections.sort(toUpdate, c); 
    7878    } 
    7979 
     
    154154        OsmPrimitiveComparator c = new OsmPrimitiveComparator(); 
    155155        c.relationsFirst = true; 
    156         Collections.sort(toDelete, c);  
    157         Collections.sort(toAdd, c);  
    158         Collections.sort(toUpdate, c);  
     156        Collections.sort(toDelete, c); 
     157        Collections.sort(toAdd, c); 
     158        Collections.sort(toUpdate, c); 
    159159    } 
    160160 
     
    278278     * 
    279279     */ 
    280     private class RelationUploadDependencyGraph { 
     280    private static class RelationUploadDependencyGraph { 
    281281        private HashMap<Relation, Set<Relation>> children; 
    282282        private Collection<Relation> relations; 
     
    353353                        } 
    354354                    } 
    355             ); 
     355                    ); 
    356356            return ret; 
    357357        } 
  • trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java

    r4612 r4874  
    1515import java.net.URL; 
    1616import java.net.URLConnection; 
    17 import java.util.Collection; 
    18 import java.util.Collections; 
    19 import java.util.LinkedList; 
    20 import java.util.StringTokenizer; 
    21 import java.util.Map.Entry; 
    2217 
    2318import javax.swing.JOptionPane; 
     
    2621import org.openstreetmap.josm.Main; 
    2722import org.openstreetmap.josm.io.OsmConnection; 
    28 import org.openstreetmap.josm.io.OsmTransferException; 
    2923import org.openstreetmap.josm.tools.Base64; 
    3024 
     
    3630 */ 
    3731public class ServerSidePreferences extends Preferences { 
    38     public class MissingPassword extends Exception{ 
     32    public static class MissingPassword extends Exception{ 
    3933        public String realm; 
    4034        public MissingPassword(String r) { 
     
    5650                String username = get("applet.username"); 
    5751                String password = get("applet.password"); 
    58                 if(password.isEmpty() && username.isEmpty()) 
     52                if(password.isEmpty() && username.isEmpty()) { 
    5953                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password)); 
     54                } 
    6055                con.connect(); 
    6156                if(username.isEmpty() && con instanceof HttpURLConnection 
    62                     && ((HttpURLConnection) con).getResponseCode() 
    63                     == HttpURLConnection.HTTP_UNAUTHORIZED) { 
     57                        && ((HttpURLConnection) con).getResponseCode() 
     58                        == HttpURLConnection.HTTP_UNAUTHORIZED) { 
    6459                    String t = ((HttpURLConnection) con).getHeaderField("WWW-Authenticate"); 
    6560                    t = t.replace("Basic realm=\"","").replace("\"",""); 
     
    8883                String username = get("applet.username"); 
    8984                String password = get("applet.password"); 
    90                 if(password.isEmpty() && username.isEmpty()) 
     85                if(password.isEmpty() && username.isEmpty()) { 
    9186                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password)); 
     87                } 
    9288                con.setRequestMethod("POST"); 
    9389                con.setDoOutput(true); 
     
    10399                        tr("Information"), 
    104100                        JOptionPane.INFORMATION_MESSAGE 
    105                 ); 
     101                        ); 
    106102            } catch (Exception e) { 
    107103                e.printStackTrace(); 
     
    111107                        tr("Error"), 
    112108                        JOptionPane.ERROR_MESSAGE 
    113                 ); 
     109                        ); 
    114110            } 
    115111        } 
     
    127123                    tr("Error"), 
    128124                    JOptionPane.ERROR_MESSAGE 
    129             ); 
     125                    ); 
    130126        } 
    131127        this.connection = connection; 
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DeprecatedTags.java

    r4806 r4874  
    11package org.openstreetmap.josm.data.validation.tests; 
    22 
    3 import org.openstreetmap.josm.data.osm.Node; 
    4 import org.openstreetmap.josm.data.osm.Relation; 
    5 import org.openstreetmap.josm.data.osm.Way; 
    63import static org.openstreetmap.josm.tools.I18n.tr; 
    74 
     
    96import java.util.LinkedList; 
    107import java.util.List; 
     8 
    119import org.openstreetmap.josm.command.ChangePropertyCommand; 
    1210import org.openstreetmap.josm.command.Command; 
    1311import org.openstreetmap.josm.command.SequenceCommand; 
     12import org.openstreetmap.josm.data.osm.Node; 
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive; 
     14import org.openstreetmap.josm.data.osm.Relation; 
    1515import org.openstreetmap.josm.data.osm.Tag; 
     16import org.openstreetmap.josm.data.osm.Way; 
    1617import org.openstreetmap.josm.data.validation.Severity; 
    1718import org.openstreetmap.josm.data.validation.Test; 
     
    9798    } 
    9899 
    99     private class DeprecationCheck { 
     100    private static class DeprecationCheck { 
    100101 
    101102        int code; 
     
    148149                String key = tag.getKey(); 
    149150                String value = tag.getValue(); 
    150                 if (value.isEmpty() && !p.hasKey(key)) { 
     151                if (value.isEmpty() && !p.hasKey(key)) 
    151152                    return false; 
    152                 } 
    153                 if (!value.isEmpty() && !value.equals(p.get(key))) { 
     153                if (!value.isEmpty() && !value.equals(p.get(key))) 
    154154                    return false; 
    155                 } 
    156155            } 
    157156            return true; 
     
    167166 
    168167        String getDescription() { 
    169             if (alternatives.isEmpty()) { 
     168            if (alternatives.isEmpty()) 
    170169                return tr("{0} is deprecated", Utils.join(", ", test)); 
    171             } else { 
     170            else 
    172171                return tr("{0} is deprecated, use {1} instead", Utils.join(", ", test), Utils.join(tr(" or "), alternatives)); 
    173             } 
    174172        } 
    175173    } 
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r4869 r4874  
    3939public class DuplicateNode extends Test { 
    4040 
    41     private class NodeHash implements Hash<Object, Object> { 
     41    private static class NodeHash implements Hash<Object, Object> { 
    4242 
    4343        double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.); 
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r4869 r4874  
    3434{ 
    3535 
    36     public class RelMember { 
     36    public static class RelMember { 
    3737        private String role; 
    3838        private OsmPrimitiveType type; 
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java

    r4869 r4874  
    3434{ 
    3535 
    36     private class WayPair { 
     36    private static class WayPair { 
    3737        public List<LatLon> coor; 
    3838        public Map<String, String> keys; 
     
    5656    } 
    5757 
    58     private class WayPairNoTags { 
     58    private static class WayPairNoTags { 
    5959        public List<LatLon> coor; 
    6060        public WayPairNoTags(List<LatLon> _coor) { 
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r4869 r4874  
    7070    } 
    7171 
    72     public class RoleInfo { 
     72    public static class RoleInfo { 
    7373        int total = 0; 
    7474        Collection<Node> nodes = new LinkedList<Node>(); 
Note: See TracChangeset for help on using the changeset viewer.