Changeset 11349 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-11-30T01:57:13+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r11115 r11349 39 39 private static final ChangesetCache instance = new ChangesetCache(); 40 40 41 /** the cached changesets */ 42 private final Map<Integer, Changeset> cache = new HashMap<>(); 43 44 private final CopyOnWriteArrayList<ChangesetCacheListener> listeners = new CopyOnWriteArrayList<>(); 45 46 /** 47 * Constructs a new {@code ChangesetCache}. 48 */ 49 private ChangesetCache() { 50 Main.pref.addPreferenceChangeListener(this); 51 } 52 41 53 /** 42 54 * Replies the unique instance of the cache 43 *44 55 * @return the unique instance of the cache 45 56 */ … … 48 59 } 49 60 50 /** the cached changesets */ 51 private final Map<Integer, Changeset> cache = new HashMap<>(); 52 53 private final CopyOnWriteArrayList<ChangesetCacheListener> listeners = new CopyOnWriteArrayList<>(); 54 55 private ChangesetCache() { 56 Main.pref.addPreferenceChangeListener(this); 57 } 58 61 /** 62 * Add a changeset cache listener. 63 * @param listener changeset cache listener to add 64 */ 59 65 public void addChangesetCacheListener(ChangesetCacheListener listener) { 60 66 if (listener != null) { … … 63 69 } 64 70 71 /** 72 * Remove a changeset cache listener. 73 * @param listener changeset cache listener to remove 74 */ 65 75 public void removeChangesetCacheListener(ChangesetCacheListener listener) { 66 76 if (listener != null) { … … 90 100 } 91 101 102 /** 103 * Update a single changeset. 104 * @param cs changeset to update 105 */ 92 106 public void update(Changeset cs) { 93 107 DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this); … … 96 110 } 97 111 112 /** 113 * Update a collection of changesets. 114 * @param changesets changesets to update 115 */ 98 116 public void update(Collection<Changeset> changesets) { 99 117 if (changesets == null || changesets.isEmpty()) return; … … 105 123 } 106 124 125 /** 126 * Determines if the cache contains an entry for given changeset identifier. 127 * @param id changeset id 128 * @return {@code true} if the cache contains an entry for {@code id} 129 */ 107 130 public boolean contains(int id) { 108 131 if (id <= 0) return false; … … 110 133 } 111 134 135 /** 136 * Determines if the cache contains an entry for given changeset. 137 * @param cs changeset 138 * @return {@code true} if the cache contains an entry for {@code cs} 139 */ 112 140 public boolean contains(Changeset cs) { 113 141 if (cs == null) return false; … … 116 144 } 117 145 146 /** 147 * Returns the entry for given changeset identifier. 148 * @param id changeset id 149 * @return the entry for given changeset identifier, or null 150 */ 118 151 public Changeset get(int id) { 119 152 return cache.get(id); 120 153 } 121 154 155 /** 156 * Returns the list of changesets contained in the cache. 157 * @return the list of changesets contained in the cache 158 */ 122 159 public Set<Changeset> getChangesets() { 123 160 return new HashSet<>(cache.values()); … … 132 169 } 133 170 171 /** 172 * Remove the entry for the given changeset identifier. 173 * A {@link ChangesetCacheEvent} is fired. 174 * @param id changeset id 175 */ 134 176 public void remove(int id) { 135 177 DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this); … … 140 182 } 141 183 184 /** 185 * Remove the entry for the given changeset. 186 * A {@link ChangesetCacheEvent} is fired. 187 * @param cs changeset 188 */ 142 189 public void remove(Changeset cs) { 143 190 if (cs == null) return; … … 147 194 148 195 /** 149 * Removes the changesets in <code>changesets</code> from the cache. A150 * {@link ChangesetCacheEvent} is fired.196 * Removes the changesets in <code>changesets</code> from the cache. 197 * A {@link ChangesetCacheEvent} is fired. 151 198 * 152 199 * @param changesets the changesets to remove. Ignored if null. … … 166 213 } 167 214 215 /** 216 * Returns the number of changesets contained in the cache. 217 * @return the number of changesets contained in the cache 218 */ 168 219 public int size() { 169 220 return cache.size(); 170 221 } 171 222 223 /** 224 * Clears the cache. 225 */ 172 226 public void clear() { 173 227 DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this); -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java
r9212 r11349 9 9 import java.util.Collection; 10 10 11 /** 12 * OSM primitive type. 13 * @since 1670 14 */ 11 15 public enum OsmPrimitiveType { 12 16 17 /** Node type */ 13 18 NODE(marktr(/* ICON(data/) */"node"), Node.class, NodeData.class), 19 /** Way type */ 14 20 WAY(marktr(/* ICON(data/) */"way"), Way.class, WayData.class), 21 /** Relation type */ 15 22 RELATION(marktr(/* ICON(data/) */"relation"), Relation.class, RelationData.class), 16 23 17 /* only for display, no real type */24 /** Closed way: only for display, no real type */ 18 25 CLOSEDWAY(marktr(/* ICON(data/) */"closedway"), null, WayData.class), 26 /** Multipolygon: only for display, no real type */ 19 27 MULTIPOLYGON(marktr(/* ICON(data/) */"multipolygon"), null, RelationData.class); 20 28 -
trunk/src/org/openstreetmap/josm/data/osm/UserInfo.java
r8510 r11349 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 8 9 /** 10 * Public user information. 11 * @since 2115 12 */ 9 13 public class UserInfo { 10 14 /** the user id */ … … 32 36 } 33 37 38 /** 39 * Returns the user identifier. 40 * @return the user identifier 41 */ 34 42 public int getId() { 35 43 return id; 36 44 } 37 45 46 /** 47 * Sets the user identifier. 48 * @param id the user identifier 49 */ 38 50 public void setId(int id) { 39 51 this.id = id; 40 52 } 41 53 54 /** 55 * Returns the display name. 56 * @return the display name 57 */ 42 58 public String getDisplayName() { 43 59 return displayName; 44 60 } 45 61 62 /** 63 * Sets the display name. 64 * @param displayName display name 65 */ 46 66 public void setDisplayName(String displayName) { 47 67 this.displayName = displayName; 48 68 } 49 69 70 /** 71 * Returns the date at which the account has been created. 72 * @return the user account creation date 73 */ 50 74 public Date getAccountCreated() { 51 75 return accountCreated; 52 76 } 53 77 78 /** 79 * Sets the date at which the account has been created. 80 * @param accountCreated user account creation date 81 */ 54 82 public void setAccountCreated(Date accountCreated) { 55 83 this.accountCreated = accountCreated; 56 84 } 57 85 86 /** 87 * Returns the user home coordinates, if set. 88 * @return the user home lat/lon or null 89 */ 58 90 public LatLon getHome() { 59 91 return home; 60 92 } 61 93 94 /** 95 * Sets the user home coordinates. 96 * @param home user home lat/lon or null 97 */ 62 98 public void setHome(LatLon home) { 63 99 this.home = home; 64 100 } 65 101 102 /** 103 * Returns the public account description. 104 * @return the public account description 105 */ 66 106 public String getDescription() { 67 107 return description; 68 108 } 69 109 110 /** 111 * Sets the public account description. 112 * @param description public account description 113 */ 70 114 public void setDescription(String description) { 71 115 this.description = description; 72 116 } 73 117 118 /** 119 * Returns the list of preferred languages. 120 * @return the list of preferred languages 121 */ 74 122 public List<String> getLanguages() { 75 123 return languages; 76 124 } 77 125 126 /** 127 * Sets the list of preferred languages. 128 * @param languages list of preferred languages 129 */ 78 130 public void setLanguages(List<String> languages) { 79 131 this.languages = languages; 80 132 } 81 133 134 /** 135 * Returns the user home zoom level. 136 * @return the user home zoom level 137 */ 82 138 public int getHomeZoom() { 83 139 return homeZoom; 84 140 } 85 141 142 /** 143 * Sets the user home zoom level. 144 * @param homeZoom user home zoom level 145 */ 86 146 public void setHomeZoom(int homeZoom) { 87 147 this.homeZoom = homeZoom;
Note:
See TracChangeset
for help on using the changeset viewer.