Changeset 11349 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-11-30T01:57:13+01:00 (8 years ago)
Author:
Don-vip
Message:

javadoc

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  
    3939    private static final ChangesetCache instance = new ChangesetCache();
    4040
     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
    4153    /**
    4254     * Replies the unique instance of the cache
    43      *
    4455     * @return the unique instance of the cache
    4556     */
     
    4859    }
    4960
    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     */
    5965    public void addChangesetCacheListener(ChangesetCacheListener listener) {
    6066        if (listener != null) {
     
    6369    }
    6470
     71    /**
     72     * Remove a changeset cache listener.
     73     * @param listener changeset cache listener to remove
     74     */
    6575    public void removeChangesetCacheListener(ChangesetCacheListener listener) {
    6676        if (listener != null) {
     
    90100    }
    91101
     102    /**
     103     * Update a single changeset.
     104     * @param cs changeset to update
     105     */
    92106    public void update(Changeset cs) {
    93107        DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this);
     
    96110    }
    97111
     112    /**
     113     * Update a collection of changesets.
     114     * @param changesets changesets to update
     115     */
    98116    public void update(Collection<Changeset> changesets) {
    99117        if (changesets == null || changesets.isEmpty()) return;
     
    105123    }
    106124
     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     */
    107130    public boolean contains(int id) {
    108131        if (id <= 0) return false;
     
    110133    }
    111134
     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     */
    112140    public boolean contains(Changeset cs) {
    113141        if (cs == null) return false;
     
    116144    }
    117145
     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     */
    118151    public Changeset get(int id) {
    119152        return cache.get(id);
    120153    }
    121154
     155    /**
     156     * Returns the list of changesets contained in the cache.
     157     * @return the list of changesets contained in the cache
     158     */
    122159    public Set<Changeset> getChangesets() {
    123160        return new HashSet<>(cache.values());
     
    132169    }
    133170
     171    /**
     172     * Remove the entry for the given changeset identifier.
     173     * A {@link ChangesetCacheEvent} is fired.
     174     * @param id changeset id
     175     */
    134176    public void remove(int id) {
    135177        DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this);
     
    140182    }
    141183
     184    /**
     185     * Remove the entry for the given changeset.
     186     * A {@link ChangesetCacheEvent} is fired.
     187     * @param cs changeset
     188     */
    142189    public void remove(Changeset cs) {
    143190        if (cs == null) return;
     
    147194
    148195    /**
    149      * Removes the changesets in <code>changesets</code> from the cache. A
    150      * {@link ChangesetCacheEvent} is fired.
     196     * Removes the changesets in <code>changesets</code> from the cache.
     197     * A {@link ChangesetCacheEvent} is fired.
    151198     *
    152199     * @param changesets the changesets to remove. Ignored if null.
     
    166213    }
    167214
     215    /**
     216     * Returns the number of changesets contained in the cache.
     217     * @return the number of changesets contained in the cache
     218     */
    168219    public int size() {
    169220        return cache.size();
    170221    }
    171222
     223    /**
     224     * Clears the cache.
     225     */
    172226    public void clear() {
    173227        DefaultChangesetCacheEvent e = new DefaultChangesetCacheEvent(this);
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java

    r9212 r11349  
    99import java.util.Collection;
    1010
     11/**
     12 * OSM primitive type.
     13 * @since 1670
     14 */
    1115public enum OsmPrimitiveType {
    1216
     17    /** Node type */
    1318    NODE(marktr(/* ICON(data/) */"node"), Node.class, NodeData.class),
     19    /** Way type */
    1420    WAY(marktr(/* ICON(data/) */"way"), Way.class, WayData.class),
     21    /** Relation type */
    1522    RELATION(marktr(/* ICON(data/) */"relation"), Relation.class, RelationData.class),
    1623
    17     /* only for display, no real type */
     24    /** Closed way: only for display, no real type */
    1825    CLOSEDWAY(marktr(/* ICON(data/) */"closedway"), null, WayData.class),
     26    /** Multipolygon: only for display, no real type */
    1927    MULTIPOLYGON(marktr(/* ICON(data/) */"multipolygon"), null, RelationData.class);
    2028
  • trunk/src/org/openstreetmap/josm/data/osm/UserInfo.java

    r8510 r11349  
    77import org.openstreetmap.josm.data.coor.LatLon;
    88
     9/**
     10 * Public user information.
     11 * @since 2115
     12 */
    913public class UserInfo {
    1014    /** the user id */
     
    3236    }
    3337
     38    /**
     39     * Returns the user identifier.
     40     * @return the user identifier
     41     */
    3442    public int getId() {
    3543        return id;
    3644    }
    3745
     46    /**
     47     * Sets the user identifier.
     48     * @param id the user identifier
     49     */
    3850    public void setId(int id) {
    3951        this.id = id;
    4052    }
    4153
     54    /**
     55     * Returns the display name.
     56     * @return the display name
     57     */
    4258    public String getDisplayName() {
    4359        return displayName;
    4460    }
    4561
     62    /**
     63     * Sets the display name.
     64     * @param displayName display name
     65     */
    4666    public void setDisplayName(String displayName) {
    4767        this.displayName = displayName;
    4868    }
    4969
     70    /**
     71     * Returns the date at which the account has been created.
     72     * @return the user account creation date
     73     */
    5074    public Date getAccountCreated() {
    5175        return accountCreated;
    5276    }
    5377
     78    /**
     79     * Sets the date at which the account has been created.
     80     * @param accountCreated user account creation date
     81     */
    5482    public void setAccountCreated(Date accountCreated) {
    5583        this.accountCreated = accountCreated;
    5684    }
    5785
     86    /**
     87     * Returns the user home coordinates, if set.
     88     * @return the user home lat/lon or null
     89     */
    5890    public LatLon getHome() {
    5991        return home;
    6092    }
    6193
     94    /**
     95     * Sets the user home coordinates.
     96     * @param home user home lat/lon or null
     97     */
    6298    public void setHome(LatLon home) {
    6399        this.home = home;
    64100    }
    65101
     102    /**
     103     * Returns the public account description.
     104     * @return the public account description
     105     */
    66106    public String getDescription() {
    67107        return description;
    68108    }
    69109
     110    /**
     111     * Sets the public account description.
     112     * @param description public account description
     113     */
    70114    public void setDescription(String description) {
    71115        this.description = description;
    72116    }
    73117
     118    /**
     119     * Returns the list of preferred languages.
     120     * @return the list of preferred languages
     121     */
    74122    public List<String> getLanguages() {
    75123        return languages;
    76124    }
    77125
     126    /**
     127     * Sets the list of preferred languages.
     128     * @param languages list of preferred languages
     129     */
    78130    public void setLanguages(List<String> languages) {
    79131        this.languages = languages;
    80132    }
    81133
     134    /**
     135     * Returns the user home zoom level.
     136     * @return the user home zoom level
     137     */
    82138    public int getHomeZoom() {
    83139        return homeZoom;
    84140    }
    85141
     142    /**
     143     * Sets the user home zoom level.
     144     * @param homeZoom user home zoom level
     145     */
    86146    public void setHomeZoom(int homeZoom) {
    87147        this.homeZoom = homeZoom;
Note: See TracChangeset for help on using the changeset viewer.