Changeset 10194 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-05-11T22:29:43+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar, javadoc

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r10173 r10194  
    135135
    136136    protected boolean canShowAsLatest(OsmPrimitive primitive) {
    137         if (primitive == null) return false;
    138         if (primitive.isNew() || !primitive.isUsable()) return false;
     137        if (primitive == null)
     138            return false;
     139        if (primitive.isNew() || !primitive.isUsable())
     140            return false;
    139141
    140142        //try creating a history primitive. if that fails, the primitive cannot be used.
     
    145147        }
    146148
    147         if (history == null) return false;
     149        if (history == null)
     150            return false;
    148151        // only show latest of the same version if it is modified
    149152        if (history.getByVersion(primitive.getVersion()) != null)
     
    394397     */
    395398    public boolean isLatest(HistoryOsmPrimitive primitive) {
    396         if (primitive == null) return false;
     399        if (primitive == null)
     400            return false;
    397401        return primitive == latest;
    398402    }
     
    446450        @Override
    447451        public void setValueAt(Object aValue, int row, int column) {
    448             if (!((Boolean) aValue)) return;
     452            if (!((Boolean) aValue))
     453                return;
    449454            switch (column) {
    450455            case 1:
     
    466471
    467472        public void setReferencePointInTime(int row) {
    468             if (history == null) return;
     473            if (history == null)
     474                return;
    469475            if (row == history.getNumVersions()) {
    470476                if (latest != null) {
     
    473479                return;
    474480            }
    475             if (row < 0 || row > history.getNumVersions()) return;
     481            if (row < 0 || row > history.getNumVersions())
     482                return;
    476483            HistoryOsmPrimitive reference = history.get(row);
    477484            HistoryBrowserModel.this.setReferencePointInTime(reference);
     
    479486
    480487        public void setCurrentPointInTime(int row) {
    481             if (history == null) return;
     488            if (history == null)
     489                return;
    482490            if (row == history.getNumVersions()) {
    483491                if (latest != null) {
     
    486494                return;
    487495            }
    488             if (row < 0 || row > history.getNumVersions()) return;
     496            if (row < 0 || row > history.getNumVersions())
     497                return;
    489498            HistoryOsmPrimitive current = history.get(row);
    490499            HistoryBrowserModel.this.setCurrentPointInTime(current);
     
    492501
    493502        public boolean isReferencePointInTime(int row) {
    494             if (history == null) return false;
     503            if (history == null)
     504                return false;
    495505            if (row == history.getNumVersions())
    496506                return latest == reference;
    497             if (row < 0 || row > history.getNumVersions()) return false;
     507            if (row < 0 || row > history.getNumVersions())
     508                return false;
    498509            HistoryOsmPrimitive p = history.get(row);
    499510            return p == reference;
     
    501512
    502513        public boolean isCurrentPointInTime(int row) {
    503             if (history == null) return false;
     514            if (history == null)
     515                return false;
    504516            if (row == history.getNumVersions())
    505517                return latest == current;
    506             if (row < 0 || row > history.getNumVersions()) return false;
     518            if (row < 0 || row > history.getNumVersions())
     519                return false;
    507520            HistoryOsmPrimitive p = history.get(row);
    508521            return p == current;
     
    520533
    521534        public OsmPrimitive getLatest() {
    522             if (latest == null) return null;
     535            if (latest == null)
     536                return null;
    523537            OsmDataLayer editLayer = Main.main.getEditLayer();
    524             if (editLayer == null) return null;
     538            if (editLayer == null)
     539                return null;
    525540            return editLayer.data.getPrimitiveById(latest.getId(), latest.getType());
    526541        }
     
    541556        private List<String> keys;
    542557        private final PointInTimeType pointInTimeType;
     558
     559        protected TagTableModel(PointInTimeType type) {
     560            pointInTimeType = type;
     561            initKeyList();
     562        }
    543563
    544564        protected void initKeyList() {
     
    555575        }
    556576
    557         protected TagTableModel(PointInTimeType type) {
    558             pointInTimeType = type;
    559             initKeyList();
    560         }
    561 
    562577        @Override
    563578        public int getRowCount() {
    564             if (keys == null) return 0;
     579            if (keys == null)
     580                return 0;
    565581            return keys.size();
    566582        }
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r9509 r10194  
    237237        public final int limit;
    238238
     239        /**
     240         * Constructs a {@code MoreNotesException}.
     241         * @param notes downloaded notes
     242         * @param limit download limit sent to the server
     243         */
    239244        public MoreNotesException(List<Note> notes, int limit) {
    240245            this.notes = notes;
     
    242247        }
    243248    }
    244 
    245249}
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r10181 r10194  
    176176    }
    177177
     178    /**
     179     * Returns maximum age of cache file. Only applies to URLs.
     180     * When this time has passed after the last download of the file, the
     181     * cache is considered stale and a new download will be attempted.
     182     * @return the maximum cache age in seconds
     183     */
    178184    public long getMaxAge() {
    179185        return maxAge;
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r10006 r10194  
    2828     * Maximum number of changesets returned by the OSM API call "/changesets?"
    2929     */
    30     public static int MAX_CHANGESETS_NUMBER = 100;
    31 
    32     /**
    33      * Replies a changeset query object from the query part of a OSM API URL for querying changesets.
    34      *
    35      * @param query the query part
    36      * @return the query object
    37      * @throws ChangesetQueryUrlException if query doesn't consist of valid query parameters
    38      */
    39     public static ChangesetQuery buildFromUrlQuery(String query) throws ChangesetQueryUrlException {
    40         return new ChangesetQueryUrlParser().parse(query);
    41     }
     30    public static final int MAX_CHANGESETS_NUMBER = 100;
    4231
    4332    /** the user id this query is restricted to. null, if no restriction to a user id applies */
     
    5645    /** a collection of changeset ids to query for */
    5746    private Collection<Long> changesetIds;
     47
     48    /**
     49     * Replies a changeset query object from the query part of a OSM API URL for querying changesets.
     50     *
     51     * @param query the query part
     52     * @return the query object
     53     * @throws ChangesetQueryUrlException if query doesn't consist of valid query parameters
     54     */
     55    public static ChangesetQuery buildFromUrlQuery(String query) throws ChangesetQueryUrlException {
     56        return new ChangesetQueryUrlParser().parse(query);
     57    }
    5858
    5959    /**
     
    305305    }
    306306
     307    /**
     308     * Exception thrown for invalid changeset queries.
     309     */
    307310    public static class ChangesetQueryUrlException extends Exception {
    308311
     
    339342    }
    340343
     344    /**
     345     * Changeset query URL parser.
     346     */
    341347    public static class ChangesetQueryUrlParser {
    342348        protected int parseUid(String value) throws ChangesetQueryUrlException {
     
    486492         * </pre>
    487493         *
    488          * @param query the query string. If null, an empty query (identical to a query for all changesets) is
    489          * assumed
     494         * @param query the query string. If null, an empty query (identical to a query for all changesets) is assumed
    490495         * @return the changeset query
    491496         * @throws ChangesetQueryUrlException if the query string doesn't represent a legal query for changesets
     
    494499            if (query == null)
    495500                return new ChangesetQuery();
    496             query = query.trim();
    497             if (query.isEmpty())
     501            String apiQuery = query.trim();
     502            if (apiQuery.isEmpty())
    498503                return new ChangesetQuery();
    499             Map<String, String> queryParams = createMapFromQueryString(query);
    500             return createFromMap(queryParams);
     504            return createFromMap(createMapFromQueryString(apiQuery));
    501505        }
    502506    }
Note: See TracChangeset for help on using the changeset viewer.