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> {
|
| 117 | 117 | * @param lower lower bound |
| 118 | 118 | * @param upper upper bound |
| 119 | 119 | */ |
| 120 | | protected void putImpl(T o, double lower, double upper) { |
| | 120 | private void putImpl(T o, double lower, double upper) { |
| 121 | 121 | int i = 0; |
| 122 | 122 | while (bd.get(i) < lower) { |
| 123 | 123 | ++i; |
| … |
… |
public class DividedScale<T> {
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| | 166 | /** |
| | 167 | * Runs a consistency test. |
| | 168 | * @throws AssertionError When an invariant is broken. |
| | 169 | */ |
| 166 | 170 | public void consistencyTest() { |
| 167 | 171 | if (bd.size() < 2) throw new AssertionError(bd); |
| 168 | 172 | if (data.isEmpty()) throw new AssertionError(data); |
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;
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Caches styles for a single primitive. |
| | 11 | * <p> |
| | 12 | * This object is immutable. |
| 11 | 13 | */ |
| 12 | 14 | public final class StyleCache { |
| 13 | 15 | |
| … |
… |
public final class StyleCache {
|
| 30 | 32 | private StyleCache() { |
| 31 | 33 | } |
| 32 | 34 | |
| | 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 | */ |
| 33 | 42 | public StyleCache put(StyleElementList o, Range r, boolean selected) { |
| 34 | 43 | StyleCache s = new StyleCache(this); |
| 35 | 44 | |
| 36 | 45 | int idx = getIndex(selected); |
| 37 | 46 | DividedScale<StyleElementList> ds = s.states[idx]; |
| 38 | 47 | if (ds == null) { |
| 39 | | ds = s.states[idx] = new DividedScale<>(); |
| | 48 | ds = new DividedScale<>(); |
| 40 | 49 | } |
| 41 | | ds.putImpl(o, r.getLower(), r.getUpper()); |
| 42 | | ds.consistencyTest(); |
| | 50 | s.states[idx] = ds.put(o, r); |
| 43 | 51 | s.intern(); |
| 44 | 52 | return s; |
| 45 | 53 | } |