Changeset 16179 in josm for trunk/src/org


Ignore:
Timestamp:
2020-03-21T10:38:57+01:00 (5 years ago)
Author:
Don-vip
Message:

code cleanup / javadoc

Location:
trunk/src/org/openstreetmap/josm/gui/tagging/presets
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r16080 r16179  
    3636
    3737    // cache the parsing of types using a LRU cache
    38     private static final Map<String, Set<TaggingPresetType>> TYPE_CACHE = new LruCache<>(16);;
     38    private static final Map<String, Set<TaggingPresetType>> TYPE_CACHE = new LruCache<>(16);
    3939
    4040    protected void initAutoCompletionField(AutoCompletingTextField field, String... key) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r16069 r16179  
    245245                    if (all.contains(tp)) {
    246246                        lastmenuOriginal = tp;
    247                         java.util.Optional<TaggingPreset> val = all.stream().filter(tp::equals).findFirst();
    248                         if (val.isPresent())
    249                             tp = (TaggingPresetMenu) val.get();
     247                        tp = (TaggingPresetMenu) all.stream().filter(tp::equals).findFirst().orElse(tp);
    250248                        lastmenuOriginal.group = null;
    251249                    } else {
     
    435433    }
    436434
     435    /**
     436     * Returns the zip file where the icons are located
     437     * @return the zip file where the icons are located
     438     */
    437439    public static File getZipIcons() {
    438440        return zipIcons;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r16045 r16179  
    345345            Collections.sort(result);
    346346            return result;
    347 
    348         }
    349 
     347        }
     348
     349        /**
     350         * Clears the selector.
     351         */
    350352        public void clear() {
    351353            classifications.clear();
    352354        }
    353355
     356        /**
     357         * Loads a given collection of presets.
     358         * @param presets presets collection
     359         */
    354360        public void loadPresets(Collection<TaggingPreset> presets) {
    355361            for (TaggingPreset preset : presets) {
     
    395401    }
    396402
     403    /**
     404     * Initializes the selector with a given collection of presets.
     405     * @param presets presets collection
     406     */
    397407    public void init(Collection<TaggingPreset> presets) {
    398408        classifications.clear();
     
    442452    }
    443453
     454    /**
     455     * Selects a given preset.
     456     * @param p preset to select
     457     */
    444458    public synchronized void setSelectedPreset(TaggingPreset p) {
    445459        lsResult.setSelectedValue(p, true);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r16089 r16179  
    547547    }
    548548
     549    /**
     550     * Sets whether the last value is used as default.
     551     * @param v Using "force" (2) enforces this behaviour also for already tagged objects. Default is "false" (0).
     552     */
    549553    public void setUse_last_as_default(String v) { // NOPMD
    550554        if ("force".equals(v)) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java

    r16042 r16179  
    4040     */
    4141    public static class Role {
     42        /** Presets types expected for this role */
    4243        public Set<TaggingPresetType> types; // NOSONAR
    4344        /** Role name used in a relation */
     
    5859        private short count;
    5960
     61        /**
     62         * Sets the presets types expected for this role.
     63         * @param types comma-separated set of expected types
     64         * @throws SAXException if an unknown type is detected
     65         */
    6066        public void setType(String types) throws SAXException {
    6167            this.types = getType(types);
    6268        }
    6369
     70        /**
     71         * Sets wether this role is required at least once in the relation.
     72         * @param str "required" or "optional"
     73         * @throws SAXException if str is neither "required" or "optional"
     74         */
    6475        public void setRequisite(String str) throws SAXException {
    6576            if ("required".equals(str)) {
     
    6980        }
    7081
     82        /**
     83         * Sets wether the role name is a regular expression.
     84         * @param str "true" or "false"
     85         * @throws SAXException if str is neither "true" or "false"
     86         */
    7187        public void setRegexp(String str) throws SAXException {
    7288            if ("true".equals(str)) {
     
    7692        }
    7793
     94        /**
     95         * Sets an expression (cf. search dialog) for objects of this role
     96         * @param memberExpression an expression (cf. search dialog) for objects of this role
     97         * @throws SAXException in case of parsing error
     98         */
    7899        public void setMember_expression(String memberExpression) throws SAXException {
    79100            try {
     
    88109        }
    89110
     111        /**
     112         * Sets how often must the element appear.
     113         * @param count how often must the element appear
     114         */
    90115        public void setCount(String count) {
    91116            this.count = Short.parseShort(count);
     
    122147        }
    123148
     149        /**
     150         * Adds this role to the given panel.
     151         * @param p panel where to add this role
     152         * @return {@code true}
     153         */
    124154        public boolean addToPanel(JPanel p) {
    125155            String cstring;
Note: See TracChangeset for help on using the changeset viewer.