Ignore:
Timestamp:
2016-04-10T23:53:54+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar, javadoc

Location:
trunk/src/org/openstreetmap/josm/gui/tagging/ac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionItemPriority.java

    r9231 r10137  
    77 *
    88 * Instances of this class are not modifiable.
     9 * @since 1762
    910 */
    1011public class AutoCompletionItemPriority implements Comparable<AutoCompletionItemPriority> {
     
    4445    private final boolean selected;
    4546
    46 
    4747    /**
    48      * Create new AutoCompletionItemPriority object.
     48     * Constructs a new {@code AutoCompletionItemPriority}.
    4949     *
    5050     * @param inDataSet true, if the item is found in the currently active data layer
    51      * @param inStandard true, if the item is a standard tag, e.g. from the presets.
     51     * @param inStandard true, if the item is a standard tag, e.g. from the presets
    5252     * @param selected true, if it is found on an object that is currently selected
    5353     * @param userInput null, if the user hasn't entered this tag so far. A number when
     
    6262    }
    6363
     64    /**
     65     * Constructs a new {@code AutoCompletionItemPriority}.
     66     *
     67     * @param inDataSet true, if the item is found in the currently active data layer
     68     * @param inStandard true, if the item is a standard tag, e.g. from the presets
     69     * @param selected true, if it is found on an object that is currently selected
     70     */
    6471    public AutoCompletionItemPriority(boolean inDataSet, boolean inStandard, boolean selected) {
    6572        this(inDataSet, inStandard, selected, NO_USER_INPUT);
    6673    }
    6774
     75    /**
     76     * Determines if the item is found in the currently active data layer.
     77     * @return {@code true} if the item is found in the currently active data layer
     78     */
    6879    public boolean isInDataSet() {
    6980        return inDataSet;
    7081    }
    7182
     83    /**
     84     * Determines if the item is a standard tag, e.g. from the presets.
     85     * @return {@code true} if the item is a standard tag, e.g. from the presets
     86     */
    7287    public boolean isInStandard() {
    7388        return inStandard;
    7489    }
    7590
     91    /**
     92     * Determines if it is found on an object that is currently selected.
     93     * @return {@code true} if it is found on an object that is currently selected
     94     */
    7695    public boolean isSelected() {
    7796        return selected;
    7897    }
    7998
     99    /**
     100     * Returns a number when the tag key / value has been entered by the user before.
     101     * A lower number means this happened more recently and beats a higher number in priority.
     102     * @return a number when the tag key / value has been entered by the user before.
     103     *         {@code null}, if the user hasn't entered this tag so far.
     104     */
    80105    public Integer getUserInput() {
    81106        return userInput == NO_USER_INPUT ? null : userInput;
     
    89114    public int compareTo(AutoCompletionItemPriority other) {
    90115        int ui = Integer.compare(other.userInput, userInput);
    91         if (ui != 0) return ui;
     116        if (ui != 0)
     117            return ui;
    92118
    93119        int sel = Boolean.valueOf(selected).compareTo(other.selected);
    94         if (sel != 0) return sel;
     120        if (sel != 0)
     121            return sel;
    95122
    96123        int ds = Boolean.valueOf(inDataSet).compareTo(other.inDataSet);
    97         if (ds != 0) return ds;
     124        if (ds != 0)
     125            return ds;
    98126
    99127        int std = Boolean.valueOf(inStandard).compareTo(other.inStandard);
    100         if (std != 0) return std;
     128        if (std != 0)
     129            return std;
    101130
    102131        return 0;
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r9078 r10137  
    2828 * AutoCompletionList is an {@link AbstractTableModel} which serves the list of filtered
    2929 * items to a {@link JTable}.
    30  *
     30 * @since 1762
    3131 */
    3232public class AutoCompletionList extends AbstractTableModel {
     
    6767    /**
    6868     * clears the current filter
    69      *
    7069     */
    7170    public void clearFilter() {
     
    135134     */
    136135    public void add(Collection<String> values, AutoCompletionItemPriority priority) {
    137         if (values == null) return;
    138         for (String value: values) {
     136        if (values == null)
     137            return;
     138        for (String value : values) {
    139139            if (value == null) {
    140140                continue;
     
    148148    }
    149149
     150    /**
     151     * Adds values that have been entered by the user.
     152     * @param values values that have been entered by the user
     153     */
    150154    public void addUserInput(Collection<String> values) {
    151         if (values == null) return;
     155        if (values == null)
     156            return;
    152157        int i = 0;
    153         for (String value: values) {
    154             if (value == null) {
    155                 continue;
    156             }
    157             AutoCompletionListItem item = new AutoCompletionListItem(value, new AutoCompletionItemPriority(false, false, false, i));
    158             appendOrUpdatePriority(item);
    159             i++;
     158        for (String value : values) {
     159            if (value != null) {
     160                appendOrUpdatePriority(
     161                        new AutoCompletionListItem(value, new AutoCompletionItemPriority(false, false, false, i++)));
     162            }
    160163        }
    161164        sort();
Note: See TracChangeset for help on using the changeset viewer.