Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
- Timestamp:
- 2014-04-26T17:39:23+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r6889 r7005 25 25 private final List<StyleList> data; 26 26 27 private static final Storage<StyleCache> internPool = new Storage< StyleCache>(); // TODO: clean up the intern pool from time to time (after purge or layer removal)27 private static final Storage<StyleCache> internPool = new Storage<>(); // TODO: clean up the intern pool from time to time (after purge or layer removal) 28 28 29 29 public static final StyleCache EMPTY_STYLECACHE = (new StyleCache()).intern(); 30 30 31 31 private StyleCache() { 32 bd = new ArrayList< Double>();32 bd = new ArrayList<>(); 33 33 bd.add(0.0); 34 34 bd.add(Double.POSITIVE_INFINITY); 35 data = new ArrayList< StyleList>();35 data = new ArrayList<>(); 36 36 data.add(null); 37 37 } 38 38 39 39 private StyleCache(StyleCache s) { 40 bd = new ArrayList< Double>(s.bd);41 data = new ArrayList< StyleList>(s.data);40 bd = new ArrayList<>(s.bd); 41 data = new ArrayList<>(s.data); 42 42 } 43 43 … … 45 45 * List of Styles, immutable 46 46 */ 47 public static class StyleList implements Iterable<ElemStyle> 48 { 47 public static class StyleList implements Iterable<ElemStyle> { 49 48 private List<ElemStyle> lst; 50 49 50 /** 51 * Constructs a new {@code StyleList}. 52 */ 51 53 public StyleList() { 52 lst = new ArrayList< ElemStyle>();54 lst = new ArrayList<>(); 53 55 } 54 56 55 57 public StyleList(ElemStyle... init) { 56 lst = new ArrayList< ElemStyle>(Arrays.asList(init));58 lst = new ArrayList<>(Arrays.asList(init)); 57 59 } 58 60 59 61 public StyleList(Collection<ElemStyle> sl) { 60 lst = new ArrayList< ElemStyle>(sl);62 lst = new ArrayList<>(sl); 61 63 } 62 64 63 65 public StyleList(StyleList sl, ElemStyle s) { 64 lst = new ArrayList< ElemStyle>(sl.lst);66 lst = new ArrayList<>(sl.lst); 65 67 lst.add(s); 66 68 } … … 121 123 for (int i=0; i<data.size(); ++i) { 122 124 if (bd.get(i) < scale && scale <= bd.get(i+1)) { 123 return new Pair< StyleList, Range>(data.get(i), new Range(bd.get(i), bd.get(i+1)));125 return new Pair<>(data.get(i), new Range(bd.get(i), bd.get(i+1))); 124 126 } 125 127 }
Note:
See TracChangeset
for help on using the changeset viewer.