Ticket #12598: patch-fix-12598.patch

File patch-fix-12598.patch, 2.3 KB (added by michael2402, 10 years ago)
  • src/org/openstreetmap/josm/gui/mappaint/DividedScale.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java b/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
    index 4406051..50f6002 100644
    a b public class DividedScale<T> {  
    117117     * @param lower lower bound
    118118     * @param upper upper bound
    119119     */
    120     protected void putImpl(T o, double lower, double upper) {
     120    private void putImpl(T o, double lower, double upper) {
    121121        int i = 0;
    122122        while (bd.get(i) < lower) {
    123123            ++i;
    public class DividedScale<T> {  
    163163        }
    164164    }
    165165
     166    /**
     167     * Runs a consistency test.
     168     * @throws AssertionError When an invariant is broken.
     169     */
    166170    public void consistencyTest() {
    167171        if (bd.size() < 2) throw new AssertionError(bd);
    168172        if (data.isEmpty()) throw new AssertionError(data);
  • src/org/openstreetmap/josm/gui/mappaint/StyleCache.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java b/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
    index d3f2cea..3c640ec 100644
    a b import org.openstreetmap.josm.tools.Pair;  
    88
    99/**
    1010 * Caches styles for a single primitive.
     11 * <p>
     12 * This object is immutable.
    1113 */
    1214public final class StyleCache {
    1315
    public final class StyleCache {  
    3032    private StyleCache() {
    3133    }
    3234
     35    /**
     36     * Creates a new copy of this style cache with a new entry added.
     37     * @param o The style to cache.
     38     * @param r The range the style is for.
     39     * @param selected The style list we should use (selected/unselected)
     40     * @return The new object.
     41     */
    3342    public StyleCache put(StyleElementList o, Range r, boolean selected) {
    3443        StyleCache s = new StyleCache(this);
    3544
    3645        int idx = getIndex(selected);
    3746        DividedScale<StyleElementList> ds = s.states[idx];
    3847        if (ds == null) {
    39             ds = s.states[idx] = new DividedScale<>();
     48            ds = new DividedScale<>();
    4049        }
    41         ds.putImpl(o, r.getLower(), r.getUpper());
    42         ds.consistencyTest();
     50        s.states[idx] = ds.put(o, r);
    4351        s.intern();
    4452        return s;
    4553    }