Ignore:
Timestamp:
2016-03-13T16:31:38+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - code style + javadoc

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

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

    r9665 r9980  
    1111 *
    1212 * @author Petr_Dlouhý
     13 * @since 2125
    1314 */
    1415public class Filter extends SearchSetting {
    1516    private static final String version = "1";
    1617
     18    /**
     19     * Enabled status.
     20     * @see FilterPreferenceEntry#enable
     21     */
    1722    public boolean enable = true;
     23
     24    /**
     25     * If this option is activated, the chosen objects are completely hidden.
     26     * Otherwise they are disabled and shown in a shade of gray.
     27     * @see FilterPreferenceEntry#hiding
     28     */
    1829    public boolean hiding;
     30
     31    /**
     32     * Normally, the specified objects are hidden and the rest is shown.
     33     * If this option is activated, only the specified objects are shown and the rest is hidden.
     34     * @see FilterPreferenceEntry#inverted
     35     */
    1936    public boolean inverted;
    2037
     
    2744    }
    2845
     46    /**
     47     * Constructs a new {@code Filter} from a preference entry.
     48     * @param e preference entry
     49     */
    2950    public Filter(FilterPreferenceEntry e) {
    3051        this();
     
    4869
    4970    public static class FilterPreferenceEntry {
    50         @pref @writeExplicitly public String version = "1";
     71        @writeExplicitly
     72        @pref public String version = "1";
     73
    5174        @pref public String text;
    52         @pref @writeExplicitly public String mode = "add";
     75
     76        /**
     77         * Mode selector which defines how a filter is combined with the previous one:<ul>
     78         * <li>replace: replace selection</li>
     79         * <li>add: add to selection</li>
     80         * <li>remove: remove from selection</li>
     81         * <li>in_selection: find in selection</li>
     82         * </ul>
     83         * @see SearchMode
     84         */
     85        @writeExplicitly
     86        @pref public String mode = "add";
     87
    5388        @pref public boolean case_sensitive;
     89
    5490        @pref public boolean regex_search;
     91
    5592        @pref public boolean mapCSS_search;
    56         @pref @writeExplicitly public boolean enable = true;
    57         @pref @writeExplicitly public boolean hiding;
    58         @pref @writeExplicitly public boolean inverted;
     93
     94        /**
     95         * Enabled status.
     96         * @see Filter#enable
     97         */
     98        @writeExplicitly
     99        @pref public boolean enable = true;
     100
     101        /**
     102         * If this option is activated, the chosen objects are completely hidden.
     103         * Otherwise they are disabled and shown in a shade of gray.
     104         * @see Filter#hiding
     105         */
     106        @writeExplicitly
     107        @pref public boolean hiding;
     108
     109        /**
     110         * Normally, the specified objects are hidden and the rest is shown.
     111         * If this option is activated, only the specified objects are shown and the rest is hidden.
     112         * @see Filter#inverted
     113         */
     114        @writeExplicitly
     115        @pref public boolean inverted;
    59116    }
    60117
     118    /**
     119     * Returns a new preference entry for this filter.
     120     * @return preference entry
     121     */
    61122    public FilterPreferenceEntry getPreferenceEntry() {
    62123        FilterPreferenceEntry e = new FilterPreferenceEntry();
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r9975 r9980  
    144144        this.hash = ha;
    145145        int cap = 1 << (int) (Math.ceil(Math.log(capacity/LOAD_FACTOR) / Math.log(2)));
    146         @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap];
     146        @SuppressWarnings("unchecked")
     147        T[] newData = (T[]) new Object[cap];
    147148        data = newData;
    148149        mask = data.length - 1;
     
    175176    @Override
    176177    public synchronized boolean contains(Object o) {
    177         @SuppressWarnings("unchecked") T t = (T) o;
     178        @SuppressWarnings("unchecked")
     179        T t = (T) o;
    178180        int bucket = getBucket(hash, t);
    179181        return bucket >= 0;
     
    188190    @Override
    189191    public synchronized boolean remove(Object o) {
    190         @SuppressWarnings("unchecked") T t = (T) o;
     192        @SuppressWarnings("unchecked")
     193        T t = (T) o;
    191194        T tOrig = removeElem(t);
    192195        return tOrig != null;
     
    329332    private void ensureSpace() {
    330333        if (size > data.length*LOAD_FACTOR) { // rehash
    331             @SuppressWarnings("unchecked") T[] big = (T[]) new Object[data.length * 2];
     334            @SuppressWarnings("unchecked")
     335            T[] big = (T[]) new Object[data.length * 2];
    332336            int nMask = big.length - 1;
    333337
     
    387391        @Override
    388392        public boolean containsKey(Object o) {
    389             @SuppressWarnings("unchecked") K key = (K) o;
     393            @SuppressWarnings("unchecked")
     394            K key = (K) o;
    390395            int bucket = getBucket(fHash, key);
    391396            return bucket >= 0;
     
    399404        @Override
    400405        public T get(Object o) {
    401             @SuppressWarnings("unchecked") K key = (K) o;
     406            @SuppressWarnings("unchecked")
     407            K key = (K) o;
    402408            int bucket = getBucket(fHash, key);
    403409            return bucket < 0 ? null : data[bucket];
     
    414420            synchronized (Storage.this) {
    415421                modCount++;
    416                 @SuppressWarnings("unchecked") K key = (K) o;
     422                @SuppressWarnings("unchecked")
     423                K key = (K) o;
    417424                int bucket = getBucket(fHash, key);
    418425
Note: See TracChangeset for help on using the changeset viewer.