Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (10 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

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

Legend:

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

    r8365 r8510  
    217217     * @throws CyclicUploadDependencyException if a cyclic dependency is detected
    218218     */
    219     public void adjustRelationUploadOrder() throws CyclicUploadDependencyException{
     219    public void adjustRelationUploadOrder() throws CyclicUploadDependencyException {
    220220        List<OsmPrimitive> newToAdd = new LinkedList<>();
    221221        newToAdd.addAll(Utils.filteredCollection(toAdd, Node.class));
     
    283283        public final void build(Collection<Relation> relations) {
    284284            this.relations = new HashSet<>();
    285             for(Relation relation: relations) {
     285            for (Relation relation: relations) {
    286286                if (newOrUndeleted ? !relation.isNewOrUndeleted() : !relation.isDeleted()) {
    287287                    continue;
     
    290290                for (RelationMember m: relation.getMembers()) {
    291291                    if (m.isRelation() && (newOrUndeleted ? m.getMember().isNewOrUndeleted() : m.getMember().isDeleted())) {
    292                         addDependency(relation, (Relation)m.getMember());
     292                        addDependency(relation, (Relation) m.getMember());
    293293                    }
    294294                }
     
    309309        }
    310310
    311         protected void visit(Stack<Relation> path, Relation current) throws CyclicUploadDependencyException{
     311        protected void visit(Stack<Relation> path, Relation current) throws CyclicUploadDependencyException {
    312312            if (path.contains(current)) {
    313313                path.push(current);
     
    318318                visited.add(current);
    319319                for (Relation dependent : getChildren(current)) {
    320                     visit(path,dependent);
     320                    visit(path, dependent);
    321321                }
    322322                uploadOrder.add(current);
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r8509 r8510  
    179179                    MessageFormat.format("Exactly four doubles expected in string, got {0}: {1}", components.length, asString));
    180180        double[] values = new double[4];
    181         for (int i=0; i<4; i++) {
     181        for (int i = 0; i < 4; i++) {
    182182            try {
    183183                values[i] = Double.parseDouble(components[i]);
    184             } catch(NumberFormatException e) {
     184            } catch (NumberFormatException e) {
    185185                throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", components[i]), e);
    186186            }
     
    281281            double lat = (minLat + maxLat) / 2;
    282282            double lon = (minLon + maxLon - 360.0) / 2;
    283             if (lon < -180.0){
     283            if (lon < -180.0) {
    284284                lon += 360.0;
    285285            }
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r8509 r8510  
    9393     */
    9494    public static void readXML(final File file, final Preferences prefs) {
    95         synchronized(CustomConfigurator.class) {
    96             busy=true;
     95        synchronized (CustomConfigurator.class) {
     96            busy = true;
    9797        }
    9898        new XMLCommandProcessor(prefs).openAndReadXML(file);
    99         synchronized(CustomConfigurator.class) {
     99        synchronized (CustomConfigurator.class) {
    100100            CustomConfigurator.class.notifyAll();
    101             busy=false;
     101            busy = false;
    102102        }
    103103    }
     
    159159     */
    160160    public static void messageBox(String type, String text) {
    161         if (type==null || type.isEmpty()) type="plain";
     161        if (type == null || type.isEmpty()) type = "plain";
    162162
    163163        switch (type.charAt(0)) {
     
    186186                    JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, 2);
    187187        }
    188         if (answer==null) return -1; else return answer;
     188        if (answer == null) return -1; else return answer;
    189189    }
    190190
    191191    public static String askForText(String text) {
    192192        String s = JOptionPane.showInputDialog(Main.parent, text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE);
    193         if (s!=null && !(s=s.trim()).isEmpty()) {
     193        if (s != null && !(s = s.trim()).isEmpty()) {
    194194            return s;
    195195        } else {
     
    253253            Main.warn("Error getting preferences to save:" +ex.getMessage());
    254254        }
    255         if (root==null) return;
     255        if (root == null) return;
    256256        try {
    257257
     
    260260
    261261            Element prefElem = exportDocument.createElement("preferences");
    262             prefElem.setAttribute("operation", append?"append":"replace");
     262            prefElem.setAttribute("operation", append ? "append" : "replace");
    263263            newRoot.appendChild(prefElem);
    264264
     
    287287    public static void deleteFile(String path, String base) {
    288288        String dir = getDirectoryByAbbr(base);
    289         if (dir==null) {
     289        if (dir == null) {
    290290            log("Error: Can not find base, use base=cache, base=prefs or base=plugins attribute.");
    291291            return;
     
    321321    }
    322322
    323     private static boolean busy=false;
     323    private static boolean busy = false;
    324324
    325325    public static void pluginOperation(String install, String uninstall, String delete)  {
     
    387387                                new File(Main.pref.getPluginsDirectory(), pi.name+".jar").deleteOnExit();
    388388                            }
    389                             Main.pref.putCollection("plugins",pls);
     389                            Main.pref.putCollection("plugins", pls);
    390390                        }
    391391                    });
     
    423423
    424424        private Preferences mainPrefs;
    425         private Map<String,Element> tasksMap = new HashMap<>();
     425        private Map<String, Element> tasksMap = new HashMap<>();
    426426
    427427        private boolean lastV; // last If condition result
     
    433433            try {
    434434                String fileDir = file.getParentFile().getAbsolutePath();
    435                 if (fileDir!=null) engine.eval("scriptDir='"+normalizeDirName(fileDir) +"';");
     435                if (fileDir != null) engine.eval("scriptDir='"+normalizeDirName(fileDir) +"';");
    436436                try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
    437437                    openAndReadXML(is);
     
    599599            String base = evalVars(item.getAttribute("base"));
    600600            String dir = getDirectoryByAbbr(base);
    601             if (dir==null) {
     601            if (dir == null) {
    602602                log("Error: Can not find directory to place file, use base=cache, base=prefs or base=plugins attribute.");
    603603                return;
     
    624624            String text = evalVars(elem.getAttribute("text"));
    625625            String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text"));
    626             if (locText!=null && !locText.isEmpty()) text=locText;
     626            if (locText != null && !locText.isEmpty()) text = locText;
    627627
    628628            String type = evalVars(elem.getAttribute("type"));
     
    633633            String text = evalVars(elem.getAttribute("text"));
    634634            String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text"));
    635             if (!locText.isEmpty()) text=locText;
     635            if (!locText.isEmpty()) text = locText;
    636636            String var = elem.getAttribute("var");
    637             if (var.isEmpty()) var="result";
     637            if (var.isEmpty()) var = "result";
    638638
    639639            String input = evalVars(elem.getAttribute("input"));
     
    643643                String opts = evalVars(elem.getAttribute("options"));
    644644                String locOpts = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".options"));
    645                 if (!locOpts.isEmpty()) opts=locOpts;
     645                if (!locOpts.isEmpty()) opts = locOpts;
    646646                setVar(var, String.valueOf(askForOption(text, opts)));
    647647            }
     
    678678            String taskName = elem.getAttribute("name");
    679679            Element task = tasksMap.get(taskName);
    680             if (task!=null) {
     680            if (task != null) {
    681681                log("EXECUTING TASK "+taskName);
    682682                processXmlFragment(task); // process task recursively
     
    728728                xformer.transform(new DOMSource(item), out);
    729729
    730                 String fragmentWithReplacedVars= evalVars(outputWriter.toString());
     730                String fragmentWithReplacedVars = evalVars(outputWriter.toString());
    731731
    732732                CharArrayReader reader = new CharArrayReader(fragmentWithReplacedVars.toCharArray());
     
    741741        private String normalizeDirName(String dir) {
    742742            String s = dir.replace("\\", "/");
    743             if (s.endsWith("/")) s=s.substring(0,s.length()-1);
     743            if (s.endsWith("/")) s = s.substring(0, s.length()-1);
    744744            return s;
    745745        }
     
    938938        JOptionPane.showMessageDialog(
    939939                Main.parent,
    940                 tr("<html>Settings file asks to append preferences to <b>{0}</b>,<br/> but its default value is unknown at this moment.<br/> Please activate corresponding function manually and retry importing.", key),
     940                tr("<html>Settings file asks to append preferences to <b>{0}</b>,<br/> "+
     941                        "but its default value is unknown at this moment.<br/> " +
     942                        "Please activate corresponding function manually and retry importing.", key),
    941943                tr("Warning"),
    942944                JOptionPane.WARNING_MESSAGE);
     
    10111013        Map<String, List<Collection<String>>> listlistMap = (SortedMap<String, List<Collection<String>>>) engine.get("listlistMap");
    10121014        @SuppressWarnings("unchecked")
    1013         Map<String, List<Map<String, String>>> listmapMap = (SortedMap<String, List<Map<String,String>>>) engine.get("listmapMap");
     1015        Map<String, List<Map<String, String>>> listmapMap = (SortedMap<String, List<Map<String, String>>>) engine.get("listmapMap");
    10141016
    10151017        tmpPref.settingsMap.clear();
     
    10251027        for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
    10261028            @SuppressWarnings("unchecked")
    1027             List<List<String>> value = (List)e.getValue();
     1029            List<List<String>> value = (List) e.getValue();
    10281030            tmp.put(e.getKey(), new ListListSetting(value));
    10291031        }
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r8509 r8510  
    194194            this.value = value;
    195195        }
     196
    196197        @Override
    197198        public T getValue() {
    198199            return value;
    199200        }
     201
    200202        @Override
    201203        public String toString() {
    202204            return value != null ? value.toString() : "null";
    203205        }
     206
    204207        @Override
    205208        public int hashCode() {
     
    209212            return result;
    210213        }
     214
    211215        @Override
    212216        public boolean equals(Object obj) {
     
    238242            super(value);
    239243        }
    240         @Override public boolean equalVal(String otherVal) {
     244
     245        @Override
     246        public boolean equalVal(String otherVal) {
    241247            if (value == null) return otherVal == null;
    242248            return value.equals(otherVal);
    243249        }
    244         @Override public StringSetting copy() {
     250
     251        @Override
     252        public StringSetting copy() {
    245253            return new StringSetting(value);
    246254        }
    247         @Override public void visit(SettingVisitor visitor) {
     255
     256        @Override
     257        public void visit(SettingVisitor visitor) {
    248258            visitor.visit(this);
    249259        }
    250         @Override public StringSetting getNullInstance() {
     260
     261        @Override
     262        public StringSetting getNullInstance() {
    251263            return new StringSetting(null);
    252264        }
     265
    253266        @Override
    254267        public boolean equals(Object other) {
     
    270283            consistencyTest();
    271284        }
     285
    272286        /**
    273287         * Convenience factory method.
     
    278292            return new ListSetting(value == null ? null : Collections.unmodifiableList(new ArrayList<>(value)));
    279293        }
    280         @Override public boolean equalVal(List<String> otherVal) {
     294
     295        @Override
     296        public boolean equalVal(List<String> otherVal) {
    281297            return equalCollection(value, otherVal);
    282298        }
     299
    283300        public static boolean equalCollection(Collection<String> a, Collection<String> b) {
    284301            if (a == null) return b == null;
     
    290307                String aStr = itA.next();
    291308                String bStr = itB.next();
    292                 if (!Objects.equals(aStr,bStr)) return false;
     309                if (!Objects.equals(aStr, bStr)) return false;
    293310            }
    294311            return true;
    295312        }
    296         @Override public ListSetting copy() {
     313
     314        @Override
     315        public ListSetting copy() {
    297316            return ListSetting.create(value);
    298317        }
     318
    299319        private void consistencyTest() {
    300320            if (value != null && value.contains(null))
    301321                throw new RuntimeException("Error: Null as list element in preference setting");
    302322        }
    303         @Override public void visit(SettingVisitor visitor) {
     323
     324        @Override
     325        public void visit(SettingVisitor visitor) {
    304326            visitor.visit(this);
    305327        }
    306         @Override public ListSetting getNullInstance() {
     328
     329        @Override
     330        public ListSetting getNullInstance() {
    307331            return new ListSetting(null);
    308332        }
     333
    309334        @Override
    310335        public boolean equals(Object other) {
     
    470495    public interface SettingVisitor {
    471496        void visit(StringSetting setting);
     497
    472498        void visit(ListSetting value);
     499
    473500        void visit(ListListSetting value);
     501
    474502        void visit(MapListSetting value);
    475503    }
     
    477505    public interface PreferenceChangeEvent {
    478506        String getKey();
     507
    479508        Setting<?> getOldValue();
     509
    480510        Setting<?> getNewValue();
    481511    }
     
    514544    public interface ColorKey {
    515545        String getColorName();
     546
    516547        String getSpecialName();
     548
    517549        Color getDefaultValue();
    518550    }
     
    707739
    708740    public synchronized Map<String, String> getAllPrefix(final String prefix) {
    709         final Map<String,String> all = new TreeMap<>();
    710         for (final Entry<String,Setting<?>> e : settingsMap.entrySet()) {
     741        final Map<String, String> all = new TreeMap<>();
     742        for (final Entry<String, Setting<?>> e : settingsMap.entrySet()) {
    711743            if (e.getKey().startsWith(prefix) && (e.getValue() instanceof StringSetting)) {
    712744                all.put(e.getKey(), ((StringSetting) e.getValue()).getValue());
     
    727759
    728760    public synchronized Map<String, String> getAllColors() {
    729         final Map<String,String> all = new TreeMap<>();
    730         for (final Entry<String,Setting<?>> e : defaultsMap.entrySet()) {
     761        final Map<String, String> all = new TreeMap<>();
     762        for (final Entry<String, Setting<?>> e : defaultsMap.entrySet()) {
    731763            if (e.getKey().startsWith("color.") && e.getValue() instanceof StringSetting) {
    732764                StringSetting d = (StringSetting) e.getValue();
     
    736768            }
    737769        }
    738         for (final Entry<String,Setting<?>> e : settingsMap.entrySet()) {
     770        for (final Entry<String, Setting<?>> e : settingsMap.entrySet()) {
    739771            if (e.getKey().startsWith("color.") && (e.getValue() instanceof StringSetting)) {
    740772                all.put(e.getKey().substring(6), ((StringSetting) e.getValue()).getValue());
     
    758790        Setting<?> prop = settingsMap.get(skey);
    759791        if (prop instanceof StringSetting)
    760             return Boolean.parseBoolean(((StringSetting)prop).getValue());
     792            return Boolean.parseBoolean(((StringSetting) prop).getValue());
    761793        else
    762794            return generic;
     
    771803     */
    772804    public boolean put(final String key, String value) {
    773         if(value != null && value.isEmpty()) {
     805        if (value != null && value.isEmpty()) {
    774806            value = null;
    775807        }
     
    870902        File prefDir = getPreferencesDirectory();
    871903        if (prefDir.exists()) {
    872             if(!prefDir.isDirectory()) {
     904            if (!prefDir.isDirectory()) {
    873905                Main.warn(tr("Failed to initialize preferences. Preference directory ''{0}'' is not a directory.",
    874906                        prefDir.getAbsoluteFile()));
     
    908940                save();
    909941            }
    910         } catch(IOException e) {
     942        } catch (IOException e) {
    911943            Main.error(e);
    912944            JOptionPane.showMessageDialog(
     
    923955        } catch (Exception e) {
    924956            Main.error(e);
    925             File backupFile = new File(prefDir,"preferences.xml.bak");
     957            File backupFile = new File(prefDir, "preferences.xml.bak");
    926958            JOptionPane.showMessageDialog(
    927959                    Main.parent,
    928                     tr("<html>Preferences file had errors.<br> Making backup of old one to <br>{0}<br> and creating a new default preference file.</html>",
     960                    tr("<html>Preferences file had errors.<br> Making backup of old one to <br>{0}<br> " +
     961                            "and creating a new default preference file.</html>",
    929962                            backupFile.getAbsoluteFile()),
    930963                    tr("Error"),
     
    935968                resetToDefault();
    936969                save();
    937             } catch(IOException e1) {
     970            } catch (IOException e1) {
    938971                Main.error(e1);
    939972                Main.warn(tr("Failed to initialize preferences. Failed to reset preference file to default: {0}", getPreferenceFile()));
     
    942975    }
    943976
    944     public final void resetToDefault(){
     977    public final void resetToDefault() {
    945978        settingsMap.clear();
    946979    }
     
    10011034    public synchronized Color getColor(String colName, String specName, Color def) {
    10021035        String colKey = ColorProperty.getColorKey(colName);
    1003         if(!colKey.equals(colName)) {
     1036        if (!colKey.equals(colName)) {
    10041037            colornames.put(colKey, colName);
    10051038        }
     
    10271060    public synchronized int getInteger(String key, int def) {
    10281061        String v = get(key, Integer.toString(def));
    1029         if(v.isEmpty())
     1062        if (v.isEmpty())
    10301063            return def;
    10311064
    10321065        try {
    10331066            return Integer.parseInt(v);
    1034         } catch(NumberFormatException e) {
     1067        } catch (NumberFormatException e) {
    10351068            // fall out
    10361069        }
     
    10401073    public synchronized int getInteger(String key, String specName, int def) {
    10411074        String v = get(key+"."+specName);
    1042         if(v.isEmpty())
    1043             v = get(key,Integer.toString(def));
    1044         if(v.isEmpty())
     1075        if (v.isEmpty())
     1076            v = get(key, Integer.toString(def));
     1077        if (v.isEmpty())
    10451078            return def;
    10461079
    10471080        try {
    10481081            return Integer.parseInt(v);
    1049         } catch(NumberFormatException e) {
     1082        } catch (NumberFormatException e) {
    10501083            // fall out
    10511084        }
     
    10551088    public synchronized long getLong(String key, long def) {
    10561089        String v = get(key, Long.toString(def));
    1057         if(null == v)
     1090        if (null == v)
    10581091            return def;
    10591092
    10601093        try {
    10611094            return Long.parseLong(v);
    1062         } catch(NumberFormatException e) {
     1095        } catch (NumberFormatException e) {
    10631096            // fall out
    10641097        }
     
    10681101    public synchronized double getDouble(String key, double def) {
    10691102        String v = get(key, Double.toString(def));
    1070         if(null == v)
     1103        if (null == v)
    10711104            return def;
    10721105
    10731106        try {
    10741107            return Double.parseDouble(v);
    1075         } catch(NumberFormatException e) {
     1108        } catch (NumberFormatException e) {
    10761109            // fall out
    10771110        }
     
    11391172                try {
    11401173                    save();
    1141                 } catch (IOException e){
     1174                } catch (IOException e) {
    11421175                    Main.warn(tr("Failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile()));
    11431176                }
     
    12531286     */
    12541287    public <T> List<T> getListOfStructs(String key, Collection<T> def, Class<T> klass) {
    1255         Collection<Map<String,String>> prop =
     1288        Collection<Map<String, String>> prop =
    12561289            getListOfStructs(key, def == null ? null : serializeListOfStructs(def, klass));
    12571290        if (prop == null)
    12581291            return def == null ? null : new ArrayList<>(def);
    12591292        List<T> lst = new ArrayList<>();
    1260         for (Map<String,String> entries : prop) {
     1293        for (Map<String, String> entries : prop) {
    12611294            T struct = deserializeStruct(entries, klass);
    12621295            lst.add(struct);
     
    12821315    }
    12831316
    1284     private <T> Collection<Map<String,String>> serializeListOfStructs(Collection<T> l, Class<T> klass) {
     1317    private <T> Collection<Map<String, String>> serializeListOfStructs(Collection<T> l, Class<T> klass) {
    12851318        if (l == null)
    12861319            return null;
    1287         Collection<Map<String,String>> vals = new ArrayList<>();
     1320        Collection<Map<String, String>> vals = new ArrayList<>();
    12881321        for (T struct : l) {
    12891322            if (struct == null) {
     
    13001333        try (JsonWriter writer = Json.createWriter(stringWriter)) {
    13011334            JsonObjectBuilder object = Json.createObjectBuilder();
    1302             for(Object o: map.entrySet()) {
     1335            for (Object o: map.entrySet()) {
    13031336                Entry e = (Entry) o;
    13041337                object.add(e.getKey().toString(), e.getValue().toString());
     
    13221355    }
    13231356
    1324     public static <T> Map<String,String> serializeStruct(T struct, Class<T> klass) {
     1357    public static <T> Map<String, String> serializeStruct(T struct, Class<T> klass) {
    13251358        T structPrototype;
    13261359        try {
     
    13301363        }
    13311364
    1332         Map<String,String> hash = new LinkedHashMap<>();
     1365        Map<String, String> hash = new LinkedHashMap<>();
    13331366        for (Field f : klass.getDeclaredFields()) {
    13341367            if (f.getAnnotation(pref.class) == null) {
     
    13561389    }
    13571390
    1358     public static <T> T deserializeStruct(Map<String,String> hash, Class<T> klass) {
     1391    public static <T> T deserializeStruct(Map<String, String> hash, Class<T> klass) {
    13591392        T struct = null;
    13601393        try {
     
    13631396            throw new RuntimeException(ex);
    13641397        }
    1365         for (Entry<String,String> key_value : hash.entrySet()) {
     1398        for (Entry<String, String> key_value : hash.entrySet()) {
    13661399            Object value = null;
    13671400            Field f;
     
    14221455     */
    14231456    public void updateSystemProperties() {
    1424         if("true".equals(get("prefer.ipv6", "auto"))) {
     1457        if ("true".equals(get("prefer.ipv6", "auto"))) {
    14251458            // never set this to false, only true!
    1426             if(!"true".equals(Utils.updateSystemProperty("java.net.preferIPv6Addresses", "true"))) {
     1459            if (!"true".equals(Utils.updateSystemProperty("java.net.preferIPv6Addresses", "true"))) {
    14271460                Main.info(tr("Try enabling IPv6 network, prefering IPv6 over IPv4 (only works on early startup)."));
    14281461            }
     
    17501783        // update old style JOSM server links to use zip now, see #10581
    17511784        // actually also cache and mirror entries should be cleared
    1752         if(getInteger("josm.version", Version.getInstance().getVersion()) < 8099) {
    1753             for(String key: new String[]{"mappaint.style.entries", "taggingpreset.entries"}) {
     1785        if (getInteger("josm.version", Version.getInstance().getVersion()) < 8099) {
     1786            for (String key: new String[]{"mappaint.style.entries", "taggingpreset.entries"}) {
    17541787                Collection<Map<String, String>> data = getListOfStructs(key, (Collection<Map<String, String>>) null);
    17551788                if (data != null) {
    17561789                    List<Map<String, String>> newlist = new ArrayList<Map<String, String>>();
    17571790                    boolean modified = false;
    1758                     for(Map<String, String> map : data) {
     1791                    for (Map<String, String> map : data) {
    17591792                         Map<String, String> newmap = new LinkedHashMap<String, String>();
    17601793                         for (Entry<String, String> entry : map.entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r7937 r8510  
    1414 * A system of units used to express length and area measurements.
    1515 * @since 3406 (creation)
    16  * @since 6992 (extraction in this package) 
     16 * @since 6992 (extraction in this package)
    1717 */
    1818public class SystemOfMeasurement {
     
    4141     */
    4242    public static final SystemOfMeasurement NAUTICAL_MILE = new SystemOfMeasurement(185.2, "kbl", 1852, "NM");
    43    
     43
    4444    /**
    4545     * Known systems of measurement.
     
    5454        ALL_SYSTEMS.put(marktr("Nautical Mile"), NAUTICAL_MILE);
    5555    }
    56    
     56
    5757    /** First value, in meters, used to translate unit according to above formula. */
    5858    public final double aValue;
     
    173173            return format.format(v) + " " + unit;
    174174        }
    175         return String.format(Locale.US, "%." + (v<9.999999 ? 2 : 1) + "f %s", v, unit);
     175        return String.format(Locale.US, "%." + (v < 9.999999 ? 2 : 1) + "f %s", v, unit);
    176176    }
    177177}
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r8413 r8510  
    8888        Main.main.getCurrentDataSet().beginUpdate();
    8989        try {
    90             for (int i=1; i<=num; ++i) {
     90            for (int i = 1; i <= num; ++i) {
    9191                final Command c = commands.removeLast();
    9292                c.undoCommand();
     
    121121            return;
    122122        Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    123         for (int i=0; i<num; ++i) {
     123        for (int i = 0; i < num; ++i) {
    124124            final Command c = redoCommands.removeFirst();
    125125            c.executeCommand();
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r8390 r8510  
    109109            try {
    110110                version = Integer.parseInt(value);
    111             } catch(NumberFormatException e) {
     111            } catch (NumberFormatException e) {
    112112                version = 0;
    113113                Main.warn(tr("Unexpected JOSM version number in revision file, value is ''{0}''", value));
     
    143143        //
    144144        StringBuilder sb = new StringBuilder();
    145         for(Entry<String,String> property: properties.entrySet()) {
     145        for (Entry<String, String> property: properties.entrySet()) {
    146146            sb.append(property.getKey()).append(':').append(property.getValue()).append('\n');
    147147        }
  • trunk/src/org/openstreetmap/josm/data/cache/BufferedImageCacheEntry.java

    r8488 r8510  
    4242        if (imageLoaded)
    4343            return img;
    44         synchronized(this) {
     44        synchronized (this) {
    4545            if (imageLoaded)
    4646                return img;
     
    5757        return img;
    5858    }
    59 
    6059
    6160    private void writeObject(java.io.ObjectOutputStream out) throws IOException {
     
    8180        synchronized (this) {
    8281            if (content == null && img != null) {
    83                 throw new AssertionError("Trying to serialize (save to disk?) an BufferedImageCacheEntry that was converted to BufferedImage and no raw data is present anymore");
     82                throw new AssertionError("Trying to serialize (save to disk?) an BufferedImageCacheEntry " +
     83                        "that was converted to BufferedImage and no raw data is present anymore");
    8484            }
    8585            out.writeObject(this);
     
    9090                content = null;
    9191            }
    92 
    9392        }
    9493    }
  • trunk/src/org/openstreetmap/josm/data/cache/CacheEntryAttributes.java

    r8421 r8510  
    7575     */
    7676    public void setEtag(String etag) {
    77         if(etag != null) {
     77        if (etag != null) {
    7878            attrs.put(ETAG, etag);
    7979        }
  • trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java

    r8418 r8510  
    9595        Semaphore limit = hostSemaphores.get(host);
    9696        if (limit == null) {
    97             synchronized(hostSemaphores) {
     97            synchronized (hostSemaphores) {
    9898                limit = hostSemaphores.get(host);
    9999                if (limit == null) {
     
    122122    }
    123123
    124 
    125     private boolean tryAcquireSemaphore(final JCSCachedTileLoaderJob<?,?> job) {
     124    private boolean tryAcquireSemaphore(final JCSCachedTileLoaderJob<?, ?> job) {
    126125        boolean ret = true;
    127126        Semaphore limit = getSemaphore(job);
     
    140139    }
    141140
    142     private void releaseSemaphore(JCSCachedTileLoaderJob<?,?> job) {
     141    private void releaseSemaphore(JCSCachedTileLoaderJob<?, ?> job) {
    143142        Semaphore limit = getSemaphore(job);
    144143        if (limit != null) {
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java

    r8509 r8510  
    123123     * @throws IOException if directory is not found
    124124     */
    125     public static <K,V> CacheAccess<K, V> getCache(String cacheName) throws IOException {
     125    public static <K, V> CacheAccess<K, V> getCache(String cacheName) throws IOException {
    126126        return getCache(cacheName, DEFAULT_MAX_OBJECTS_IN_MEMORY.get().intValue(), 0, null);
    127127    }
     
    136136     * @throws IOException if directory is not found
    137137     */
    138     public static <K,V> CacheAccess<K, V> getCache(String cacheName, int maxMemoryObjects, int maxDiskObjects, String cachePath) throws IOException {
     138    public static <K, V> CacheAccess<K, V> getCache(String cacheName, int maxMemoryObjects, int maxDiskObjects, String cachePath)
     139            throws IOException {
    139140        if (cacheManager != null)
    140141            return getCacheInner(cacheName, maxMemoryObjects, maxDiskObjects, cachePath);
     
    147148    }
    148149
    149 
    150150    @SuppressWarnings("unchecked")
    151     private static <K,V> CacheAccess<K, V> getCacheInner(String cacheName, int maxMemoryObjects, int maxDiskObjects, String cachePath) {
     151    private static <K, V> CacheAccess<K, V> getCacheInner(String cacheName, int maxMemoryObjects, int maxDiskObjects, String cachePath) {
    152152        CompositeCache<K, V> cc = cacheManager.getCache(cacheName, getCacheAttributes(maxMemoryObjects));
    153153
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java

    r8509 r8510  
    8484
    8585    public static ThreadFactory getNamedThreadFactory(final String name) {
    86         return new ThreadFactory(){
     86        return new ThreadFactory() {
    8787            @Override
    8888            public Thread newThread(Runnable r) {
     
    9494    }
    9595
    96     private static ConcurrentMap<String,Set<ICachedLoaderListener>> inProgress = new ConcurrentHashMap<>();
     96    private static ConcurrentMap<String, Set<ICachedLoaderListener>> inProgress = new ConcurrentHashMap<>();
    9797    private static ConcurrentMap<String, Boolean> useHead = new ConcurrentHashMap<>();
    9898
     
    119119     * @param downloadJobExecutor that will be executing the jobs
    120120     */
    121     public JCSCachedTileLoaderJob(ICacheAccess<K,V> cache,
     121    public JCSCachedTileLoaderJob(ICacheAccess<K, V> cache,
    122122            int connectTimeout, int readTimeout,
    123123            Map<String, String> headers,
     
    337337                // we have an object in cache, but we haven't received 304 resposne code
    338338                // check if we should use HEAD request to verify
    339                 if((attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getRequestProperty("ETag"))) ||
     339                if ((attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getRequestProperty("ETag"))) ||
    340340                        attributes.getLastModification() == urlConn.getLastModified()) {
    341341                    // we sent ETag or If-Modified-Since, but didn't get 304 response code
     
    455455        urlConn.setReadTimeout(readTimeout); // 30 seconds read timeout
    456456        urlConn.setConnectTimeout(connectTimeout);
    457         for(Map.Entry<String, String> e: headers.entrySet()) {
     457        for (Map.Entry<String, String> e: headers.entrySet()) {
    458458            urlConn.setRequestProperty(e.getKey(), e.getValue());
    459459        }
     
    466466    private boolean isCacheValidUsingHead() throws IOException {
    467467        URLConnection urlConn = getUrl().openConnection();
    468         if(urlConn instanceof HttpURLConnection) {
    469             ((HttpURLConnection)urlConn).setRequestMethod("HEAD");
     468        if (urlConn instanceof HttpURLConnection) {
     469            ((HttpURLConnection) urlConn).setRequestMethod("HEAD");
    470470            long lastModified = urlConn.getLastModified();
    471471            return (attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getRequestProperty("ETag"))) ||
     
    504504    public void cancelOutstandingTasks() {
    505505        ThreadPoolExecutor downloadExecutor = getDownloadExecutor();
    506         for(Runnable r: downloadExecutor.getQueue()) {
     506        for (Runnable r: downloadExecutor.getQueue()) {
    507507            if (downloadExecutor.remove(r)) {
    508508                if (r instanceof JCSCachedTileLoaderJob) {
  • trunk/src/org/openstreetmap/josm/data/conflict/Conflict.java

    r6313 r8510  
    103103        if (my != other.my)
    104104            return false;
    105         if(their != other.their)
     105        if (their != other.their)
    106106            return false;
    107107        return true;
  • trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java

    r8465 r8510  
    2626 *    ConflictCollection conflictCollection = ....
    2727 *
    28  *    for(Conflict c : conflictCollection) {
     28 *    for (Conflict c : conflictCollection) {
    2929 *      // do something
    3030 *    }
     
    132132    public void add(Collection<Conflict<?>> otherConflicts) {
    133133        if (otherConflicts == null) return;
    134         for(Conflict<?> c : otherConflicts) {
     134        for (Conflict<?> c : otherConflicts) {
    135135            addConflict(c);
    136136        }
     
    167167    public void remove(OsmPrimitive my) {
    168168        Iterator<Conflict<?>> it = iterator();
    169         while(it.hasNext()) {
     169        while (it.hasNext()) {
    170170            if (it.next().isMatchingMy(my)) {
    171171                it.remove();
     
    184184     */
    185185    public Conflict<?> getConflictForMy(OsmPrimitive my) {
    186         for(Conflict<?> c : conflicts) {
     186        for (Conflict<?> c : conflicts) {
    187187            if (c.isMatchingMy(my))
    188188                return c;
     
    199199     */
    200200    public Conflict<?> getConflictForTheir(OsmPrimitive their) {
    201         for(Conflict<?> c : conflicts) {
     201        for (Conflict<?> c : conflicts) {
    202202            if (c.isMatchingTheir(their))
    203203                return c;
     
    243243    public void removeForMy(OsmPrimitive my) {
    244244        Iterator<Conflict<?>> it = iterator();
    245         while(it.hasNext()) {
     245        while (it.hasNext()) {
    246246            if (it.next().isMatchingMy(my)) {
    247247                it.remove();
     
    257257    public void removeForTheir(OsmPrimitive their) {
    258258        Iterator<Conflict<?>> it = iterator();
    259         while(it.hasNext()) {
     259        while (it.hasNext()) {
    260260            if (it.next().isMatchingTheir(their)) {
    261261                it.remove();
  • trunk/src/org/openstreetmap/josm/data/conflict/IConflictListener.java

    r3083 r8510  
    44public interface IConflictListener {
    55    public void onConflictsAdded(ConflictCollection conflicts);
     6
    67    public void onConflictsRemoved(ConflictCollection conflicts);
    78}
  • trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java

    r8345 r8510  
    1414
    1515    public EastNorth(double east, double north) {
    16         super(east,north);
     16        super(east, north);
    1717    }
    1818
     
    7373     * @return length of this
    7474     */
    75     public double length(){
     75    public double length() {
    7676        return Math.sqrt(x*x + y*y);
    7777    }
     
    8686    public double heading(EastNorth other) {
    8787        double hd = Math.atan2(other.east() - east(), other.north() - north());
    88         if(hd < 0) {
     88        if (hd < 0) {
    8989            hd = 2 * Math.PI + hd;
    9090        }
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r8444 r8510  
    198198    public static final String SOUTH = trc("compass", "S");
    199199    public static final String NORTH = trc("compass", "N");
     200
    200201    public String latToString(CoordinateFormat d) {
    201202        switch(d) {
     
    218219    public static final String WEST = trc("compass", "W");
    219220    public static final String EAST = trc("compass", "E");
     221
    220222    public String lonToString(CoordinateFormat d) {
    221223        switch(d) {
  • trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java

    r8395 r8510  
    1414
    1515    public static final int TILES_PER_LEVEL_SHIFT = 2; // Has to be 2. Other parts of QuadBuckets code rely on it
    16     public static final int TILES_PER_LEVEL = 1<<TILES_PER_LEVEL_SHIFT;
     16    public static final int TILES_PER_LEVEL = 1 << TILES_PER_LEVEL_SHIFT;
    1717    public static final int X_PARTS = 360;
    1818    public static final int X_BIAS = -180;
     
    5858            tile <<= 2;
    5959            // Note that x is the MSB
    60             tile |= (xbit<<1) | ybit;
     60            tile |= (xbit << 1) | ybit;
    6161        }
    6262        return tile;
     
    6868
    6969    static long lon2x(double lon) {
    70         long ret = (long)((lon + 180.0) * WORLD_PARTS / 360.0);
     70        long ret = (long) ((lon + 180.0) * WORLD_PARTS / 360.0);
    7171        if (Utils.equalsEpsilon(ret, WORLD_PARTS)) {
    7272            ret--;
     
    7676
    7777    static long lat2y(double lat) {
    78         long ret = (long)((lat + 90.0) * WORLD_PARTS / 180.0);
     78        long ret = (long) ((lat + 90.0) * WORLD_PARTS / 180.0);
    7979        if (Utils.equalsEpsilon(ret, WORLD_PARTS)) {
    8080            ret--;
     
    9090        long mask = 0x00000003;
    9191        int total_shift = TILES_PER_LEVEL_SHIFT*(NR_LEVELS-level-1);
    92         return (int)(mask & (quad >> total_shift));
     92        return (int) (mask & (quad >> total_shift));
    9393    }
    9494
     
    125125        long y = lat2y(lat);
    126126        int shift = NR_LEVELS-level-1;
    127         return (int)((x >> shift & 1) * 2 + (y >> shift & 1));
     127        return (int) ((x >> shift & 1) * 2 + (y >> shift & 1));
    128128    }
    129129}
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java

    r7937 r8510  
    102102     * Possible fix values.
    103103     */
    104     public static Collection<String> FIX_VALUES = Arrays.asList("none","2d","3d","dgps","pps");
     104    public static Collection<String> FIX_VALUES = Arrays.asList("none", "2d", "3d", "dgps", "pps");
    105105}
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r8506 r8510  
    200200            }
    201201        }
    202         if (earliest==null || latest==null) return null;
     202        if (earliest == null || latest == null) return null;
    203203        return new Date[]{earliest.getTime(), latest.getTime()};
    204204    }
     
    212212    */
    213213    public Date[] getMinMaxTimeForAllTracks() {
    214         double min=1e100;
    215         double max=-1e100;
     214        double min = 1e100;
     215        double max = -1e100;
    216216        double now = System.currentTimeMillis()/1000.0;
    217217        for (GpxTrack trk: tracks) {
     
    219219                for (WayPoint pnt : seg.getWayPoints()) {
    220220                    double t = pnt.time;
    221                     if (t>0 && t<=now) {
    222                         if (t>max) max=t;
    223                         if (t<min) min=t;
    224                     }
    225                 }
    226             }
    227         }
    228         if (Utils.equalsEpsilon(min,1e100) || Utils.equalsEpsilon(max,-1e100)) return new Date[0];
     221                    if (t > 0 && t <= now) {
     222                        if (t > max) max = t;
     223                        if (t < min) min = t;
     224                    }
     225                }
     226            }
     227        }
     228        if (Utils.equalsEpsilon(min, 1e100) || Utils.equalsEpsilon(max, -1e100)) return new Date[0];
    229229        return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000))};
    230230    }
     
    363363    public void resetEastNorthCache() {
    364364        if (waypoints != null) {
    365             for (WayPoint wp : waypoints){
     365            for (WayPoint wp : waypoints) {
    366366                wp.invalidateEastNorthCache();
    367367            }
    368368        }
    369         if (tracks != null){
     369        if (tracks != null) {
    370370            for (GpxTrack track: tracks) {
    371371                for (GpxTrackSegment segment: track.getSegments()) {
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java

    r7509 r8510  
    1414
    1515    Collection<GpxTrackSegment> getSegments();
     16
    1617    Map<String, Object> getAttributes();
     18
    1719    Bounds getBounds();
     20
    1821    double length();
    1922
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java

    r5170 r8510  
    1313
    1414    Bounds getBounds();
     15
    1516    Collection<WayPoint> getWayPoints();
     17
    1618    double length();
     19
    1720    /**
    1821     *
  • trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java

    r7005 r8510  
    3030    }
    3131
    32     private double calculateLength(){
     32    private double calculateLength() {
    3333        double result = 0.0; // in meters
    3434
  • trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java

    r7005 r8510  
    3636        WayPoint last = null;
    3737        for (WayPoint tpt : wayPoints) {
    38             if(last != null){
     38            if (last != null) {
    3939                Double d = last.getCoor().greatCircleDistance(tpt.getCoor());
    40                 if(!d.isNaN() && !d.isInfinite()) {
     40                if (!d.isNaN() && !d.isInfinite()) {
    4141                    result += d;
    4242                }
  • trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java

    r8376 r8510  
    6767
    6868    public final LatLon getCoor() {
    69         return new LatLon(lat,lon);
     69        return new LatLon(lat, lon);
    7070    }
    7171
     
    9595    @Override
    9696    public String toString() {
    97         return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " :"") + getCoor() + ", " + attr + ")";
     97        return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " : "") + getCoor() + ", " + attr + ")";
    9898    }
    9999
     
    105105            try {
    106106                time = dateParser.get().parse(get(PT_TIME).toString()).getTime() / 1000.; /* ms => seconds */
    107             } catch(Exception e) {
     107            } catch (Exception e) {
    108108                time = 0;
    109109            }
  • trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java

    r7518 r8510  
    4444    public String getString(String key) {
    4545        Object value = attr.get(key);
    46         return (value instanceof String) ? (String)value : null;
     46        return (value instanceof String) ? (String) value : null;
    4747    }
    4848
     
    6060    public <T> Collection<T> getCollection(String key) {
    6161        Object value = attr.get(key);
    62         return (value instanceof Collection) ? (Collection<T>)value : null;
     62        return (value instanceof Collection) ? (Collection<T>) value : null;
    6363    }
    6464
  • trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java

    r7425 r8510  
    3737    private int yIndex;
    3838
    39     private static final Color transparentColor = new Color(0,0,0,0);
     39    private static final Color transparentColor = new Color(0, 0, 0, 0);
    4040    private Color fadeColor = transparentColor;
    4141
     
    118118            return false;
    119119
    120         if(!(this.xIndex == xIndex && this.yIndex == yIndex))
     120        if (!(this.xIndex == xIndex && this.yIndex == yIndex))
    121121            return false;
    122122
     
    130130
    131131        // This happens if you zoom outside the world
    132         if(width == 0 || height == 0)
     132        if (width == 0 || height == 0)
    133133            return false;
    134134
     
    141141        }
    142142
    143         BufferedImage img = reImg == null?null:reImg.get();
    144         if(img != null && img.getWidth() == width && img.getHeight() == height && fadeColor.equals(newFadeColor)) {
     143        BufferedImage img = reImg == null ? null : reImg.get();
     144        if (img != null && img.getWidth() == width && img.getHeight() == height && fadeColor.equals(newFadeColor)) {
    145145            g.drawImage(img, x, y, null);
    146146            return true;
     
    152152
    153153        try {
    154             if(img != null) {
     154            if (img != null) {
    155155                img.flush();
    156156            }
     
    163163            // traditional rendering is as fast at these zoom levels, so it's no loss.
    164164            // Also prevent caching if we're out of memory soon
    165             if(width > 2000 || height > 2000 || width*height*multipl > freeMem) {
     165            if (width > 2000 || height > 2000 || width*height*multipl > freeMem) {
    166166                fallbackDraw(g, getImage(), x, y, width, height, alphaChannel);
    167167            } else {
    168168                // We haven't got a saved resized copy, so resize and cache it
    169                 img = new BufferedImage(width, height, alphaChannel?BufferedImage.TYPE_INT_ARGB:BufferedImage.TYPE_3BYTE_BGR);
     169                img = new BufferedImage(width, height, alphaChannel ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_3BYTE_BGR);
    170170                img.getGraphics().drawImage(getImage(),
    171171                        0, 0, width, height, // dest
     
    179179                reImg = new SoftReference<>(img);
    180180            }
    181         } catch(Exception e) {
     181        } catch (Exception e) {
    182182            fallbackDraw(g, getImage(), x, y, width, height, alphaChannel);
    183183        }
     
    216216    private void writeObject(ObjectOutputStream out) throws IOException {
    217217        out.writeObject(state);
    218         if(getImage() == null) {
     218        if (getImage() == null) {
    219219            out.writeBoolean(false);
    220220            out.writeObject(null);
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r8459 r8510  
    353353        setExtendedUrl(url);
    354354        ImageryType t = ImageryType.fromString(type);
    355         this.cookies=cookies;
     355        this.cookies = cookies;
    356356        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
    357357        if (t != null) {
     
    664664                serverProjections = new ArrayList<>();
    665665                Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH));
    666                 if(m.matches()) {
    667                     for(String p : m.group(1).split(","))
     666                if (m.matches()) {
     667                    for (String p : m.group(1).split(","))
    668668                        serverProjections.add(p);
    669669                }
     
    708708    public void setName(String language, String name) {
    709709        boolean isdefault = LanguageInfo.getJOSMLocaleCode(null).equals(language);
    710         if(LanguageInfo.isBetterLanguage(langName, language)) {
     710        if (LanguageInfo.isBetterLanguage(langName, language)) {
    711711            this.name = isdefault ? tr(name) : name;
    712712            this.langName = language;
    713713        }
    714         if(origName == null || isdefault) {
     714        if (origName == null || isdefault) {
    715715            this.origName = name;
    716716        }
     
    827827    public void setDescription(String language, String description) {
    828828        boolean isdefault = LanguageInfo.getJOSMLocaleCode(null).equals(language);
    829         if(LanguageInfo.isBetterLanguage(langDescription, language)) {
     829        if (LanguageInfo.isBetterLanguage(langDescription, language)) {
    830830            this.description = isdefault ? tr(description) : description;
    831831            this.langDescription = language;
     
    916916    public String getExtendedUrl() {
    917917        return imageryType.getTypeString() + (defaultMaxZoom != 0
    918             ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":" + url;
     918            ? "["+(defaultMinZoom != 0 ? defaultMinZoom+"," : "")+defaultMaxZoom+"]" : "") + ":" + url;
    919919    }
    920920
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r8465 r8510  
    220220
    221221        // automatically update user entries with same id as a default entry
    222         for (int i=0; i<layers.size(); i++) {
     222        for (int i = 0; i < layers.size(); i++) {
    223223            ImageryInfo info = layers.get(i);
    224224            if (info.getId() == null) {
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r8393 r8510  
    7979
    8080    public static void loadBookmarks() {
    81         for(Collection<String> c : Main.pref.getArray("imagery.offsets",
     81        for (Collection<String> c : Main.pref.getArray("imagery.offsets",
    8282                Collections.<Collection<String>>emptySet())) {
    8383            allBookmarks.add(new OffsetBookmark(c));
     
    106106            center = Main.getProjection().eastNorth2latlon(Main.map.mapView.getCenter());
    107107        } else {
    108             center = new LatLon(0,0);
     108            center = new LatLon(0, 0);
    109109        }
    110110        OffsetBookmark nb = new OffsetBookmark(
    111111                Main.getProjection().toCode(), layer.getInfo().getName(),
    112112                name, layer.getDx(), layer.getDy(), center.lon(), center.lat());
    113         for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator();it.hasNext();) {
     113        for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator(); it.hasNext();) {
    114114            OffsetBookmark b = it.next();
    115115            if (b.isUsable(layer) && name.equals(b.name)) {
  • trunk/src/org/openstreetmap/josm/data/imagery/Shape.java

    r8509 r8510  
    2929            throw new IllegalArgumentException(MessageFormat.format("Even number of doubles expected in string, got {0}: {1}",
    3030                    components.length, asString));
    31         for (int i=0; i<components.length; i+=2) {
     31        for (int i = 0; i < components.length; i += 2) {
    3232            addPoint(components[i], components[i+1]);
    3333        }
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoader.java

    r8509 r8510  
    105105    @Override
    106106    public Tile getTile(TileSource source, int x, int y, int z) {
    107         return createTileLoaderJob(new Tile(source,x, y, z)).getTile();
     107        return createTileLoaderJob(new Tile(source, x, y, z)).getTile();
    108108    }
    109109
     
    135135     */
    136136    public void cancelOutstandingTasks() {
    137         for(Runnable r: downloadExecutor.getQueue()) {
     137        for (Runnable r: downloadExecutor.getQueue()) {
    138138            if (downloadExecutor.remove(r) && r instanceof TMSCachedTileLoaderJob) {
    139                 ((TMSCachedTileLoaderJob)r).handleJobCancellation();
     139                ((TMSCachedTileLoaderJob) r).handleJobCancellation();
    140140            }
    141141        }
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r8488 r8510  
    4545    private volatile URL url;
    4646
    47 
    4847    // we need another deduplication of Tile Loader listeners, as for each submit, new TMSCachedTileLoaderJob was created
    4948    // that way, we reduce calls to tileLoadingFinished, and general CPU load due to surplus Map repaints
    50     private static final ConcurrentMap<String,Set<TileLoaderListener>> inProgress = new ConcurrentHashMap<>();
     49    private static final ConcurrentMap<String, Set<TileLoaderListener>> inProgress = new ConcurrentHashMap<>();
    5150
    5251    /**
     
    177176
    178177        try {
    179             if(!tile.isLoaded()) { //if someone else already loaded tile, skip all the handling
     178            if (!tile.isLoaded()) { //if someone else already loaded tile, skip all the handling
    180179                tile.finishLoading(); // whatever happened set that loading has finished
    181180                // set tile metadata
     
    186185                }
    187186
    188                 switch(result){
     187                switch(result) {
    189188                case SUCCESS:
    190189                    handleNoTileAtZoom();
     
    215214            // always check, if there is some listener interested in fact, that tile has finished loading
    216215            if (listeners != null) { // listeners might be null, if some other thread notified already about success
    217                 for(TileLoaderListener l: listeners) {
     216                for (TileLoaderListener l: listeners) {
    218217                    l.tileLoadingFinished(tile, status);
    219218                }
     
    224223            tile.setLoaded(false);
    225224            if (listeners != null) { // listeners might be null, if some other thread notified already about success
    226                 for(TileLoaderListener l: listeners) {
     225                for (TileLoaderListener l: listeners) {
    227226                    l.tileLoadingFinished(tile, false);
    228227                }
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r8509 r8510  
    135135
    136136        for (Object propKey: layersIndex.keySet()) {
    137             String s = (String)propKey;
     137            String s = (String) propKey;
    138138            if (url.equals(layersIndex.getProperty(s))) {
    139139                cacheDirName = s;
     
    186186            WmsCacheType cacheEntries;
    187187            try (InputStream is = new FileInputStream(indexFile)) {
    188                 cacheEntries = (WmsCacheType)unmarshaller.unmarshal(is);
     188                cacheEntries = (WmsCacheType) unmarshaller.unmarshal(is);
    189189            }
    190190            totalFileSize = cacheEntries.getTotalFileSize();
     
    440440            drawAtLeastOnce = true;
    441441
    442             int xDiff = (int)((ce.east - east) * pixelPerDegree);
    443             int yDiff = (int)((ce.north - north) * pixelPerDegree);
    444             int size = (int)(pixelPerDegree / ce.pixelPerDegree  * tileSize);
     442            int xDiff = (int) ((ce.east - east) * pixelPerDegree);
     443            int yDiff = (int) ((ce.north - north) * pixelPerDegree);
     444            int size = (int) (pixelPerDegree / ce.pixelPerDegree  * tileSize);
    445445
    446446            int x = xDiff;
     
    467467        double deltaLat = Math.abs(ll3.lat() - ll1.lat());
    468468        double deltaLon = Math.abs(ll3.lon() - ll1.lon());
    469         int precisionLat = Math.max(0, -(int)Math.ceil(Math.log10(deltaLat)) + 1);
    470         int precisionLon = Math.max(0, -(int)Math.ceil(Math.log10(deltaLon)) + 1);
     469        int precisionLat = Math.max(0, -(int) Math.ceil(Math.log10(deltaLat)) + 1);
     470        int precisionLon = Math.max(0, -(int) Math.ceil(Math.log10(deltaLon)) + 1);
    471471
    472472        String zoom = SystemOfMeasurement.METRIC.getDistText(ll1.greatCircleDistance(ll2));
     
    493493            while (true) {
    494494                String result = String.format("%s_%." + precisionLat + "f_%." + precisionLon +"f%s.%s",
    495                         zoom, ll1.lat(), ll1.lon(), counter==0?"":"_" + counter, extension);
     495                        zoom, ll1.lat(), ll1.lon(), counter == 0 ? "" : "_" + counter, extension);
    496496                for (CacheEntry entry: projectionEntries.entries) {
    497497                    if (entry.filename.equals(result)) {
     
    528528            }
    529529            entry = new CacheEntry(pixelPerDegree, east, north,
    530                     tileSize,generateFileName(projectionEntries, pixelPerDegree, projection, east, north, mimeType));
     530                    tileSize, generateFileName(projectionEntries, pixelPerDegree, projection, east, north, mimeType));
    531531            entry.lastUsed = System.currentTimeMillis();
    532532            entry.lastModified = entry.lastUsed;
  • trunk/src/org/openstreetmap/josm/data/oauth/OsmPrivileges.java

    r6066 r8510  
    1313        return allowWriteApi;
    1414    }
     15
    1516    public void setAllowWriteApi(boolean allowWriteApi) {
    1617        this.allowWriteApi = allowWriteApi;
    1718    }
     19
    1820    public boolean isAllowWriteGpx() {
    1921        return allowWriteGpx;
    2022    }
     23
    2124    public void setAllowWriteGpx(boolean allowWriteGpx) {
    2225        this.allowWriteGpx = allowWriteGpx;
    2326    }
     27
    2428    public boolean isAllowReadGpx() {
    2529        return allowReadGpx;
    2630    }
     31
    2732    public void setAllowReadGpx(boolean allowReadGpx) {
    2833        this.allowReadGpx = allowReadGpx;
    2934    }
     35
    3036    public boolean isAllowReadPrefs() {
    3137        return allowReadPrefs;
    3238    }
     39
    3340    public void setAllowReadPrefs(boolean allowReadPrefs) {
    3441        this.allowReadPrefs = allowReadPrefs;
    3542    }
     43
    3644    public boolean isAllowWritePrefs() {
    3745        return allowWritePrefs;
    3846    }
     47
    3948    public void setAllowWritePrefs(boolean allowWritePrefs) {
    4049        this.allowWritePrefs = allowWritePrefs;
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r8449 r8510  
    107107        setKeys(other.getKeys());
    108108        id = other.id;
    109         if (id <=0) {
     109        if (id <= 0) {
    110110            // reset version and changeset id
    111111            version = 0;
     
    117117        }
    118118        flags = other.flags;
    119         user= other.user;
     119        user = other.user;
    120120        if (id > 0 && other.changesetId > 0) {
    121121            // #4208: sometimes we cloned from other with id < 0 *and*
     
    146146    public long getId() {
    147147        long id = this.id;
    148         return id >= 0?id:0;
     148        return id >= 0 ? id : 0;
    149149    }
    150150
     
    289289    @Override
    290290    public void setTimestamp(Date timestamp) {
    291         this.timestamp = (int)(timestamp.getTime() / 1000);
     291        this.timestamp = (int) (timestamp.getTime() / 1000);
    292292    }
    293293
     
    474474        String[] keys = this.keys;
    475475        if (keys != null) {
    476             for (int i=0; i<keys.length; i+=2) {
     476            for (int i = 0; i < keys.length; i += 2) {
    477477                result.put(keys[i], keys[i + 1]);
    478478            }
     
    522522        else if (value == null) {
    523523            remove(key);
    524         } else if (keys == null){
     524        } else if (keys == null) {
    525525            keys = new String[] {key, value};
    526526            keysChangedImpl(originalKeys);
    527527        } else {
    528             for (int i=0; i<keys.length;i+=2) {
     528            for (int i = 0; i < keys.length; i += 2) {
    529529                if (keys[i].equals(key)) {
    530530                    keys[i+1] = value;  // This modifies the keys array but it doesn't make it invalidate for any time so its ok (see note no top)
     
    534534            }
    535535            String[] newKeys = new String[keys.length + 2];
    536             for (int i=0; i< keys.length;i+=2) {
     536            for (int i = 0; i < keys.length; i += 2) {
    537537                newKeys[i] = keys[i];
    538538                newKeys[i+1] = keys[i+1];
     
    562562        }
    563563        String[] newKeys = new String[keys.length - 2];
    564         int j=0;
    565         for (int i=0; i < keys.length; i+=2) {
     564        int j = 0;
     565        for (int i = 0; i < keys.length; i += 2) {
    566566            if (!keys[i].equals(key)) {
    567567                newKeys[j++] = keys[i];
     
    599599        if (keys == null)
    600600            return null;
    601         for (int i=0; i<keys.length;i+=2) {
     601        for (int i = 0; i < keys.length; i += 2) {
    602602            if (keys[i].equals(key)) return keys[i+1];
    603603        }
     
    627627        if (keys == null)
    628628            return null;
    629         for (int i=0; i<keys.length;i+=2) {
     629        for (int i = 0; i < keys.length; i += 2) {
    630630            if (keys[i].equalsIgnoreCase(key)) return keys[i+1];
    631631        }
     
    643643            return Collections.emptySet();
    644644        Set<String> result = new HashSet<>(keys.length / 2);
    645         for (int i=0; i<keys.length; i+=2) {
     645        for (int i = 0; i < keys.length; i += 2) {
    646646            result.add(keys[i]);
    647647        }
     
    670670        if (key == null) return false;
    671671        if (keys == null) return false;
    672         for (int i=0; i< keys.length;i+=2) {
     672        for (int i = 0; i < keys.length; i += 2) {
    673673            if (keys[i].equals(key)) return true;
    674674        }
     
    701701    @Override
    702702    public String getLocalName() {
    703         for(String s : LanguageInfo.getLanguageCodes(null)) {
     703        for (String s : LanguageInfo.getLanguageCodes(null)) {
    704704            String val = get("name:" + s);
    705705            if (val != null)
  • trunk/src/org/openstreetmap/josm/data/osm/BBox.java

    r8470 r8510  
    267267    @Override
    268268    public int hashCode() {
    269         return (int)(ymin * xmin);
     269        return (int) (ymin * xmin);
    270270    }
    271271
     
    273273    public boolean equals(Object o) {
    274274        if (o instanceof BBox) {
    275             BBox b = (BBox)o;
     275            BBox b = (BBox) o;
    276276            return b.xmax == xmax && b.ymax == ymax
    277277                    && b.xmin == xmin && b.ymin == ymin;
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r8365 r8510  
    4242    private int commentsCount;
    4343    /** the map of tags */
    44     private Map<String,String> tags;
     44    private Map<String, String> tags;
    4545    /** indicates whether this changeset is incomplete. For an incomplete changeset we only know its id */
    4646    private boolean incomplete;
     
    159159    public Bounds getBounds() {
    160160        if (min != null && max != null)
    161             return new Bounds(min,max);
     161            return new Bounds(min, max);
    162162        return null;
    163163    }
  • trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java

    r8444 r8510  
    6969        GuiHelper.runInEDT(new Runnable() {
    7070            @Override public void run() {
    71                 for(ChangesetCacheListener l: listeners) {
     71                for (ChangesetCacheListener l: listeners) {
    7272                    l.changesetCacheUpdated(e);
    7373                }
     
    105105
    106106    public boolean contains(int id) {
    107         if (id <=0) return false;
     107        if (id <= 0) return false;
    108108        return cache.get(id) != null;
    109109    }
  • trunk/src/org/openstreetmap/josm/data/osm/ChangesetCacheEvent.java

    r3083 r8510  
    66public interface ChangesetCacheEvent {
    77    ChangesetCache getSource();
     8
    89    Collection<Changeset> getAddedChangesets();
     10
    911    Collection<Changeset> getRemovedChangesets();
     12
    1013    Collection<Changeset> getUpdatedChangesets();
    11 
    1214}
  • trunk/src/org/openstreetmap/josm/data/osm/ChangesetDataSet.java

    r8338 r8510  
    2525    public static interface ChangesetDataSetEntry {
    2626        public ChangesetModificationType getModificationType();
     27
    2728        public HistoryOsmPrimitive getPrimitive();
    2829    }
     
    4041     */
    4142    public void put(HistoryOsmPrimitive primitive, ChangesetModificationType cmt) {
    42         CheckParameterUtil.ensureParameterNotNull(primitive,"primitive");
    43         CheckParameterUtil.ensureParameterNotNull(cmt,"cmt");
     43        CheckParameterUtil.ensureParameterNotNull(primitive, "primitive");
     44        CheckParameterUtil.ensureParameterNotNull(cmt, "cmt");
    4445        primitives.put(primitive.getPrimitiveId(), primitive);
    4546        modificationTypes.put(primitive.getPrimitiveId(), cmt);
     
    115116     */
    116117    public Set<HistoryOsmPrimitive> getPrimitivesByModificationType(ChangesetModificationType cmt) {
    117         CheckParameterUtil.ensureParameterNotNull(cmt,"cmt");
     118        CheckParameterUtil.ensureParameterNotNull(cmt, "cmt");
    118119        Set<HistoryOsmPrimitive> ret = new HashSet<>();
    119120        for (Entry<PrimitiveId, ChangesetModificationType> entry: modificationTypes.entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r8470 r8510  
    254254     */
    255255    public void addChangeSetTag(String k, String v) {
    256         this.changeSetTags.put(k,v);
     256        this.changeSetTags.put(k, v);
    257257    }
    258258
     
    526526     */
    527527    public static void addSelectionListener(SelectionChangedListener listener) {
    528         ((CopyOnWriteArrayList<SelectionChangedListener>)selListeners).addIfAbsent(listener);
     528        ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener);
    529529    }
    530530
     
    542542     *
    543543     */
    544     public void fireSelectionChanged(){
     544    public void fireSelectionChanged() {
    545545        Collection<? extends OsmPrimitive> currentSelection = getAllSelected();
    546546        for (SelectionChangedListener l : selListeners) {
     
    698698     */
    699699    public void setHighlightedVirtualNodes(Collection<WaySegment> waySegments) {
    700         if(highlightedVirtualNodes.isEmpty() && waySegments.isEmpty())
     700        if (highlightedVirtualNodes.isEmpty() && waySegments.isEmpty())
    701701            return;
    702702
     
    711711     */
    712712    public void setHighlightedWaySegments(Collection<WaySegment> waySegments) {
    713         if(highlightedWaySegments.isEmpty() && waySegments.isEmpty())
     713        if (highlightedWaySegments.isEmpty() && waySegments.isEmpty())
    714714            return;
    715715
     
    889889                List<Node> newNodes = new ArrayList<>();
    890890                for (Node n: w.getNodes()) {
    891                     newNodes.add((Node)primMap.get(n));
     891                    newNodes.add((Node) primMap.get(n));
    892892                }
    893893                newWay.setNodes(newNodes);
     
    903903            }
    904904            for (Relation r : relations) {
    905                 Relation newRelation = (Relation)primMap.get(r);
     905                Relation newRelation = (Relation) primMap.get(r);
    906906                List<RelationMember> newMembers = new ArrayList<>();
    907907                for (RelationMember rm: r.getMembers()) {
     
    10161016                Iterator<RelationMember> it = members.iterator();
    10171017                boolean removed = false;
    1018                 while(it.hasNext()) {
     1018                while (it.hasNext()) {
    10191019                    RelationMember member = it.next();
    10201020                    if (member.getMember().equals(primitive)) {
     
    10461046        try {
    10471047            if (referencedPrimitive instanceof Node) {
    1048                 result.addAll(unlinkNodeFromWays((Node)referencedPrimitive));
     1048                result.addAll(unlinkNodeFromWays((Node) referencedPrimitive));
    10491049            }
    10501050            result.addAll(unlinkPrimitiveFromRelations(referencedPrimitive));
     
    10781078        for (OsmPrimitive primitive: node.getReferrers()) {
    10791079            if (primitive instanceof Way) {
    1080                 reindexWay((Way)primitive);
     1080                reindexWay((Way) primitive);
    10811081            } else {
    10821082                reindexRelation((Relation) primitive);
     
    10941094        if (!way.getBBox().equals(before)) {
    10951095            for (OsmPrimitive primitive: way.getReferrers()) {
    1096                 reindexRelation((Relation)primitive);
     1096                reindexRelation((Relation) primitive);
    10971097            }
    10981098        }
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r8509 r8510  
    141141
    142142    protected void fixIncomplete(Way other) {
    143         Way myWay = (Way)getMergeTarget(other);
     143        Way myWay = (Way) getMergeTarget(other);
    144144        if (myWay == null)
    145145            throw new RuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId()));
     
    174174        do {
    175175            flag = false;
    176             for (Iterator<OsmPrimitive> it = objectsToDelete.iterator();it.hasNext();) {
     176            for (Iterator<OsmPrimitive> it = objectsToDelete.iterator(); it.hasNext();) {
    177177                OsmPrimitive target = it.next();
    178178                OsmPrimitive source = sourceDataSet.getPrimitiveById(target.getPrimitiveId());
     
    234234     */
    235235    private void mergeNodeList(Way source) {
    236         Way target = (Way)getMergeTarget(source);
     236        Way target = (Way) getMergeTarget(source);
    237237        if (target == null)
    238238            throw new IllegalStateException(tr("Missing merge target for way with id {0}", source.getUniqueId()));
     
    240240        List<Node> newNodes = new ArrayList<>(source.getNodesCount());
    241241        for (Node sourceNode : source.getNodes()) {
    242             Node targetNode = (Node)getMergeTarget(sourceNode);
     242            Node targetNode = (Node) getMergeTarget(sourceNode);
    243243            if (targetNode != null) {
    244244                newNodes.add(targetNode);
     
    363363            // this have to be resolved manually.
    364364            //
    365             addConflict(target,source);
     365            addConflict(target, source);
    366366        } else if (!target.hasEqualSemanticAttributes(source)) {
    367367            // target is modified and is not semantically equal with source. Can't automatically
    368368            // resolve the differences
    369369            // =>  create a conflict
    370             addConflict(target,source);
     370            addConflict(target, source);
    371371        } else {
    372372            // clone from other. mergeFrom will mainly copy
  • trunk/src/org/openstreetmap/josm/data/osm/DefaultChangesetCacheEvent.java

    r7005 r8510  
    2525        return Collections.unmodifiableCollection(added);
    2626    }
     27
    2728    @Override
    2829    public Collection<Changeset> getRemovedChangesets() {
    2930        return Collections.unmodifiableCollection(removed);
    3031    }
     32
    3133    @Override
    3234    public ChangesetCache getSource() {
    3335        return source;
    3436    }
     37
    3538    @Override
    3639    public Collection<Changeset> getUpdatedChangesets() {
  • trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java

    r8285 r8510  
    8585
    8686            Match compiled = SearchCompiler.compile(filter.text, filter.caseSensitive, filter.regexSearch);
    87             this.match = filter.inverted?new Not(compiled):compiled;
     87            this.match = filter.inverted ? new Not(compiled) : compiled;
    8888            this.isInverted = filter.inverted;
    8989        }
  • trunk/src/org/openstreetmap/josm/data/osm/Hash.java

    r6380 r8510  
    1111 * @author nenik
    1212 */
    13 public interface Hash<K,T> {
     13public interface Hash<K, T> {
    1414
    1515    /**
  • trunk/src/org/openstreetmap/josm/data/osm/INode.java

    r4126 r8510  
    88
    99    LatLon getCoor();
     10
    1011    void setCoor(LatLon coor);
     12
    1113    EastNorth getEastNorth();
     14
    1215    void setEastNorth(EastNorth eastNorth);
    1316}
  • trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java

    r6009 r8510  
    1212
    1313    boolean isModified();
     14
    1415    void setModified(boolean modified);
     16
    1517    boolean isVisible();
     18
    1619    void setVisible(boolean visible);
     20
    1721    boolean isDeleted();
     22
    1823    void setDeleted(boolean deleted);
     24
    1925    boolean isIncomplete();
     26
    2027    boolean isNewOrUndeleted();
     28
    2129    long getId();
     30
    2231    PrimitiveId getPrimitiveId();
     32
    2333    int getVersion();
     34
    2435    void setOsmId(long id, int version);
     36
    2537    User getUser();
     38
    2639    void setUser(User user);
     40
    2741    Date getTimestamp();
     42
    2843    void setTimestamp(Date timestamp);
     44
    2945    boolean isTimestampEmpty();
     46
    3047    int getChangesetId();
     48
    3149    void setChangesetId(int changesetId);
    3250
    3351    void accept(PrimitiveVisitor visitor);
     52
    3453    String getName();
     54
    3555    String getLocalName();
    36 
    3756}
  • trunk/src/org/openstreetmap/josm/data/osm/IRelation.java

    r4098 r8510  
    55
    66    int getMembersCount();
     7
    78    long getMemberId(int idx);
     9
    810    String getRole(int idx);
     11
    912    OsmPrimitiveType getMemberType(int idx);
    10 
    1113}
  • trunk/src/org/openstreetmap/josm/data/osm/IWay.java

    r4100 r8510  
    55
    66    int getNodesCount();
     7
    78    long getNodeId(int idx);
     9
    810    boolean isClosed();
    9 
    1011}
  • trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java

    r8509 r8510  
    203203            while (true) {
    204204                boolean curWayReverse = prevNode == curWay.lastNode();
    205                 Node nextNode = (curWayReverse) ? curWay.firstNode(): curWay.lastNode();
     205                Node nextNode = (curWayReverse) ? curWay.firstNode() : curWay.lastNode();
    206206
    207207                //add cur way to the list
     
    222222
    223223                Way nextWay = null;
    224                 for(Way way: adjacentWays) {
     224                for (Way way: adjacentWays) {
    225225                    if (way != curWay) {
    226226                        nextWay = way;
     
    306306        final int noBuckets = (boundaryWays.size() + bucketsize - 1) / bucketsize;
    307307        final boolean singleThread = THREAD_POOL.a == 1 || noBuckets == 1;
    308         for (int i=0; i<noBuckets; i++) {
     308        for (int i = 0; i < noBuckets; i++) {
    309309            int from = i*bucketsize;
    310310            int to = Math.min((i+1)*bucketsize, boundaryWays.size());
     
    404404        @Override
    405405        public List<PolygonLevel> call() throws Exception {
    406             for (int i = from; i<to; i++) {
     406            for (int i = from; i < to; i++) {
    407407                if (processOuterWay(0, input, output, input.get(i)) == null) {
    408408                    return null;
  • trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java

    r4431 r8510  
    66public interface NameFormatter {
    77    String format(Node node);
     8
    89    String format(Way way);
     10
    911    String format(Relation relation);
     12
    1013    String format(Changeset changeset);
    1114
    1215    Comparator<Node> getNodeComparator();
     16
    1317    Comparator<Way> getWayComparator();
     18
    1419    Comparator<Relation> getRelationComparator();
    1520}
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r8509 r8510  
    7070    public final LatLon getCoor() {
    7171        if (!isLatLonKnown()) return null;
    72         return new LatLon(lat,lon);
     72        return new LatLon(lat, lon);
    7373    }
    7474
     
    223223        try {
    224224            super.cloneFrom(osm);
    225             setCoor(((Node)osm).getCoor());
     225            setCoor(((Node) osm).getCoor());
    226226        } finally {
    227227            writeUnlock(locked);
     
    246246            super.mergeFrom(other);
    247247            if (!other.isIncomplete()) {
    248                 setCoor(((Node)other).getCoor());
     248                setCoor(((Node) other).getCoor());
    249249            }
    250250        } finally {
     
    257257        try {
    258258            super.load(data);
    259             setCoor(((NodeData)data).getCoor());
     259            setCoor(((NodeData) data).getCoor());
    260260        } finally {
    261261            writeUnlock(locked);
     
    284284        if (!super.hasEqualSemanticAttributes(other))
    285285            return false;
    286         Node n = (Node)other;
     286        Node n = (Node) other;
    287287        LatLon coor = getCoor();
    288288        LatLon otherCoor = n.getCoor();
  • trunk/src/org/openstreetmap/josm/data/osm/NodeData.java

    r8415 r8510  
    3737    @Override
    3838    public LatLon getCoor() {
    39         return isLatLonKnown() ? new LatLon(lat,lon) : null;
     39        return isLatLonKnown() ? new LatLon(lat, lon) : null;
    4040    }
    4141
  • trunk/src/org/openstreetmap/josm/data/osm/NoteData.java

    r8474 r8510  
    193193     */
    194194    public synchronized void createNote(LatLon location, String text) {
    195         if(text == null || text.isEmpty()) {
     195        if (text == null || text.isEmpty()) {
    196196            throw new IllegalArgumentException("Comment can not be blank when creating a note");
    197197        }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r8509 r8510  
    122122        if (list == null) return Collections.emptyList();
    123123        List<T> ret = new LinkedList<>();
    124         for(OsmPrimitive p: list) {
     124        for (OsmPrimitive p: list) {
    125125            if (type.isInstance(p)) {
    126126                ret.add(type.cast(p));
     
    144144        Set<T> ret = new LinkedHashSet<>();
    145145        if (set != null) {
    146             for(OsmPrimitive p: set) {
     146            for (OsmPrimitive p: set) {
    147147                if (type.isInstance(p)) {
    148148                    ret.add(type.cast(p));
     
    626626
    627627    private boolean isOuterMemberOfMultipolygon(OsmPrimitive ref) {
    628         if (ref instanceof Relation && ref.isSelected() && ((Relation)ref).isMultipolygon()) {
    629             for (RelationMember rm : ((Relation)ref).getMembersFor(Collections.singleton(this))) {
     628        if (ref instanceof Relation && ref.isSelected() && ((Relation) ref).isMultipolygon()) {
     629            for (RelationMember rm : ((Relation) ref).getMembersFor(Collections.singleton(this))) {
    630630                if ("outer".equals(rm.getRole())) {
    631631                    return true;
     
    965965        } else if (referrers instanceof OsmPrimitive) {
    966966            if (referrers != referrer) {
    967                 referrers = new OsmPrimitive[] {(OsmPrimitive)referrers, referrer};
     967                referrers = new OsmPrimitive[] {(OsmPrimitive) referrers, referrer};
    968968            }
    969969        } else {
    970             for (OsmPrimitive primitive:(OsmPrimitive[])referrers) {
     970            for (OsmPrimitive primitive:(OsmPrimitive[]) referrers) {
    971971                if (primitive == referrer)
    972972                    return;
    973973            }
    974             referrers = Utils.addInArrayCopy((OsmPrimitive[])referrers, referrer);
     974            referrers = Utils.addInArrayCopy((OsmPrimitive[]) referrers, referrer);
    975975        }
    976976    }
     
    986986            }
    987987        } else if (referrers instanceof OsmPrimitive[]) {
    988             OsmPrimitive[] orig = (OsmPrimitive[])referrers;
     988            OsmPrimitive[] orig = (OsmPrimitive[]) referrers;
    989989            int idx = -1;
    990             for (int i=0; i<orig.length; i++) {
     990            for (int i = 0; i < orig.length; i++) {
    991991                if (orig[i] == referrer) {
    992992                    idx = i;
     
    10341034        if (referrers != null) {
    10351035            if (referrers instanceof OsmPrimitive) {
    1036                 OsmPrimitive ref = (OsmPrimitive)referrers;
     1036                OsmPrimitive ref = (OsmPrimitive) referrers;
    10371037                if (ref.dataSet == dataSet) {
    10381038                    result.add(ref);
    10391039                }
    10401040            } else {
    1041                 for (OsmPrimitive o:(OsmPrimitive[])referrers) {
     1041                for (OsmPrimitive o:(OsmPrimitive[]) referrers) {
    10421042                    if (dataSet == o.dataSet) {
    10431043                        result.add(o);
     
    10581058     * @param visitor the visitor. Ignored, if null.
    10591059     */
    1060     public void visitReferrers(Visitor visitor){
     1060    public void visitReferrers(Visitor visitor) {
    10611061        if (visitor == null) return;
    10621062        if (this.referrers == null)
     
    10881088        checkDataset();
    10891089        if (referrers instanceof OsmPrimitive)
    1090             return n<=1 && referrers instanceof Way && ((OsmPrimitive)referrers).dataSet == dataSet;
     1090            return n <= 1 && referrers instanceof Way && ((OsmPrimitive) referrers).dataSet == dataSet;
    10911091        else {
    1092             int counter=0;
    1093             for (OsmPrimitive o : (OsmPrimitive[])referrers) {
     1092            int counter = 0;
     1093            for (OsmPrimitive o : (OsmPrimitive[]) referrers) {
    10941094                if (dataSet == o.dataSet && o instanceof Way) {
    10951095                    if (++counter >= n)
     
    11001100        }
    11011101    }
    1102 
    11031102
    11041103    /*-----------------
     
    11531152            setIncomplete(other.isIncomplete());
    11541153            flags = other.flags;
    1155             user= other.user;
     1154            user = other.user;
    11561155            changesetId = other.changesetId;
    11571156        } finally {
     
    12181217                && version == other.version
    12191218                && isVisible() == other.isVisible()
    1220                 && (user == null ? other.user==null : user==other.user)
     1219                && (user == null ? other.user == null : user == other.user)
    12211220                && changesetId == other.changesetId;
    12221221    }
     
    13051304     * An primitive is equal to its incomplete counter part.
    13061305     */
    1307     @Override public boolean equals(Object obj) {
     1306    @Override
     1307    public boolean equals(Object obj) {
    13081308        if (obj instanceof OsmPrimitive)
    1309             return ((OsmPrimitive)obj).id == id && obj.getClass() == getClass();
     1309            return ((OsmPrimitive) obj).id == id && obj.getClass() == getClass();
    13101310        return false;
    13111311    }
     
    13161316     * An primitive has the same hashcode as its incomplete counterpart.
    13171317     */
    1318     @Override public final int hashCode() {
    1319         return (int)id;
     1318    @Override
     1319    public final int hashCode() {
     1320        return (int) id;
    13201321    }
    13211322
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java

    r7865 r8510  
    6666    public static OsmPrimitiveType from(String value) {
    6767        if (value == null) return null;
    68         for (OsmPrimitiveType type: values()){
     68        for (OsmPrimitiveType type: values()) {
    6969            if (type.getAPIName().equalsIgnoreCase(value))
    7070                return type;
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r8390 r8510  
    3030
    3131    public static Boolean getOsmBoolean(String value) {
    32         if(value == null) return null;
     32        if (value == null) return null;
    3333        String lowerValue = value.toLowerCase(Locale.ENGLISH);
    3434        if (TRUE_VALUES.contains(lowerValue)) return Boolean.TRUE;
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java

    r7005 r8510  
    5656    public static <T extends PrimitiveData> List<T> getFilteredList(Collection<T> list, OsmPrimitiveType type) {
    5757        List<T> ret = new ArrayList<>();
    58         for(PrimitiveData p: list) {
     58        for (PrimitiveData p: list) {
    5959            if (type.getDataClass().isInstance(p)) {
    60                 ret.add((T)p);
     60                ret.add((T) p);
    6161            }
    6262        }
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveDeepCopy.java

    r8285 r8510  
    6464                (firstIteration ? directlyAdded : referenced).add(n.save());
    6565            }
     66
    6667            @Override
    6768            public void visit(Way w) {
     
    7475                }
    7576            }
     77
    7678            @Override
    7779            public void visit(Relation r) {
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r8375 r8510  
    179179
    180180        boolean matches(final T o, final BBox search_bbox) {
    181             if (o instanceof Node){
    182                 final LatLon latLon = ((Node)o).getCoor();
     181            if (o instanceof Node) {
     182                final LatLon latLon = ((Node) o).getCoor();
    183183                // node without coords -> bbox[0,0,0,0]
    184184                return search_bbox.bounds(latLon != null ? latLon : LatLon.ZERO);
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r8509 r8510  
    232232            super.cloneFrom(osm);
    233233            // It's not necessary to clone members as RelationMember class is immutable
    234             setMembers(((Relation)osm).getMembers());
     234            setMembers(((Relation) osm).getMembers());
    235235        } finally {
    236236            writeUnlock(locked);
     
    295295        if (!super.hasEqualSemanticAttributes(other))
    296296            return false;
    297         Relation r = (Relation)other;
     297        Relation r = (Relation) other;
    298298        return Arrays.equals(members, r.members);
    299299    }
     
    460460            BBox result = null;
    461461            for (RelationMember rm:members) {
    462                 BBox box = rm.isRelation()?rm.getRelation().calculateBBox(visitedRelations):rm.getMember().getBBox();
     462                BBox box = rm.isRelation() ? rm.getRelation().calculateBBox(visitedRelations) : rm.getMember().getBBox();
    463463                if (box != null) {
    464464                    if (result == null) {
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java

    r8291 r8510  
    9494     */
    9595    public Relation getRelation() {
    96         return (Relation)member;
     96        return (Relation) member;
    9797    }
    9898
     
    103103     */
    104104    public Way getWay() {
    105         return (Way)member;
     105        return (Way) member;
    106106    }
    107107
     
    112112     */
    113113    public Node getNode() {
    114         return (Node)member;
     114        return (Node) member;
    115115    }
    116116
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java

    r6830 r8510  
    99
    1010    public RelationMemberData(String role, OsmPrimitiveType type, long id) {
    11         this.role = role == null?"":role;
     11        this.role = role == null ? "" : role;
    1212        this.memberType = type;
    1313        this.memberId = id;
  • trunk/src/org/openstreetmap/josm/data/osm/RelationToChildReference.java

    r7005 r8510  
    1818        Set<RelationToChildReference> references = new HashSet<>();
    1919        for (Relation parent: parents) {
    20             for (int i=0; i < parent.getMembersCount(); i++) {
     20            for (int i = 0; i < parent.getMembersCount(); i++) {
    2121                if (parent.getMember(i).refersTo(child)) {
    2222                    references.add(new RelationToChildReference(parent, i, parent.getMember(i)));
     
    8787        return result;
    8888    }
     89
    8990    @Override
    9091    public boolean equals(Object obj) {
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r8470 r8510  
    7575        @Override
    7676        public int getHashCode(PrimitiveId k) {
    77             return (int)k.getUniqueId() ^ k.getType().hashCode();
     77            return (int) k.getUniqueId() ^ k.getType().hashCode();
    7878        }
    7979
     
    8585    }
    8686
    87     private final Hash<? super T,? super T> hash;
     87    private final Hash<? super T, ? super T> hash;
    8888    private T[] data;
    8989    private int mask;
     
    109109    }
    110110
    111     public Storage(Hash<? super T,? super T> ha) {
     111    public Storage(Hash<? super T, ? super T> ha) {
    112112        this(ha, DEFAULT_CAPACITY, false);
    113113    }
     
    121121    }
    122122
    123     public Storage(Hash<? super T,? super T> ha, boolean safeIterator) {
     123    public Storage(Hash<? super T, ? super T> ha, boolean safeIterator) {
    124124        this(ha, DEFAULT_CAPACITY, safeIterator);
    125125    }
     
    140140    public Storage(Hash<? super T, ? super T> ha, int capacity, boolean safeIterator) {
    141141        this.hash = ha;
    142         int cap = 1 << (int)(Math.ceil(Math.log(capacity/loadFactor) / Math.log(2)));
     142        int cap = 1 << (int) (Math.ceil(Math.log(capacity/loadFactor) / Math.log(2)));
    143143        @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap];
    144144        data = newData;
     
    195195        modCount++;
    196196        size = 0;
    197         for (int i = 0; i<data.length; i++) {
     197        for (int i = 0; i < data.length; i++) {
    198198            data[i] = null;
    199199        }
     
    257257    }
    258258
    259     public <K> Map<K,T> foreignKey(Hash<K,? super T> h) {
     259    public <K> Map<K, T> foreignKey(Hash<K, ? super T> h) {
    260260        return new FMap<>(h);
    261261    }
     
    278278     * where such an entry can be stored.
    279279     */
    280     private <K> int getBucket(Hash<K,? super T> ha, K key) {
     280    private <K> int getBucket(Hash<K, ? super T> ha, K key) {
    281281        T entry;
    282282        int hcode = rehash(ha.getHashCode(key));
     
    309309            // because the entry safely belongs to <previous_null+1,hole>
    310310            if ((bucket < right && (right <= hole || hole <= bucket)) ||
    311                     (right <=hole && hole <= bucket)) {
     311                    (right <= hole && hole <= bucket)) {
    312312
    313313                data[hole] = data[bucket];
     
    348348     * hashCode and equals.
    349349     */
    350     public static <O> Hash<O,O> defaultHash() {
    351         return new Hash<O,O>() {
     350    public static <O> Hash<O, O> defaultHash() {
     351        return new Hash<O, O>() {
    352352            @Override
    353353            public int getHashCode(O t) {
    354354                return t.hashCode();
    355355            }
     356
    356357            @Override
    357358            public boolean equals(O t1, O t2) {
     
    373374     */
    374375
    375     private final class FMap<K> implements Map<K,T> {
    376         private Hash<K,? super T> fHash;
    377 
    378         private FMap(Hash<K,? super T> h) {
     376    private final class FMap<K> implements Map<K, T> {
     377        private Hash<K, ? super T> fHash;
     378
     379        private FMap(Hash<K, ? super T> h) {
    379380            fHash = h;
    380381        }
     
    488489    }
    489490
    490 
    491491    private final class Iter implements Iterator<T> {
    492492        private final int mods;
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r8444 r8510  
    7373     * @return the tag collection
    7474     */
    75     public static TagCollection from(Map<String,String> tags) {
     75    public static TagCollection from(Map<String, String> tags) {
    7676        TagCollection ret = new TagCollection();
    7777        if (tags == null) return ret;
    78         for (Entry<String,String> entry: tags.entrySet()) {
    79             String key = entry.getKey() == null? "" : entry.getKey();
     78        for (Entry<String, String> entry: tags.entrySet()) {
     79            String key = entry.getKey() == null ? "" : entry.getKey();
    8080            String value = entry.getValue() == null ? "" : entry.getValue();
    81             ret.add(new Tag(key,value));
     81            ret.add(new Tag(key, value));
    8282        }
    8383        return ret;
     
    199199     * @param tag the tag to add
    200200     */
    201     public final void add(Tag tag){
     201    public final void add(Tag tag) {
    202202        if (tag == null) return;
    203203        if (tags.contains(tag)) return;
     
    213213    public final void add(Collection<Tag> tags) {
    214214        if (tags == null) return;
    215         for (Tag tag: tags){
     215        for (Tag tag: tags) {
    216216            add(tag);
    217217        }
     
    269269     */
    270270    public void removeByKey(String key) {
    271         if (key  == null) return;
     271        if (key == null) return;
    272272        Iterator<Tag> it = tags.iterator();
    273         while(it.hasNext()) {
     273        while (it.hasNext()) {
    274274            if (it.next().matchesKey(key)) {
    275275                it.remove();
     
    461461        if (keys == null)
    462462            return ret;
    463         for(String key : keys) {
     463        for (String key : keys) {
    464464            if (key != null) {
    465465                ret.add(getTagsFor(key));
     
    520520        for (Tag tag: tags) {
    521521            Integer v = counters.get(tag.getKey());
    522             counters.put(tag.getKey(),(v==null) ? 1 : v+1);
     522            counters.put(tag.getKey(), (v == null) ? 1 : v+1);
    523523        }
    524524        Set<String> ret = new HashSet<>();
     
    718718    public TagCollection emptyTagsForKeysMissingIn(TagCollection other) {
    719719        TagCollection ret = new TagCollection();
    720         for(String key: this.minus(other).getKeys()) {
     720        for (String key: this.minus(other).getKeys()) {
    721721            ret.add(new Tag(key));
    722722        }
     
    778778    }
    779779
    780 
    781780    @Override
    782781    public String toString() {
  • trunk/src/org/openstreetmap/josm/data/osm/Tagged.java

    r3083 r8510  
    1717     * @param keys the map of key value pairs. If null, reset to the empty map.
    1818     */
    19     void setKeys(Map<String,String> keys);
     19    void setKeys(Map<String, String> keys);
    2020
    2121    /**
     
    2424     * @return the map of key/value pairs
    2525     */
    26     Map<String,String> getKeys();
     26    Map<String, String> getKeys();
    2727
    2828    /**
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r8470 r8510  
    2929     * the map of known users
    3030     */
    31     private static Map<Long,User> userMap = new HashMap<>();
     31    private static Map<Long, User> userMap = new HashMap<>();
    3232
    3333    /**
     
    4949     */
    5050    public static synchronized User createLocalUser(String name) {
    51         for(long i = -1; i >= uidCounter; --i) {
     51        for (long i = -1; i >= uidCounter; --i) {
    5252            User olduser = getById(i);
    53             if(olduser != null && olduser.hasName(name))
     53            if (olduser != null && olduser.hasName(name))
    5454                return olduser;
    5555        }
  • trunk/src/org/openstreetmap/josm/data/osm/UserInfo.java

    r6349 r8510  
    3535        return id;
    3636    }
     37
    3738    public void setId(int id) {
    3839        this.id = id;
    3940    }
     41
    4042    public String getDisplayName() {
    4143        return displayName;
    4244    }
     45
    4346    public void setDisplayName(String displayName) {
    4447        this.displayName = displayName;
    4548    }
     49
    4650    public Date getAccountCreated() {
    4751        return accountCreated;
    4852    }
     53
    4954    public void setAccountCreated(Date accountCreated) {
    5055        this.accountCreated = accountCreated;
    5156    }
     57
    5258    public LatLon getHome() {
    5359        return home;
    5460    }
     61
    5562    public void setHome(LatLon home) {
    5663        this.home = home;
    5764    }
     65
    5866    public String getDescription() {
    5967        return description;
    6068    }
     69
    6170    public void setDescription(String description) {
    6271        this.description = description;
    6372    }
     73
    6474    public List<String> getLanguages() {
    6575        return languages;
    6676    }
     77
    6778    public void setLanguages(List<String> languages) {
    6879        this.languages = languages;
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r8509 r8510  
    8484        Node last = null;
    8585        int count = nodes.size();
    86         for(int i = 0; i < count && count > 2;) {
     86        for (int i = 0; i < count && count > 2;) {
    8787            Node n = nodes.get(i);
    88             if(last == n) {
     88            if (last == n) {
    8989                nodes.remove(i);
    9090                --count;
     
    173173
    174174        Node[] nodes = this.nodes;
    175         for (int i=0; i<nodes.length; i++) {
     175        for (int i = 0; i < nodes.length; i++) {
    176176            if (nodes[i].equals(node)) {
    177177                if (i > 0)
     
    192192     * @since 3348
    193193     */
    194     public List<Pair<Node,Node>> getNodePairs(boolean sort) {
    195         List<Pair<Node,Node>> chunkSet = new ArrayList<>();
     194    public List<Pair<Node, Node>> getNodePairs(boolean sort) {
     195        List<Pair<Node, Node>> chunkSet = new ArrayList<>();
    196196        if (isIncomplete()) return chunkSet;
    197197        Node lastN = null;
     
    202202                continue;
    203203            }
    204             Pair<Node,Node> np = new Pair<>(lastN, n);
     204            Pair<Node, Node> np = new Pair<>(lastN, n);
    205205            if (sort) {
    206206                Pair.sort(np);
     
    293293            List<Node> newNodes = new ArrayList<>(wayData.getNodes().size());
    294294            for (Long nodeId : wayData.getNodes()) {
    295                 Node node = (Node)getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE);
     295                Node node = (Node) getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE);
    296296                if (node != null) {
    297297                    newNodes.add(node);
     
    321321        try {
    322322            super.cloneFrom(osm);
    323             Way otherWay = (Way)osm;
     323            Way otherWay = (Way) osm;
    324324            setNodes(otherWay.getNodes());
    325325        } finally {
     
    330330    @Override
    331331    public String toString() {
    332         String nodesDesc = isIncomplete()?"(incomplete)":"nodes=" + Arrays.toString(nodes);
     332        String nodesDesc = isIncomplete() ? "(incomplete)" : "nodes=" + Arrays.toString(nodes);
    333333        return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString()  + " " + nodesDesc + "}";
    334334    }
     
    340340        if (!super.hasEqualSemanticAttributes(other))
    341341            return false;
    342         Way w = (Way)other;
     342        Way w = (Way) other;
    343343        if (getNodesCount() != w.getNodesCount()) return false;
    344         for (int i=0; i<getNodesCount(); i++) {
     344        for (int i = 0; i < getNodesCount(); i++) {
    345345            if (!getNode(i).hasEqualSemanticAttributes(w.getNode(i)))
    346346                return false;
     
    426426     */
    427427    public void addNode(Node n) {
    428         if (n==null) return;
     428        if (n == null) return;
    429429
    430430        boolean locked = writeLock();
     
    453453     */
    454454    public void addNode(int offs, Node n) throws IndexOutOfBoundsException {
    455         if (n==null) return;
     455        if (n == null) return;
    456456
    457457        boolean locked = writeLock();
     
    510510        if (this.nodes.length >= 4 && isClosed()) {
    511511            Node distinctNode = null;
    512             for (int i=1; i<nodes.length-1; i++) {
     512            for (int i = 1; i < nodes.length-1; i++) {
    513513                if (distinctNode == null && nodes[i] != nodes[0]) {
    514514                    distinctNode = nodes[i];
  • trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java

    r7509 r8510  
    4242     * @return the second node
    4343     */
    44     public Node getSecondNode(){
     44    public Node getSecondNode() {
    4545        return way.getNode(lowerIndex + 1);
    4646    }
  • trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java

    r8509 r8510  
    122122        @Override
    123123        public boolean equals(Object o) {
    124             return o instanceof ListenerInfo && ((ListenerInfo)o).listener == listener;
     124            return o instanceof ListenerInfo && ((ListenerInfo) o).listener == listener;
    125125        }
    126126    }
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r8285 r8510  
    4040        @Override
    4141        public boolean equals(Object o) {
    42             return o instanceof ListenerInfo && ((ListenerInfo)o).listener == listener;
     42            return o instanceof ListenerInfo && ((ListenerInfo) o).listener == listener;
    4343        }
    4444    }
  • trunk/src/org/openstreetmap/josm/data/osm/history/History.java

    r8390 r8510  
    3232            }
    3333        }
    34         return new History(history.id, history.type,out);
     34        return new History(history.id, history.type, out);
    3535    }
    3636
     
    9696                }
    9797            );
    98         return new History(id, type,copy);
     98        return new History(id, type, copy);
    9999    }
    100100
     
    232232    public boolean contains(long version) {
    233233        for (HistoryOsmPrimitive primitive: versions) {
    234             if (primitive.matches(id,version))
     234            if (primitive.matches(id, version))
    235235                return true;
    236236        }
     
    247247    public HistoryOsmPrimitive getByVersion(long version) {
    248248        for (HistoryOsmPrimitive primitive: versions) {
    249             if (primitive.matches(id,version))
     249            if (primitive.matches(id, version))
    250250                return primitive;
    251251        }
     
    265265        if (h.versions.isEmpty())
    266266            return null;
    267         if (h.get(0).getTimestamp().compareTo(date)> 0)
     267        if (h.get(0).getTimestamp().compareTo(date) > 0)
    268268            return null;
    269         for (int i = 1; i < h.versions.size();i++) {
     269        for (int i = 1; i < h.versions.size(); i++) {
    270270            if (h.get(i-1).getTimestamp().compareTo(date) <= 0
    271271                    && h.get(i).getTimestamp().compareTo(date) >= 0)
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java

    r8413 r8510  
    9090     * type <code>type</code>, and version <code>version</code>
    9191     */
    92     public HistoryOsmPrimitive get(long id, OsmPrimitiveType type, long version){
     92    public HistoryOsmPrimitive get(long id, OsmPrimitiveType type, long version) {
    9393        if (id <= 0)
    9494            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected, got {1}", "id", id));
     
    204204        /* irrelevant in this context */
    205205    }
     206
    206207    @Override
    207208    public void layerAdded(Layer newLayer) {
    208209        /* irrelevant in this context */
    209210    }
     211
    210212    @Override
    211213    public void layerRemoved(Layer oldLayer) {
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNameFormatter.java

    r3083 r8510  
    44public interface HistoryNameFormatter {
    55    String format(HistoryNode node);
     6
    67    String format(HistoryWay node);
     8
    79    String format(HistoryRelation node);
    810}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r8376 r8510  
    128128        return visible;
    129129    }
     130
    130131    public User getUser() {
    131132        return user;
    132133    }
     134
    133135    public long getChangesetId() {
    134136        return changesetId;
    135137    }
     138
    136139    public Date getTimestamp() {
    137140        return timestamp;
     
    171174    }
    172175
    173     public Map<String,String> getTags() {
     176    public Map<String, String> getTags() {
    174177        return Collections.unmodifiableMap(tags);
    175178    }
     
    189192     * @param tags the tags. May be null.
    190193     */
    191     public void setTags(Map<String,String> tags) {
     194    public void setTags(Map<String, String> tags) {
    192195        if (tags == null) {
    193196            this.tags = new HashMap<>();
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java

    r8291 r8510  
    112112    public RelationMemberData getRelationMember(int idx) throws IndexOutOfBoundsException  {
    113113        if (idx < 0 || idx >= members.size())
    114             throw new IndexOutOfBoundsException(MessageFormat.format("Parameter {0} not in range 0..{1}. Got ''{2}''.", "idx", members.size(),idx));
     114            throw new IndexOutOfBoundsException(
     115                    MessageFormat.format("Parameter {0} not in range 0..{1}. Got ''{2}''.", "idx", members.size(), idx));
    115116        return members.get(idx);
    116117    }
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java

    r8291 r8510  
    9999    public long getNodeId(int idx) throws IndexOutOfBoundsException {
    100100        if (idx < 0 || idx >= nodeIds.size())
    101             throw new IndexOutOfBoundsException(tr("Parameter {0} not in range 0..{1}. Got ''{2}''.", "idx", nodeIds.size(),idx));
     101            throw new IndexOutOfBoundsException(tr("Parameter {0} not in range 0..{1}. Got ''{2}''.", "idx", nodeIds.size(), idx));
    102102        return nodeIds.get(idx);
    103103    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r8470 r8510  
    6565        if (latlon != null) {
    6666            if (latlon instanceof CachedLatLon) {
    67                 visit(((CachedLatLon)latlon).getEastNorth());
     67                visit(((CachedLatLon) latlon).getEastNorth());
    6868            } else {
    6969                visit(Main.getProjection().latlon2eastNorth(latlon));
     
    179179    }
    180180
    181 
    182     @Override public String toString() {
     181    @Override
     182    public String toString() {
    183183        return "BoundingXYVisitor["+bounds+"]";
    184184    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r8291 r8510  
    9595        RelationData clone;
    9696        if (isAlreadyRemembered(r)) {
    97             clone = (RelationData)mappedPrimitives.get(r);
     97            clone = (RelationData) mappedPrimitives.get(r);
    9898        } else {
    9999            clone = r.save();
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java

    r8509 r8510  
    7777            } else {
    7878                long x = 0, y = 0;
    79                 outcodeOut = outcode0 != 0 ? outcode0: outcode1;
     79                outcodeOut = outcode0 != 0 ? outcode0 : outcode1;
    8080                if ((outcodeOut & OUT_TOP) > 0) {
    8181                    x = x1 + (x2 - x1) * (ymax - y1)/(y2 - y1);
     
    8484                    x = x1 + (x2 - x1) * (ymin - y1)/(y2 - y1);
    8585                    y = ymin;
    86                 } else if ((outcodeOut & OUT_RIGHT)> 0) {
     86                } else if ((outcodeOut & OUT_RIGHT) > 0) {
    8787                    y = y1 + (y2 - y1) * (xmax - x1)/(x2 - x1);
    8888                    x = xmax;
     
    104104        while (!done);
    105105
    106         if(accept) {
     106        if (accept) {
    107107            p1 = new Point((int) x1, (int) y1);
    108108            p2 = new Point((int) x2, (int) y2);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java

    r8509 r8510  
    121121    }
    122122
    123     private void activateMapRenderer(String rendererClassName){
     123    private void activateMapRenderer(String rendererClassName) {
    124124        Class<?> c = loadRendererClass(rendererClassName);
    125         if (c == null){
     125        if (c == null) {
    126126            Main.error(tr("Can''t activate map renderer class ''{0}'', because the class wasn''t found.", rendererClassName));
    127127            Main.error(tr("Activating the standard map renderer instead."));
     
    208208        if (!isRegistered(renderer)) return;
    209209        Iterator<Descriptor> it = descriptors.iterator();
    210         while(it.hasNext()) {
     210        while (it.hasNext()) {
    211211            Descriptor d = it.next();
    212212            if (d.getRenderer().getName().equals(renderer.getName())) {
     
    262262     */
    263263    public AbstractMapRenderer createActiveRenderer(Graphics2D g, NavigatableComponent viewport, boolean isInactiveMode)
    264             throws MapRendererFactoryException{
     264            throws MapRendererFactoryException {
    265265        try {
    266266            Constructor<?> c = activeRenderer.getConstructor(new Class<?>[]{Graphics2D.class, NavigatableComponent.class, boolean.class});
    267267            return AbstractMapRenderer.class.cast(c.newInstance(g, viewport, isInactiveMode));
    268         } catch(NoSuchMethodException | IllegalArgumentException | InstantiationException | IllegalAccessException e){
     268        } catch (NoSuchMethodException | IllegalArgumentException | InstantiationException | IllegalAccessException e) {
    269269            throw new MapRendererFactoryException(e);
    270270        } catch (InvocationTargetException e) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java

    r8126 r8510  
    2121    CONNECTION(marktr("Node: connection"), Color.yellow),
    2222    TAGGED(marktr("Node: tagged"), new Color(204, 255, 255)), // light cyan
    23     DEFAULT_WAY(marktr("way"),  new Color(0,0,128)), // dark blue
    24     RELATION(marktr("relation"), new Color(0,128,128)), // teal
    25     UNTAGGED_WAY(marktr("untagged way"), new Color(0,128,0)), // dark green
     23    DEFAULT_WAY(marktr("way"),  new Color(0, 0, 128)), // dark blue
     24    RELATION(marktr("relation"), new Color(0, 128, 128)), // teal
     25    UNTAGGED_WAY(marktr("untagged way"), new Color(0, 128, 0)), // dark green
    2626    BACKGROUND(marktr("background"), Color.BLACK),
    2727    HIGHLIGHT(marktr("highlight"), SELECTED.get()),
    2828    HIGHLIGHT_WIREFRAME(marktr("highlight wireframe"), Color.orange),
    2929
    30     UNTAGGED(marktr("untagged"),Color.GRAY),
     30    UNTAGGED(marktr("untagged"), Color.GRAY),
    3131    TEXT(marktr("text"), Color.WHITE),
    3232    AREA_TEXT(marktr("areatext"), Color.LIGHT_GRAY);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r8509 r8510  
    149149            int yCurrent0 = current.y - (int) Math.round(offset * dxNext / lenNext);
    150150
    151             if (idx==0) {
     151            if (idx == 0) {
    152152                ++idx;
    153153                prev = current;
     
    172172                int m = dxNext*(yCurrent0 - yPrev0) - dyNext*(xCurrent0 - xPrev0);
    173173
    174                 int cx = xPrev0 + (int) Math.round((double)m * dxPrev / det);
    175                 int cy = yPrev0 + (int) Math.round((double)m * dyPrev / det);
     174                int cx = xPrev0 + (int) Math.round((double) m * dxPrev / det);
     175                int cy = yPrev0 + (int) Math.round((double) m * dyPrev / det);
    176176                ++idx;
    177177                prev = current;
     
    238238    }
    239239
    240     private static Map<Font,Boolean> IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = new HashMap<>();
     240    private static Map<Font, Boolean> IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = new HashMap<>();
    241241
    242242    /**
     
    335335        super(g, nc, isInactiveMode);
    336336
    337         if (nc!=null) {
     337        if (nc != null) {
    338338            Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
    339339            useWiderHighlight = !(focusOwner instanceof AbstractButton || focusOwner == nc);
     
    364364        g.draw(path);
    365365
    366         if(!isInactiveMode && useStrokes && dashes != null) {
     366        if (!isInactiveMode && useStrokes && dashes != null) {
    367367            g.setColor(dashedColor);
    368368            g.setStroke(dashes);
     
    486486                final double h = pb.height - nb.getHeight();
    487487
    488                 final int x2 = pb.x + (int)(w/2.0);
    489                 final int y2 = pb.y + (int)(h/2.0);
     488                final int x2 = pb.x + (int) (w/2.0);
     489                final int y2 = pb.y + (int) (h/2.0);
    490490
    491491                final int nbw = (int) nb.getWidth();
     
    498498                if (!labelOK) {
    499499                    // if center position (C) is not inside osm shape, try naively some other positions as follows:
    500                     final int x1 = pb.x + (int)w/4.0);
    501                     final int x3 = pb.x + (int)(3*w/4.0);
    502                     final int y1 = pb.y + (int)h/4.0);
    503                     final int y3 = pb.y + (int)(3*h/4.0);
     500                    final int x1 = pb.x + (int)   (w/4.0);
     501                    final int x3 = pb.x + (int) (3*w/4.0);
     502                    final int y1 = pb.y + (int)   (h/4.0);
     503                    final int y3 = pb.y + (int) (3*h/4.0);
    504504                    // +-----------+
    505505                    // |  5  1  6  |
     
    526526                if (labelOK) {
    527527                    Font defaultFont = g.getFont();
    528                     int x = (int)(centeredNBounds.getMinX() - nb.getMinX());
    529                     int y = (int)(centeredNBounds.getMinY() - nb.getMinY());
     528                    int x = (int) (centeredNBounds.getMinX() - nb.getMinX());
     529                    int y = (int) (centeredNBounds.getMinY() - nb.getMinY());
    530530                    displayText(null, name, x, y, osm.isDisabled(), text);
    531531                    g.setFont(defaultFont);
     
    707707    @Override
    708708    public void drawNode(Node n, Color color, int size, boolean fill) {
    709         if(size <= 0 && !n.isHighlighted())
     709        if (size <= 0 && !n.isHighlighted())
    710710            return;
    711711
    712712        Point p = nc.getPoint(n);
    713713
    714         if(n.isHighlighted()) {
     714        if (n.isHighlighted()) {
    715715            drawPointHighlight(p, size);
    716716        }
     
    737737
    738738        final int w = img.getWidth(), h = img.getHeight();
    739         if(n.isHighlighted()) {
     739        if (n.isHighlighted()) {
    740740            drawPointHighlight(p, Math.max(w, h));
    741741        }
     
    768768        int radius = s.size / 2;
    769769
    770         if(n.isHighlighted()) {
     770        if (n.isHighlighted()) {
    771771            drawPointHighlight(p, s.size);
    772772        }
     
    861861     */
    862862    private void drawPathHighlight(GeneralPath path, BasicStroke line) {
    863         if(path == null)
     863        if (path == null)
    864864            return;
    865865        g.setColor(highlightColorTransparent);
    866866        float w = line.getLineWidth() + highlightLineWidth;
    867         if (useWiderHighlight) w+=widerHighlight;
    868         while(w >= line.getLineWidth()) {
     867        if (useWiderHighlight) w += widerHighlight;
     868        while (w >= line.getLineWidth()) {
    869869            g.setStroke(new BasicStroke(w, line.getEndCap(), line.getLineJoin(), line.getMiterLimit()));
    870870            g.draw(path);
     
    879879        g.setColor(highlightColorTransparent);
    880880        int s = size + highlightPointRadius;
    881         if (useWiderHighlight) s+=widerHighlight;
    882         while(s >= size) {
     881        if (useWiderHighlight) s += widerHighlight;
     882        while (s >= size) {
    883883            int r = (int) Math.floor(s/2d);
    884884            g.fillRoundRect(p.x-r, p.y-r, s, s, r, r);
     
    890890        // rotate image with direction last node in from to, and scale down image to 16*16 pixels
    891891        Image smallImg = ImageProvider.createRotatedImage(img, angle, new Dimension(16, 16));
    892         int w = smallImg.getWidth(null), h=smallImg.getHeight(null);
    893         g.drawImage(smallImg, (int)(pVia.x+vx+vx2)-w/2, (int)(pVia.y+vy+vy2)-h/2, nc);
     892        int w = smallImg.getWidth(null), h = smallImg.getHeight(null);
     893        g.drawImage(smallImg, (int) (pVia.x+vx+vx2)-w/2, (int) (pVia.y+vy+vy2)-h/2, nc);
    894894
    895895        if (selected) {
    896896            g.setColor(isInactiveMode ? inactiveColor : relationSelectedColor);
    897             g.drawRect((int)(pVia.x+vx+vx2)-w/2-2,(int)(pVia.y+vy+vy2)-h/2-2, w+4, h+4);
     897            g.drawRect((int) (pVia.x+vx+vx2)-w/2-2, (int) (pVia.y+vy+vy2)-h/2-2, w+4, h+4);
    898898        }
    899899    }
     
    906906        /* find the "from", "via" and "to" elements */
    907907        for (RelationMember m : r.getMembers()) {
    908             if(m.getMember().isIncomplete())
     908            if (m.getMember().isIncomplete())
    909909                return;
    910910            else {
    911                 if(m.isWay()) {
     911                if (m.isWay()) {
    912912                    Way w = m.getWay();
    913                     if(w.getNodesCount() < 2) {
     913                    if (w.getNodesCount() < 2) {
    914914                        continue;
    915915                    }
     
    917917                    switch(m.getRole()) {
    918918                    case "from":
    919                         if(fromWay == null) {
     919                        if (fromWay == null) {
    920920                            fromWay = w;
    921921                        }
    922922                        break;
    923923                    case "to":
    924                         if(toWay == null) {
     924                        if (toWay == null) {
    925925                            toWay = w;
    926926                        }
    927927                        break;
    928928                    case "via":
    929                         if(via == null) {
     929                        if (via == null) {
    930930                            via = w;
    931931                        }
    932932                    }
    933                 } else if(m.isNode()) {
     933                } else if (m.isNode()) {
    934934                    Node n = m.getNode();
    935                     if("via".equals(m.getRole()) && via == null) {
     935                    if ("via".equals(m.getRole()) && via == null) {
    936936                        via = n;
    937937                    }
     
    944944
    945945        Node viaNode;
    946         if(via instanceof Node) {
     946        if (via instanceof Node) {
    947947            viaNode = (Node) via;
    948             if(!fromWay.isFirstLastNode(viaNode))
     948            if (!fromWay.isFirstLastNode(viaNode))
    949949                return;
    950950        } else {
     
    955955
    956956            String onewayviastr = viaWay.get("oneway");
    957             if(onewayviastr != null) {
    958                 if("-1".equals(onewayviastr)) {
     957            if (onewayviastr != null) {
     958                if ("-1".equals(onewayviastr)) {
    959959                    onewayvia = Boolean.TRUE;
    960960                    Node tmp = firstNode;
     
    969969            }
    970970
    971             if(fromWay.isFirstLastNode(firstNode)) {
     971            if (fromWay.isFirstLastNode(firstNode)) {
    972972                viaNode = firstNode;
    973973            } else if (!onewayvia && fromWay.isFirstLastNode(lastNode)) {
     
    979979        /* find the "direct" nodes before the via node */
    980980        Node fromNode;
    981         if(fromWay.firstNode() == via) {
     981        if (fromWay.firstNode() == via) {
    982982            fromNode = fromWay.getNode(1);
    983983        } else {
     
    992992           away from the "via" node along the first segment of the "from" way)
    993993         */
    994         double distanceFromVia=14;
     994        double distanceFromVia = 14;
    995995        double dx = pFrom.x >= pVia.x ? pFrom.x - pVia.x : pVia.x - pFrom.x;
    996996        double dy = pFrom.y >= pVia.y ? pFrom.y - pVia.y : pVia.y - pFrom.y;
     
    10071007        double vy = distanceFromVia * Math.sin(fromAngle);
    10081008
    1009         if(pFrom.x < pVia.x) {
     1009        if (pFrom.x < pVia.x) {
    10101010            vx = -vx;
    10111011        }
    1012         if(pFrom.y < pVia.y) {
     1012        if (pFrom.y < pVia.y) {
    10131013            vy = -vy;
    10141014        }
     
    10181018           90degrees away from the first segment of the "from" way)
    10191019         */
    1020         double distanceFromWay=10;
     1020        double distanceFromWay = 10;
    10211021        double vx2 = 0;
    10221022        double vy2 = 0;
    10231023        double iconAngle = 0;
    10241024
    1025         if(pFrom.x >= pVia.x && pFrom.y >= pVia.y) {
    1026             if(!leftHandTraffic) {
     1025        if (pFrom.x >= pVia.x && pFrom.y >= pVia.y) {
     1026            if (!leftHandTraffic) {
    10271027                vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90));
    10281028                vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90));
     
    10331033            iconAngle = 270+fromAngleDeg;
    10341034        }
    1035         if(pFrom.x < pVia.x && pFrom.y >= pVia.y) {
    1036             if(!leftHandTraffic) {
     1035        if (pFrom.x < pVia.x && pFrom.y >= pVia.y) {
     1036            if (!leftHandTraffic) {
    10371037                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg));
    10381038                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg));
     
    10431043            iconAngle = 90-fromAngleDeg;
    10441044        }
    1045         if(pFrom.x < pVia.x && pFrom.y < pVia.y) {
    1046             if(!leftHandTraffic) {
     1045        if (pFrom.x < pVia.x && pFrom.y < pVia.y) {
     1046            if (!leftHandTraffic) {
    10471047                vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90));
    10481048                vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90));
     
    10531053            iconAngle = 90+fromAngleDeg;
    10541054        }
    1055         if(pFrom.x >= pVia.x && pFrom.y < pVia.y) {
    1056             if(!leftHandTraffic) {
     1055        if (pFrom.x >= pVia.x && pFrom.y < pVia.y) {
     1056            if (!leftHandTraffic) {
    10571057                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180));
    10581058                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180));
     
    10961096            poly.addPoint(p.x, p.y);
    10971097
    1098             if(lastPoint != null) {
     1098            if (lastPoint != null) {
    10991099                dx = p.x - lastPoint.x;
    11001100                dy = p.y - lastPoint.y;
     
    11491149            double bestDistanceToCenter = Double.MAX_VALUE;
    11501150            double bestQuality = -1;
    1151             for (int i=0; i<longHalfSegmentStart.size(); i++) {
     1151            for (int i = 0; i < longHalfSegmentStart.size(); i++) {
    11521152                double start = longHalfSegmentStart.get(i);
    11531153                double end = longHalfSegmentEnd.get(i);
     
    12151215        GlyphVector gv = text.font.layoutGlyphVector(frc, chars, 0, chars.length, dirFlag);
    12161216
    1217         for (int i=0; i<gv.getNumGlyphs(); ++i) {
     1217        for (int i = 0; i < gv.getNumGlyphs(); ++i) {
    12181218            Rectangle2D rect = gv.getGlyphLogicalBounds(i).getBounds2D();
    12191219            double t = tStart + offsetSign * (rect.getX() + rect.getWidth()/2) / pathLength;
     
    12711271                    continue;
    12721272                }
    1273                 if(highlightSegs == null) {
     1273                if (highlightSegs == null) {
    12741274                    highlightSegs = new GeneralPath();
    12751275                }
     
    13331333
    13341334                            while (dist < segmentLength) {
    1335                                 for (int i=0; i<2; ++i) {
     1335                                for (int i = 0; i < 2; ++i) {
    13361336                                    float onewaySize = i == 0 ? 3f : 2f;
    13371337                                    GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows;
     
    13611361            lastPoint = p;
    13621362        }
    1363         if(way.isHighlighted()) {
     1363        if (way.isHighlighted()) {
    13641364            drawPathHighlight(path, line);
    13651365        }
     
    14991499            MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock();
    15001500            try {
    1501                 for (int i = from; i<to; i++) {
     1501                for (int i = from; i < to; i++) {
    15021502                    OsmPrimitive osm = input.get(i);
    15031503                    if (osm.isDrawable()) {
     
    16011601            final int noBuckets = (prims.size() + bucketsize - 1) / bucketsize;
    16021602            final boolean singleThread = THREAD_POOL.a == 1 || noBuckets == 1;
    1603             for (int i=0; i<noBuckets; i++) {
     1603            for (int i = 0; i < noBuckets; i++) {
    16041604                int from = i*bucketsize;
    16051605                int to = Math.min((i+1)*bucketsize, prims.size());
     
    16361636            highlightWaySegments = data.getHighlightedWaySegments();
    16371637
    1638             long timeStart=0, timePhase1=0, timeFinished;
     1638            long timeStart = 0, timePhase1 = 0, timeFinished;
    16391639            if (Main.isTraceEnabled()) {
    16401640                timeStart = System.currentTimeMillis();
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r8444 r8510  
    170170        List<Way> untaggedWays = new ArrayList<>();
    171171
    172         for (final Way way : data.searchWays(bbox)){
     172        for (final Way way : data.searchWays(bbox)) {
    173173            if (way.isDrawable() && !ds.isSelected(way) && !way.isDisabledAndHidden()) {
    174174                if (way.isHighlighted()) {
     
    186186        List<Way> specialWays = new ArrayList<>(untaggedWays);
    187187        specialWays.addAll(highlightedWays);
    188         for (final Way way : specialWays){
     188        for (final Way way : specialWays) {
    189189            way.accept(this);
    190190        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java

    r8465 r8510  
    9595            Collection<String> literals;
    9696            literals = Main.pref.getCollection(PREF_KEY_OUTER_ROLES);
    97             if (literals != null && !literals.isEmpty()){
     97            if (literals != null && !literals.isEmpty()) {
    9898                setNormalized(literals, outerExactRoles);
    9999            }
    100100            literals = Main.pref.getCollection(PREF_KEY_OUTER_ROLE_PREFIXES);
    101             if (literals != null && !literals.isEmpty()){
     101            if (literals != null && !literals.isEmpty()) {
    102102                setNormalized(literals, outerRolePrefixes);
    103103            }
    104104            literals = Main.pref.getCollection(PREF_KEY_INNER_ROLES);
    105             if (literals != null && !literals.isEmpty()){
     105            if (literals != null && !literals.isEmpty()) {
    106106                setNormalized(literals, innerExactRoles);
    107107            }
    108108            literals = Main.pref.getCollection(PREF_KEY_INNER_ROLE_PREFIXES);
    109             if (literals != null && !literals.isEmpty()){
     109            if (literals != null && !literals.isEmpty()) {
    110110                setNormalized(literals, innerRolePrefixes);
    111111            }
     
    117117                    PREF_KEY_INNER_ROLES.equals(evt.getKey()) ||
    118118                    PREF_KEY_OUTER_ROLE_PREFIXES.equals(evt.getKey()) ||
    119                     PREF_KEY_OUTER_ROLES.equals(evt.getKey())){
     119                    PREF_KEY_OUTER_ROLES.equals(evt.getKey())) {
    120120                initFromPreferences();
    121121            }
     
    149149     */
    150150    private static MultipolygonRoleMatcher roleMatcher;
     151
    151152    private static synchronized MultipolygonRoleMatcher getMultipolygonRoleMatcher() {
    152153        if (roleMatcher == null) {
    153154            roleMatcher = new MultipolygonRoleMatcher();
    154             if (Main.pref != null){
     155            if (Main.pref != null) {
    155156                roleMatcher.initFromPreferences();
    156157                Main.pref.addPreferenceChangeListener(roleMatcher);
     
    302303                if (ds == null) {
    303304                    // DataSet still not found. This should not happen, but a warning does no harm
    304                     Main.warn("DataSet not found while resetting nodes in Multipolygon. This should not happen, you may report it to JOSM developers.");
     305                    Main.warn("DataSet not found while resetting nodes in Multipolygon. " +
     306                            "This should not happen, you may report it to JOSM developers.");
    305307                } else if (wayIds.size() == 1) {
    306308                    Way w = (Way) ds.getPrimitiveById(wayIds.iterator().next(), OsmPrimitiveType.WAY);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java

    r8374 r8510  
    210210                        pd.nodeMoved((NodeMovedEvent) event);
    211211                    } else if (event instanceof WayNodesChangedEvent) {
    212                         pd.wayNodesChanged((WayNodesChangedEvent)event);
     212                        pd.wayNodesChanged((WayNodesChangedEvent) event);
    213213                    }
    214214                }
  • trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java

    r8404 r8510  
    4242     */
    4343    public static String getColorKey(String colName) {
    44         return colName == null ? null : colName.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]+",".");
     44        return colName == null ? null : colName.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]+", ".");
    4545    }
    4646
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r8509 r8510  
    352352            return new CentricDatum(null, null, ellps);
    353353        boolean is3Param = true;
    354         for (int i = 3; i<towgs84Param.size(); i++) {
     354        for (int i = 3; i < towgs84Param.size(); i++) {
    355355            if (towgs84Param.get(i) != 0) {
    356356                is3Param = false;
  • trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java

    r8451 r8510  
    2929     */
    3030    public static final Ellipsoid AustSA = Ellipsoid.create_a_rf(6378160.0, 298.25);
    31    
     31
    3232    /**
    3333     * Bessel 1841 ellipsoid
    3434     */
    3535    public static final Ellipsoid Bessel1841 = Ellipsoid.create_a_rf(6377397.155, 299.1528128);
    36    
     36
    3737    /**
    3838     * Clarke 1866 ellipsoid
     
    251251        double v1 = 1-e*Math.sin(phi);
    252252        double v2 = 1+e*Math.sin(phi);
    253         return Math.log(Math.tan(Math.PI/4+phi/2)*Math.pow(v1/v2,e/2));
     253        return Math.log(Math.tan(Math.PI/4+phi/2)*Math.pow(v1/v2, e/2));
    254254    }
    255255
     
    262262        double v1 = 1-e*Math.sin(phi);
    263263        double v2 = 1+e*Math.sin(phi);
    264         return Math.log(Math.tan(Math.PI/4+phi/2)*Math.pow(v1/v2,e/2));
     264        return Math.log(Math.tan(Math.PI/4+phi/2)*Math.pow(v1/v2, e/2));
    265265    }
    266266
     
    275275        double lati = lat0;
    276276        double lati1 = 1.0; // random value to start the iterative processus
    277         while(Math.abs(lati1-lati)>=epsilon) {
     277        while (Math.abs(lati1-lati) >= epsilon) {
    278278            lati = lati1;
    279279            double v1 = 1+e*Math.sin(lati);
    280280            double v2 = 1-e*Math.sin(lati);
    281             lati1 = 2*Math.atan(Math.pow(v1/v2,e/2)*Math.exp(latIso))-Math.PI/2;
     281            lati1 = 2*Math.atan(Math.pow(v1/v2, e/2)*Math.exp(latIso))-Math.PI/2;
    282282        }
    283283        return lati1;
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r8470 r8510  
    312312        NTV2SubGrid[] clone = new NTV2SubGrid[topLevelSubGrid.length];
    313313        for (int i = 0; i < topLevelSubGrid.length; i++) {
    314             clone[i] = (NTV2SubGrid)topLevelSubGrid[i].clone();
     314            clone[i] = (NTV2SubGrid) topLevelSubGrid[i].clone();
    315315        }
    316316        return clone;
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java

    r8470 r8510  
    105105        readBytes(in, b8);
    106106        lonInterval = NTV2Util.getDouble(b8, bigEndian);
    107         lonColumnCount = 1 + (int)((maxLon - minLon) / lonInterval);
    108         latRowCount = 1 + (int)((maxLat - minLat) / latInterval);
     107        lonColumnCount = 1 + (int) ((maxLon - minLon) / lonInterval);
     108        latRowCount = 1 + (int) ((maxLat - minLat) / latInterval);
    109109        readBytes(in, b8);
    110110        readBytes(in, b8);
     
    121121        for (int i = 0; i < nodeCount; i++) {
    122122            // Read the grid file byte after byte. This is a workaround about a bug in
    123             // certain VM which are not able to read byte blocks when the resource file is
    124             // in a .jar file (Pieren)
     123            // certain VM which are not able to read byte blocks when the resource file is in a .jar file (Pieren)
    125124            readBytes(in, b1); b4[0] = b1[0];
    126125            readBytes(in, b1); b4[1] = b1[0];
     
    211210     */
    212211    private final double interpolate(float a, float b, float c, float d, double x, double y) {
    213         return a + (((double)b - (double)a) * x) + (((double)c - (double)a) * y) +
    214         (((double)a + (double)d - b - c) * x * y);
     212        return a + (((double) b - (double) a) * x) + (((double) c - (double) a) * y) +
     213        (((double) a + (double) d - b - c) * x * y);
    215214    }
    216215
     
    225224     */
    226225    public void interpolateGridShift(NTV2GridShift gs) {
    227         int lonIndex = (int)((gs.getLonPositiveWestSeconds() - minLon) / lonInterval);
    228         int latIndex = (int)((gs.getLatSeconds() - minLat) / latInterval);
     226        int lonIndex = (int) ((gs.getLonPositiveWestSeconds() - minLon) / lonInterval);
     227        int latIndex = (int) ((gs.getLatSeconds() - minLat) / latInterval);
    229228
    230229        double x = (gs.getLonPositiveWestSeconds() - (minLon + (lonInterval * lonIndex))) / lonInterval;
     
    331330        NTV2SubGrid clone = null;
    332331        try {
    333             clone = (NTV2SubGrid)super.clone();
     332            clone = (NTV2SubGrid) super.clone();
    334333            // Do a deep clone of the sub grids
    335334            if (subGrid != null) {
    336335                clone.subGrid = new NTV2SubGrid[subGrid.length];
    337336                for (int i = 0; i < subGrid.length; i++) {
    338                     clone.subGrid[i] = (NTV2SubGrid)subGrid[i].clone();
     337                    clone.subGrid[i] = (NTV2SubGrid) subGrid[i].clone();
    339338                }
    340339            }
     
    344343        return clone;
    345344    }
     345
    346346    /**
    347347     * Get maximum latitude value
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Util.java

    r8374 r8510  
    100100            j = getIntLE(b, 0);
    101101        }
    102         long l = ((long)i << 32) |
     102        long l = ((long) i << 32) |
    103103        (j & 0x00000000FFFFFFFFL);
    104104        return Double.longBitsToDouble(l);
  • trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java

    r8444 r8510  
    3131    public abstract static class Parameters {
    3232        public final double latitudeOrigin;
     33
    3334        public Parameters(double latitudeOrigin) {
    3435            this.latitudeOrigin = latitudeOrigin;
     
    4546        public final double standardParallel1;
    4647        public final double standardParallel2;
     48
    4749        public Parameters2SP(double latitudeOrigin, double standardParallel1, double standardParallel2) {
    4850            super(latitudeOrigin);
     
    163165    @Override
    164166    public double[] invproject(double east, double north) {
    165         double r = sqrt(pow(east,2) + pow(north-r0, 2));
     167        double r = sqrt(pow(east, 2) + pow(north-r0, 2));
    166168        double gamma = atan(east / (r0-north));
    167169        double lambda = gamma/n;
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r8378 r8510  
    168168                pathDir.mkdirs();
    169169            }
    170         } catch (Exception e){
     170        } catch (Exception e) {
    171171            Main.error(e);
    172172        }
     
    242242
    243243    private static void applyPrefs(Map<String, Test> tests, boolean beforeUpload) {
    244         for(String testName : Main.pref.getCollection(beforeUpload
     244        for (String testName : Main.pref.getCollection(beforeUpload
    245245        ? ValidatorPreference.PREF_SKIP_TESTS_BEFORE_UPLOAD : ValidatorPreference.PREF_SKIP_TESTS)) {
    246246            Test test = tests.get(testName);
  • trunk/src/org/openstreetmap/josm/data/validation/TestError.java

    r8435 r8510  
    317317                v.visit((WaySegment) o);
    318318            } else if (o instanceof List<?>) {
    319                 v.visit((List<Node>)o);
     319                v.visit((List<Node>) o);
    320320            }
    321321        }
     
    366366
    367367    @Override public void primitivesAdded(PrimitivesAddedEvent event) {}
     368
    368369    @Override public void tagsChanged(TagsChangedEvent event) {}
     370
    369371    @Override public void nodeMoved(NodeMovedEvent event) {}
     372
    370373    @Override public void wayNodesChanged(WayNodesChangedEvent event) {}
     374
    371375    @Override public void relationMembersChanged(RelationMembersChangedEvent event) {}
     376
    372377    @Override public void otherDatasetChange(AbstractDatasetChangedEvent event) {}
     378
    373379    @Override public void dataChanged(DataChangedEvent event) {}
    374380
  • trunk/src/org/openstreetmap/josm/data/validation/ValidatorVisitor.java

    r8378 r8510  
    1010public interface ValidatorVisitor {
    1111    void visit(TestError error);
     12
    1213    void visit(OsmPrimitive p);
     14
    1315    void visit(WaySegment ws);
     16
    1417    void visit(List<Node> nodes);
    1518}
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r8419 r8510  
    115115     */
    116116    public static DomainValidator getInstance(boolean allowLocal) {
    117        if(allowLocal) {
     117       if (allowLocal) {
    118118          return DOMAIN_VALIDATOR_WITH_LOCAL;
    119119       }
     
    138138        if (groups != null && groups.length > 0) {
    139139            return isValidTld(groups[0]);
    140         } else if(allowLocal) {
     140        } else if (allowLocal) {
    141141            if (hostnameRegex.isValid(domain)) {
    142142               return true;
     
    154154     */
    155155    public boolean isValidTld(String tld) {
    156         if(allowLocal && isValidLocalTld(tld)) {
     156        if (allowLocal && isValidLocalTld(tld)) {
    157157           return true;
    158158        }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java

    r7937 r8510  
    8888     */
    8989    public static EmailValidator getInstance(boolean allowLocal) {
    90         if(allowLocal) {
     90        if (allowLocal) {
    9191           return EMAIL_VALIDATOR_WITH_LOCAL;
    9292        }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java

    r8461 r8510  
    8282            try {
    8383                iIpSegment = Integer.parseInt(ipSegment);
    84             } catch(NumberFormatException e) {
     84            } catch (NumberFormatException e) {
    8585                return false;
    8686            }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java

    r8394 r8510  
    107107        }
    108108        patterns = new Pattern[regexs.length];
    109         int flags = caseSensitive ? 0: Pattern.CASE_INSENSITIVE;
     109        int flags = caseSensitive ? 0 : Pattern.CASE_INSENSITIVE;
    110110        for (int i = 0; i < regexs.length; i++) {
    111111            if (regexs[i] == null || regexs[i].isEmpty()) {
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r8509 r8510  
    405405
    406406        String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA);
    407         if (extra != null && !extra.trim().isEmpty()){
     407        if (extra != null && !extra.trim().isEmpty()) {
    408408            return false;
    409409        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java

    r8419 r8510  
    5555            this(code, Collections.singleton(p), message);
    5656        }
     57
    5758        public AddressError(int code, Collection<OsmPrimitive> collection, String message) {
    5859            this(code, collection, message, null, null);
    5960        }
     61
    6062        public AddressError(int code, Collection<OsmPrimitive> collection, String message, String description, String englishDescription) {
    6163            this(code, Severity.WARNING, collection, message, description, englishDescription);
    6264        }
     65
    6366        public AddressError(int code, Severity severity, Collection<OsmPrimitive> collection, String message, String description,
    6467                String englishDescription) {
     
    207210            centroid = ((Node) house).getEastNorth();
    208211        } else if (house instanceof Way) {
    209             List<Node> nodes = ((Way)house).getNodes();
     212            List<Node> nodes = ((Way) house).getNodes();
    210213            if (house.hasKey(ADDR_INTERPOLATION)) {
    211214                for (Node n : nodes) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r8378 r8510  
    4040
    4141    /** All way segments, grouped by cells */
    42     private Map<Point2D,List<WaySegment>> cellSegments;
     42    private Map<Point2D, List<WaySegment>> cellSegments;
    4343    /** The already detected errors */
    4444    private Set<WaySegment> errorSegments;
     
    181181     */
    182182    public CrossingWays(String title) {
    183         super(title, tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node."));
     183        super(title, tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, " +
     184                "but are not connected by a node."));
    184185    }
    185186
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r8393 r8510  
    121121    }
    122122
    123 
    124123    @SuppressWarnings("unchecked")
    125124    @Override
     
    163162        List<TestError> errors = new ArrayList<>();
    164163
    165         MultiMap<Map<String,String>, OsmPrimitive> mm = new MultiMap<>();
     164        MultiMap<Map<String, String>, OsmPrimitive> mm = new MultiMap<>();
    166165        for (Node n: nodes) {
    167166            mm.put(n.getKeys(), n);
    168167        }
    169168
    170         Map<String,Boolean> typeMap=new HashMap<>();
     169        Map<String, Boolean> typeMap = new HashMap<>();
    171170        String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"};
    172171
    173 
    174         // check whether we have multiple nodes at the same position with
    175         // the same tag set
    176         //
    177         for (Iterator<Map<String,String>> it = mm.keySet().iterator(); it.hasNext();) {
    178             Map<String,String> tagSet = it.next();
     172        // check whether we have multiple nodes at the same position with the same tag set
     173        for (Iterator<Map<String, String>> it = mm.keySet().iterator(); it.hasNext();) {
     174            Map<String, String> tagSet = it.next();
    179175            if (mm.get(tagSet).size() > 1) {
    180176
     
    184180
    185181                for (OsmPrimitive p : mm.get(tagSet)) {
    186                     if (p.getType()==OsmPrimitiveType.NODE) {
     182                    if (p.getType() == OsmPrimitiveType.NODE) {
    187183                        Node n = (Node) p;
    188                         List<OsmPrimitive> lp=n.getReferrers();
     184                        List<OsmPrimitive> lp = n.getReferrers();
    189185                        for (OsmPrimitive sp: lp) {
    190                             if (sp.getType()==OsmPrimitiveType.WAY) {
     186                            if (sp.getType() == OsmPrimitiveType.WAY) {
    191187                                boolean typed = false;
    192                                 Way w=(Way) sp;
     188                                Way w = (Way) sp;
    193189                                Map<String, String> keys = w.getKeys();
    194190                                for (String type: typeMap.keySet()) {
    195191                                    if (keys.containsKey(type)) {
    196192                                        typeMap.put(type, true);
    197                                         typed=true;
     193                                        typed = true;
    198194                                    }
    199195                                }
     
    207203                }
    208204
    209                 int nbType=0;
     205                int nbType = 0;
    210206                for (Entry<String, Boolean> entry: typeMap.entrySet()) {
    211207                    if (entry.getValue()) {
     
    214210                }
    215211
    216                 if (nbType>1) {
     212                if (nbType > 1) {
    217213                    String msg = marktr("Mixed type duplicated nodes");
    218214                    errors.add(new TestError(
     
    364360                // object to keep track of the nodes at this position.
    365361                //
    366                 Node n1 = (Node)potentialDuplicates.get(n);
     362                Node n1 = (Node) potentialDuplicates.get(n);
    367363                List<Node> nodes = new ArrayList<>(2);
    368364                nodes.add(n1);
     
    372368                // we have multiple nodes at the same position.
    373369                //
    374                 List<Node> nodes = (List<Node>)potentialDuplicates.get(n);
     370                List<Node> nodes = (List<Node>) potentialDuplicates.get(n);
    375371                nodes.add(n);
    376372            }
     
    413409        }
    414410
    415         return null;// undoRedo handling done in mergeNodes
     411        return null; // undoRedo handling done in mergeNodes
    416412    }
    417413
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r8444 r8510  
    5555        @Override
    5656        public int hashCode() {
    57             return role.hashCode()+(int)relId+tags.hashCode()+type.hashCode()+coor.hashCode();
     57            return role.hashCode()+(int) relId+tags.hashCode()+type.hashCode()+coor.hashCode();
    5858        }
    5959
     
    6262            if (!(obj instanceof RelMember)) return false;
    6363            RelMember rm = (RelMember) obj;
    64             return rm.role.equals(role) && rm.type.equals(type) && rm.relId==relId && rm.tags.equals(tags) && rm.coor.equals(coor);
     64            return rm.role.equals(role) && rm.type.equals(type) && rm.relId == relId && rm.tags.equals(tags) && rm.coor.equals(coor);
    6565        }
    6666
     
    233233        for (OsmPrimitive osm : sel)
    234234            if (osm instanceof Relation && !osm.isDeleted()) {
    235                 relFix.add((Relation)osm);
     235                relFix.add((Relation) osm);
    236236            }
    237237
     
    296296        for (OsmPrimitive osm : sel)
    297297            if (osm instanceof Relation) {
    298                 relations.add((Relation)osm);
     298                relations.add((Relation) osm);
    299299            }
    300300
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java

    r8382 r8510  
    6767    private static class WayPairNoTags {
    6868        private final List<LatLon> coor;
     69
    6970        public WayPairNoTags(List<LatLon> coor) {
    7071            this.coor = coor;
    7172        }
     73
    7274        @Override
    7375        public int hashCode() {
    7476            return coor.hashCode();
    7577        }
     78
    7679        @Override
    7780        public boolean equals(Object obj) {
     
    125128            if (sameway.size() > 1) {
    126129                //Report error only if at least some tags are different, as otherwise the error was already reported as duplicated ways
    127                 Map<String, String> tags0=null;
    128                 boolean skip=true;
     130                Map<String, String> tags0 = null;
     131                boolean skip = true;
    129132
    130133                for (OsmPrimitive o : sameway) {
    131                     if (tags0==null) {
    132                         tags0=o.getKeys();
     134                    if (tags0 == null) {
     135                        tags0 = o.getKeys();
    133136                        removeUninterestingKeys(tags0);
    134137                    } else {
    135                         Map<String, String> tagsCmp=o.getKeys();
     138                        Map<String, String> tagsCmp = o.getKeys();
    136139                        removeUninterestingKeys(tagsCmp);
    137140                        if (!tagsCmp.equals(tags0)) {
    138                             skip=false;
     141                            skip = false;
    139142                            break;
    140143                        }
     
    158161     */
    159162    public void removeUninterestingKeys(Map<String, String> wkeys) {
    160         for(String key : OsmPrimitive.getDiscardableKeys()) {
     163        for (String key : OsmPrimitive.getDiscardableKeys()) {
    161164            wkeys.remove(key);
    162165        }
     
    207210            int lowestIndex = 0;
    208211            long lowestNodeId = wNodes.get(0).getUniqueId();
    209             for (int i=1; i<wNodes.size(); i++) {
     212            for (int i = 1; i < wNodes.size(); i++) {
    210213                if (wNodes.get(i).getUniqueId() < lowestNodeId) {
    211214                    lowestNodeId = wNodes.get(i).getUniqueId();
     
    213216                }
    214217            }
    215             for (int i=lowestIndex; i<wNodes.size()-1; i++) {
     218            for (int i = lowestIndex; i < wNodes.size()-1; i++) {
    216219                wNodesToUse.add(wNodes.get(i));
    217220            }
    218             for (int i=0; i<lowestIndex; i++) {
     221            for (int i = 0; i < lowestIndex; i++) {
    219222                wNodesToUse.add(wNodes.get(i));
    220223            }
     
    241244        for (OsmPrimitive osm : sel) {
    242245            if (osm instanceof Way && !osm.isDeleted()) {
    243                 ways.add((Way)osm);
     246                ways.add((Way) osm);
    244247            }
    245248        }
     
    301304
    302305        //Do not automatically fix same ways with different tags
    303         if (testError.getCode()!=DUPLICATE_WAY) return false;
     306        if (testError.getCode() != DUPLICATE_WAY) return false;
    304307
    305308        // We fix it only if there is no more than one way that is relation member.
     
    309312        for (OsmPrimitive osm : sel) {
    310313            if (osm instanceof Way) {
    311                 ways.add((Way)osm);
     314                ways.add((Way) osm);
    312315            }
    313316        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java

    r7937 r8510  
    132132            String errMsg = validator.getErrorMessage();
    133133            // Special treatment to allow URLs without protocol. See UrlValidator#isValid
    134             if (tr("URL contains an invalid protocol: {0}", (String)null).equals(errMsg)) {
     134            if (tr("URL contains an invalid protocol: {0}", (String) null).equals(errMsg)) {
    135135                String proto = validator instanceof EmailValidator ? "mailto://" : "http://";
    136136                return doValidateTag(p, k, proto+value, validator, code);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java

    r8455 r8510  
    3535    public void visit(Way w) {
    3636        Double length = w.getLongestSegmentLength();
    37         if(length > maxlength) {
     37        if (length > maxlength) {
    3838            length /= 1000.0;
    3939            errors.add(new TestError(this, Severity.WARNING, tr("Long segments"),
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r8509 r8510  
    424424        static String insertArguments(Selector matchingSelector, String s, OsmPrimitive p) {
    425425            if (s != null && matchingSelector instanceof Selector.ChildOrParentSelector) {
    426                 return insertArguments(((Selector.ChildOrParentSelector)matchingSelector).right, s, p);
     426                return insertArguments(((Selector.ChildOrParentSelector) matchingSelector).right, s, p);
    427427            } else if (s == null || !(matchingSelector instanceof GeneralSelector)) {
    428428                return s;
     
    583583            for (Selector s : rule.selectors) {
    584584                if (s instanceof AbstractSelector) {
    585                     for (Condition c : ((AbstractSelector)s).getConditions()) {
     585                    for (Condition c : ((AbstractSelector) s).getConditions()) {
    586586                        if (c instanceof ClassCondition) {
    587587                            result.add(((ClassCondition) c).id);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r8509 r8510  
    7979        for (Test t : OsmValidator.getEnabledTests(false)) {
    8080            if (t instanceof UnclosedWays) {
    81                 keysCheckedByAnotherTest.addAll(((UnclosedWays)t).getCheckedKeys());
     81                keysCheckedByAnotherTest.addAll(((UnclosedWays) t).getCheckedKeys());
    8282                break;
    8383            }
     
    9494        GeneralPath result = new GeneralPath();
    9595        result.moveTo((float) nodes.get(0).getCoor().lat(), (float) nodes.get(0).getCoor().lon());
    96         for (int i=1; i<nodes.size(); i++) {
     96        for (int i = 1; i < nodes.size(); i++) {
    9797            Node n = nodes.get(i);
    9898            result.lineTo((float) n.getCoor().lat(), (float) n.getCoor().lon());
  • trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java

    r8455 r8510  
    4040    public NameMismatch() {
    4141        super(tr("Missing name:* translation"),
    42             tr("This test finds multilingual objects whose ''name'' attribute is not equal to some ''name:*'' attribute and not a composition of ''name:*'' attributes, e.g., Italia - Italien - Italy."));
     42            tr("This test finds multilingual objects whose ''name'' attribute is not equal to some ''name:*'' attribute " +
     43                    "and not a composition of ''name:*'' attributes, e.g., Italia - Italien - Italy."));
    4344    }
    4445
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r8382 r8510  
    6363                        "    r.getErrors = function() {return [];};" +
    6464                        "    return r;" +
    65                         "  } catch(err) {" +
     65                        "  } catch (err) {" +
    6666                        "    return {" +
    6767                        "      getWarnings: function() {return [];}," +
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r8444 r8510  
    4040
    4141    /** Bag of all way segments */
    42     private MultiMap<Pair<Node,Node>, WaySegment> nodePairs;
     42    private MultiMap<Pair<Node, Node>, WaySegment> nodePairs;
    4343
    4444    protected static final int OVERLAPPING_HIGHWAY = 101;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java

    r8382 r8510  
    122122            List<List<Node>> nodesLists = new ArrayList<>();
    123123            if (station instanceof Way) {
    124                 nodesLists.add(((Way)station).getNodes());
     124                nodesLists.add(((Way) station).getNodes());
    125125            } else if (station instanceof Relation) {
    126126                Multipolygon polygon = MultipolygonCache.getInstance().get(Main.map.mapView, (Relation) station);
     
    147147            if (it.hasNext()) {
    148148                return new ChangePropertyCommand(it.next(),
    149                         "power", towerPoleTagMap.get(((PowerLineError)testError).line));
     149                        "power", towerPoleTagMap.get(((PowerLineError) testError).line));
    150150            }
    151151        }
     
    155155    @Override
    156156    public boolean isFixable(TestError testError) {
    157         return testError instanceof PowerLineError && towerPoleTagMap.containsKey(((PowerLineError)testError).line);
     157        return testError instanceof PowerLineError && towerPoleTagMap.containsKey(((PowerLineError) testError).line);
    158158    }
    159159
     
    207207    protected class PowerLineError extends TestError {
    208208        private final Way line;
     209
    209210        public PowerLineError(Node n, Way line) {
    210211            super(PowerLines.this, Severity.WARNING,
     
    212213            this.line = line;
    213214        }
     215
    214216        public final Node getNode() {
    215217            // primitives list can be empty if all primitives have been purged
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r8461 r8510  
    8585
    8686    private static class RolePreset {
     87        private final List<Role> roles;
     88        private final String name;
     89
    8790        public RolePreset(List<Role> roles, String name) {
    8891            this.roles = roles;
    8992            this.name = name;
    9093        }
    91         private final List<Role> roles;
    92         private final String name;
    9394    }
    9495
     
    118119
    119120    private Map<String, RoleInfo> buildRoleInfoMap(Relation n) {
    120         Map<String,RoleInfo> map = new HashMap<>();
     121        Map<String, RoleInfo> map = new HashMap<>();
    121122        for (RelationMember m : n.getMembers()) {
    122123            String role = m.getRole();
     
    150151            }
    151152            if (matches && r != null) {
    152                 for(Role role: r.roles) {
     153                for (Role role: r.roles) {
    153154                    String key = role.key;
    154155                    List<Role> roleGroup = null;
     
    213214                    // verify if preset accepts such member
    214215                    OsmPrimitive primitive = member.getMember();
    215                     if(!primitive.isUsable()) {
     216                    if (!primitive.isUsable()) {
    216217                        // if member is not usable (i.e. not present in working set)
    217218                        // we can't verify expression - so we just skip it
     
    219220                    } else {
    220221                        // verify expression
    221                         if(r.memberExpression.match(primitive)) {
     222                        if (r.memberExpression.match(primitive)) {
    222223                            return true;
    223224                        } else {
     
    283284
    284285        // verify role counts based on whole role sets
    285         for(RolePreset rp: allroles.values()) {
     286        for (RolePreset rp: allroles.values()) {
    286287            for (Role r: rp.roles) {
    287288                String keyname = r.key;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r8404 r8510  
    3737
    3838    /** All ways, grouped by cells */
    39     private Map<Point2D,List<Way>> cellWays;
     39    private Map<Point2D, List<Way>> cellWays;
    4040    /** The already detected errors */
    4141    private MultiMap<Way, Way> errorWays;
     
    130130        if (m == 0)
    131131            return n;
    132         d = new int[n + 1][m + 1];
     132        d = new int[n+1][m+1];
    133133
    134134        // Step 2
     
    198198        // check plain strings
    199199        int distance = getLevenshteinDistance(name, name2);
    200         boolean similar = distance>0 && distance<=2;
     200        boolean similar = distance > 0 && distance <= 2;
    201201
    202202        // try all rules
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r8470 r8510  
    265265            }
    266266            // TODO directionKeys are no longer in OsmPrimitive (search pattern is used instead)
    267             /*  for(String a : OsmPrimitive.getDirectionKeys())
     267            /*  for (String a : OsmPrimitive.getDirectionKeys())
    268268                presetsValueData.add(a);
    269269             */
     
    345345                withErrors.put(p, "ICK");
    346346            }
    347             if (checkValues && (value!=null && value.length() > 255) && !withErrors.contains(p, "LV")) {
     347            if (checkValues && (value != null && value.length() > 255) && !withErrors.contains(p, "LV")) {
    348348                errors.add(new TestError(this, Severity.ERROR, tr("Tag value longer than allowed"),
    349349                        tr(s, key), MessageFormat.format(s, key), LONG_VALUE, p));
    350350                withErrors.put(p, "LV");
    351351            }
    352             if (checkKeys && (key!=null && key.length() > 255) && !withErrors.contains(p, "LK")) {
     352            if (checkKeys && (key != null && key.length() > 255) && !withErrors.contains(p, "LK")) {
    353353                errors.add(new TestError(this, Severity.ERROR, tr("Tag key longer than allowed"),
    354354                        tr(s, key), MessageFormat.format(s, key), LONG_KEY, p));
    355355                withErrors.put(p, "LK");
    356356            }
    357             if (checkValues && (value==null || value.trim().isEmpty()) && !withErrors.contains(p, "EV")) {
     357            if (checkValues && (value == null || value.trim().isEmpty()) && !withErrors.contains(p, "EV")) {
    358358                errors.add(new TestError(this, Severity.WARNING, tr("Tags with empty values"),
    359359                        tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p));
     
    392392                }
    393393                for (String a : ignoreDataEquals) {
    394                     if(key.equals(a)) {
     394                    if (key.equals(a)) {
    395395                        ignore = true;
    396396                    }
    397397                }
    398398                for (String a : ignoreDataEndsWith) {
    399                     if(key.endsWith(a)) {
     399                    if (key.endsWith(a)) {
    400400                        ignore = true;
    401401                    }
     
    508508        a.anchor = GridBagConstraints.EAST;
    509509
    510         testPanel.add(new JLabel(name+" :"), GBC.eol().insets(3,0,0,0));
     510        testPanel.add(new JLabel(name+" :"), GBC.eol().insets(3, 0, 0, 0));
    511511
    512512        prefCheckKeys = new JCheckBox(tr("Check property keys."), Main.pref.getBoolean(PREF_CHECK_KEYS, true));
    513513        prefCheckKeys.setToolTipText(tr("Validate that property keys are valid checking against list of words."));
    514         testPanel.add(prefCheckKeys, GBC.std().insets(20,0,0,0));
     514        testPanel.add(prefCheckKeys, GBC.std().insets(20, 0, 0, 0));
    515515
    516516        prefCheckKeysBeforeUpload = new JCheckBox();
     
    520520        prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Main.pref.getBoolean(PREF_CHECK_COMPLEX, true));
    521521        prefCheckComplex.setToolTipText(tr("Validate property values and tags using complex rules."));
    522         testPanel.add(prefCheckComplex, GBC.std().insets(20,0,0,0));
     522        testPanel.add(prefCheckComplex, GBC.std().insets(20, 0, 0, 0));
    523523
    524524        prefCheckComplexBeforeUpload = new JCheckBox();
     
    547547        prefCheckValues = new JCheckBox(tr("Check property values."), Main.pref.getBoolean(PREF_CHECK_VALUES, true));
    548548        prefCheckValues.setToolTipText(tr("Validate that property values are valid checking against presets."));
    549         testPanel.add(prefCheckValues, GBC.std().insets(20,0,0,0));
     549        testPanel.add(prefCheckValues, GBC.std().insets(20, 0, 0, 0));
    550550
    551551        prefCheckValuesBeforeUpload = new JCheckBox();
     
    555555        prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Main.pref.getBoolean(PREF_CHECK_FIXMES, true));
    556556        prefCheckFixmes.setToolTipText(tr("Looks for nodes or ways with FIXME in any property value."));
    557         testPanel.add(prefCheckFixmes, GBC.std().insets(20,0,0,0));
     557        testPanel.add(prefCheckFixmes, GBC.std().insets(20, 0, 0, 0));
    558558
    559559        prefCheckFixmesBeforeUpload = new JCheckBox();
     
    667667            private Pattern getPattern(String str) throws PatternSyntaxException {
    668668                if (str.endsWith("/i"))
    669                     return Pattern.compile(str.substring(1,str.length()-2), Pattern.CASE_INSENSITIVE);
     669                    return Pattern.compile(str.substring(1, str.length()-2), Pattern.CASE_INSENSITIVE);
    670670                if (str.endsWith("/"))
    671                     return Pattern.compile(str.substring(1,str.length()-1));
     671                    return Pattern.compile(str.substring(1, str.length()-1));
    672672
    673673                throw new IllegalStateException();
    674674            }
     675
    675676            public CheckerElement(String exp) throws PatternSyntaxException {
    676677                Matcher m = Pattern.compile("(.+)([!=]=)(.+)").matcher(exp);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java

    r8390 r8510  
    174174
    175175        for (OsmPrimitive parent: w.getReferrers()) {
    176             if (parent instanceof Relation && ((Relation)parent).isMultipolygon())
     176            if (parent instanceof Relation && ((Relation) parent).isMultipolygon())
    177177                return;
    178178        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r8509 r8510  
    423423            return ret;
    424424        for (int i = 1; i < size; ++i) {
    425             if(i < size-1) {
     425            if (i < size-1) {
    426426                addNode(w.getNode(i), middlenodes);
    427427            }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java

    r8444 r8510  
    127127                        OsmPrimitive member = m.getMember();
    128128                        if (member instanceof Way && member.isUsable() && !member.isTagged()) {
    129                             waysUsedInRelations.add((Way)member);
     129                            waysUsedInRelations.add((Way) member);
    130130                        }
    131131                    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java

    r7937 r8510  
    4040        List<OsmPrimitive> r = w.firstNode().getReferrers();
    4141        for (OsmPrimitive p : r) {
    42             if(p != w && p.hasKey("highway")) {
     42            if (p != w && p.hasKey("highway")) {
    4343                hasway = true;
    4444                break;
     
    5353        r = w.lastNode().getReferrers();
    5454        for (OsmPrimitive p : r) {
    55             if(p != w && p.hasKey("highway")) {
     55            if (p != w && p.hasKey("highway")) {
    5656                hasway = true;
    5757                break;
  • trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java

    r8395 r8510  
    382382                        }
    383383                    } else { // escaped value content is an entity name
    384                         if(mapNameToValue == null) {
     384                        if (mapNameToValue == null) {
    385385                            mapNameToValue = new HashMap<>();
    386386                            for (String[] pair : ARRAY)
  • trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java

    r8444 r8510  
    3333     * @return A list with all the cells the way starts or ends
    3434     */
    35     public static List<List<Way>> getWaysInCell(Way w, Map<Point2D,List<Way>> cellWays) {
     35    public static List<List<Way>> getWaysInCell(Way w, Map<Point2D, List<Way>> cellWays) {
    3636        if (w.getNodesCount() == 0)
    3737            return Collections.emptyList();
Note: See TracChangeset for help on using the changeset viewer.