Changeset 7254 in josm for trunk


Ignore:
Timestamp:
2014-06-19T11:09:04+02:00 (10 years ago)
Author:
simon04
Message:

see #9844 - RelationChecker: add unit tests, fix detected problem concerning role counts

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r7100 r7254  
    7070    /**
    7171     * Reads the presets data.
    72      *
    7372     */
    74     public void initializePresets() {
     73    public static synchronized void initializePresets() {
     74        if (!relationpresets.isEmpty()) {
     75            // the presets have already been initialized
     76            return;
     77        }
    7578        for (TaggingPreset p : TaggingPresets.getTaggingPresets()) {
    7679            for (TaggingPresetItem i : p.data) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r7171 r7254  
    170170
    171171        public boolean required = false;
    172         public long count = 0;
     172        private long count = 0;
    173173
    174174        public void setType(String types) throws SAXException {
     
    191191        }
    192192
    193         /* return either argument, the highest possible value or the lowest
    194            allowed value */
    195         public long getValidCount(long c)
    196         {
    197             if(count > 0 && !required)
     193        public void setCount(String count) {
     194            this.count = Long.parseLong(count);
     195        }
     196
     197        /**
     198         * Return either argument, the highest possible value or the lowest allowed value
     199         */
     200        public long getValidCount(long c) {
     201            if (count > 0 && !required)
    198202                return c != 0 ? count : 0;
    199             else if(count > 0)
     203            else if (count > 0)
    200204                return count;
    201             else if(!required)
    202                 return c != 0  ? c : 0;
     205            else if (!required)
     206                return c != 0 ? c : 0;
    203207            else
    204                 return c != 0  ? c : 1;
    205         }
     208                return c != 0 ? c : 1;
     209        }
     210
    206211        public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) {
    207212            String cstring;
Note: See TracChangeset for help on using the changeset viewer.