Changeset 9460 in josm for trunk/src


Ignore:
Timestamp:
2016-01-15T03:12:34+01:00 (4 years ago)
Author:
Don-vip
Message:

javadoc

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r9267 r9460  
    145145    }
    146146
    147     /**
    148      * Replies the version number as returned by the API. The version is 0 if the id is 0 or
    149      * if this primitive is incomplete.
    150      *
    151      * @see PrimitiveData#setVersion(int)
    152      */
    153147    @Override
    154148    public int getVersion() {
     
    156150    }
    157151
    158     /**
    159      * Replies the id of this primitive.
    160      *
    161      * @return the id of this primitive.
    162      */
    163152    @Override
    164153    public long getId() {
     
    178167
    179168    /**
    180      *
    181      * @return True if primitive is new (not yet uploaded the server, id <= 0)
     169     * Determines if this primitive is new.
     170     * @return {@code true} if this primitive is new (not yet uploaded the server, id <= 0)
    182171     */
    183172    @Override
     
    186175    }
    187176
    188     /**
    189      *
    190      * @return True if primitive is new or undeleted
    191      * @see #isNew()
    192      * @see #isUndeleted()
    193      */
    194177    @Override
    195178    public boolean isNewOrUndeleted() {
     
    197180    }
    198181
    199     /**
    200      * Sets the id and the version of this primitive if it is known to the OSM API.
    201      *
    202      * Since we know the id and its version it can't be incomplete anymore. incomplete
    203      * is set to false.
    204      *
    205      * @param id the id. > 0 required
    206      * @param version the version > 0 required
    207      * @throws IllegalArgumentException if id <= 0
    208      * @throws IllegalArgumentException if version <= 0
    209      * @throws DataIntegrityProblemException if id is changed and primitive was already added to the dataset
    210      */
    211182    @Override
    212183    public void setOsmId(long id, int version) {
     
    239210    }
    240211
    241     /**
    242      * Replies the user who has last touched this object. May be null.
    243      *
    244      * @return the user who has last touched this object. May be null.
    245      */
    246212    @Override
    247213    public User getUser() {
     
    249215    }
    250216
    251     /**
    252      * Sets the user who has last touched this object.
    253      *
    254      * @param user the user
    255      */
    256217    @Override
    257218    public void setUser(User user) {
     
    259220    }
    260221
    261     /**
    262      * Replies the id of the changeset this primitive was last uploaded to.
    263      * 0 if this primitive wasn't uploaded to a changeset yet or if the
    264      * changeset isn't known.
    265      *
    266      * @return the id of the changeset this primitive was last uploaded to.
    267      */
    268222    @Override
    269223    public int getChangesetId() {
     
    271225    }
    272226
    273     /**
    274      * Sets the changeset id of this primitive. Can't be set on a new
    275      * primitive.
    276      *
    277      * @param changesetId the id. >= 0 required.
    278      * @throws IllegalStateException if this primitive is new.
    279      * @throws IllegalArgumentException if id < 0
    280      */
    281227    @Override
    282228    public void setChangesetId(int changesetId) {
     
    291237    }
    292238
    293     /**
    294      * Replies the unique primitive id for this primitive
    295      *
    296      * @return the unique primitive id for this primitive
    297      */
    298239    @Override
    299240    public PrimitiveId getPrimitiveId() {
     
    315256    }
    316257
    317     /**
    318      * Time of last modification to this object. This is not set by JOSM but
    319      * read from the server and delivered back to the server unmodified. It is
    320      * used to check against edit conflicts.
    321      *
    322      * @return date of last modification
    323      */
    324258    @Override
    325259    public Date getTimestamp() {
     
    349283    }
    350284
    351     /**
    352      * Marks this primitive as being modified.
    353      *
    354      * @param modified true, if this primitive is to be modified
    355      */
    356285    @Override
    357286    public void setModified(boolean modified) {
     
    359288    }
    360289
    361     /**
    362      * Replies <code>true</code> if the object has been modified since it was loaded from
    363      * the server. In this case, on next upload, this object will be updated.
    364      *
    365      * Deleted objects are deleted from the server. If the objects are added (id=0),
    366      * the modified is ignored and the object is added to the server.
    367      *
    368      * @return <code>true</code> if the object has been modified since it was loaded from
    369      * the server
    370      */
    371290    @Override
    372291    public boolean isModified() {
     
    374293    }
    375294
    376     /**
    377      * Replies <code>true</code>, if the object has been deleted.
    378      *
    379      * @return <code>true</code>, if the object has been deleted.
    380      * @see #setDeleted(boolean)
    381      */
    382295    @Override
    383296    public boolean isDeleted() {
     
    385298    }
    386299
    387     /**
    388      * Replies <code>true</code> if the object has been deleted on the server and was undeleted by the user.
    389      * @return <code>true</code> if the object has been undeleted
    390      */
     300    @Override
    391301    public boolean isUndeleted() {
    392302        return (flags & (FLAG_VISIBLE + FLAG_DELETED)) == 0;
    393303    }
    394304
    395     /**
    396      * Replies <code>true</code>, if the object is usable
    397      * (i.e. complete and not deleted).
    398      *
    399      * @return <code>true</code>, if the object is usable.
    400      * @see #setDeleted(boolean)
    401      */
     305    @Override
    402306    public boolean isUsable() {
    403307        return (flags & (FLAG_DELETED + FLAG_INCOMPLETE)) == 0;
    404308    }
    405309
    406     /**
    407      * Checks if object is known to the server.
    408      * Replies true if this primitive is either unknown to the server (i.e. its id
    409      * is 0) or it is known to the server and it hasn't be deleted on the server.
    410      * Replies false, if this primitive is known on the server and has been deleted
    411      * on the server.
    412      *
    413      * @return <code>true</code>, if the object is visible on server.
    414      * @see #setVisible(boolean)
    415      */
    416310    @Override
    417311    public boolean isVisible() {
     
    419313    }
    420314
    421     /**
    422      * Sets whether this primitive is visible, i.e. whether it is known on the server
    423      * and not deleted on the server.
    424      *
    425      * @see #isVisible()
    426      * @throws IllegalStateException if visible is set to false on an primitive with id==0
    427      */
    428315    @Override
    429316    public void setVisible(boolean visible) {
     
    433320    }
    434321
    435     /**
    436      * Sets whether this primitive is deleted or not.
    437      *
    438      * Also marks this primitive as modified if deleted is true.
    439      *
    440      * @param deleted  true, if this primitive is deleted; false, otherwise
    441      */
    442322    @Override
    443323    public void setDeleted(boolean deleted) {
     
    774654    protected abstract void keysChangedImpl(Map<String, String> originalKeys);
    775655
    776     /**
    777      * Replies the name of this primitive. The default implementation replies the value
    778      * of the tag <tt>name</tt> or null, if this tag is not present.
    779      *
    780      * @return the name of this primitive
    781      */
    782656    @Override
    783657    public String getName() {
     
    785659    }
    786660
    787     /**
    788      * Replies a localized name for this primitive given by the value of the name tags
    789      * accessed from very specific (language variant) to more generic (default name).
    790      *
    791      * @see LanguageInfo#getLanguageCodes
    792      * @return the name of this primitive, <code>null</code> if no name exists
    793      */
    794661    @Override
    795662    public String getLocalName() {
  • trunk/src/org/openstreetmap/josm/data/osm/INode.java

    r8510 r9460  
    55import org.openstreetmap.josm.data.coor.LatLon;
    66
     7/**
     8 * INode captures the common functions of {@link Node} and {@link NodeData}.
     9 * @since 4098
     10 */
    711public interface INode extends IPrimitive {
    812
     13    /**
     14     * Returns lat/lon coordinates of this node.
     15     * @return lat/lon coordinates of this node
     16     */
    917    LatLon getCoor();
    1018
     19    /**
     20     * Sets lat/lon coordinates of this node.
     21     * @param coor lat/lon coordinates of this node
     22     */
    1123    void setCoor(LatLon coor);
    1224
     25    /**
     26     * Returns east/north coordinates of this node.
     27     * @return east/north coordinates of this node
     28     */
    1329    EastNorth getEastNorth();
    1430
     31    /**
     32     * Sets east/north coordinates of this node.
     33     * @param eastNorth east/north coordinates of this node
     34     */
    1535    void setEastNorth(EastNorth eastNorth);
    1636}
  • trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java

    r8565 r9460  
    55
    66import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
     7import org.openstreetmap.josm.tools.LanguageInfo;
    78
    89/**
    910 * IPrimitive captures the common functions of {@link OsmPrimitive} and {@link PrimitiveData}.
     11 * @since 4098
    1012 */
    1113public interface IPrimitive extends Tagged, PrimitiveId {
    1214
     15    /**
     16     * Replies <code>true</code> if the object has been modified since it was loaded from
     17     * the server. In this case, on next upload, this object will be updated.
     18     *
     19     * Deleted objects are deleted from the server. If the objects are added (id=0),
     20     * the modified is ignored and the object is added to the server.
     21     *
     22     * @return <code>true</code> if the object has been modified since it was loaded from
     23     * the server
     24     */
    1325    boolean isModified();
    1426
     27    /**
     28     * Marks this primitive as being modified.
     29     *
     30     * @param modified true, if this primitive is to be modified
     31     */
    1532    void setModified(boolean modified);
    1633
     34    /**
     35     * Checks if object is known to the server.
     36     * Replies true if this primitive is either unknown to the server (i.e. its id
     37     * is 0) or it is known to the server and it hasn't be deleted on the server.
     38     * Replies false, if this primitive is known on the server and has been deleted
     39     * on the server.
     40     *
     41     * @return <code>true</code>, if the object is visible on server.
     42     * @see #setVisible(boolean)
     43     */
    1744    boolean isVisible();
    1845
     46    /**
     47     * Sets whether this primitive is visible, i.e. whether it is known on the server
     48     * and not deleted on the server.
     49     * @param visible {@code true} if this primitive is visible
     50     *
     51     * @throws IllegalStateException if visible is set to false on an primitive with id==0
     52     * @see #isVisible()
     53     */
    1954    void setVisible(boolean visible);
    2055
     56    /**
     57     * Replies <code>true</code>, if the object has been deleted.
     58     *
     59     * @return <code>true</code>, if the object has been deleted.
     60     * @see #setDeleted(boolean)
     61     */
    2162    boolean isDeleted();
    2263
     64    /**
     65     * Sets whether this primitive is deleted or not.
     66     *
     67     * Also marks this primitive as modified if deleted is true.
     68     *
     69     * @param deleted  true, if this primitive is deleted; false, otherwise
     70     */
    2371    void setDeleted(boolean deleted);
    2472
     73    /**
     74     * Determines if this primitive is incomplete.
     75     * @return {@code true} if this primitive is incomplete, {@code false} otherwise
     76     */
    2577    boolean isIncomplete();
    2678
     79    /**
     80     * Replies <code>true</code> if the object has been deleted on the server and was undeleted by the user.
     81     * @return <code>true</code> if the object has been undeleted
     82     */
     83    boolean isUndeleted();
     84
     85    /**
     86     * Replies <code>true</code>, if the object is usable
     87     * (i.e. complete and not deleted).
     88     *
     89     * @return <code>true</code>, if the object is usable.
     90     * @see #setDeleted(boolean)
     91     */
     92    boolean isUsable();
     93
     94    /**
     95     * Determines if this primitive is new or undeleted.
     96     * @return True if primitive is new or undeleted
     97     * @see #isNew()
     98     * @see #isUndeleted()
     99     */
    27100    boolean isNewOrUndeleted();
    28101
     102    /**
     103     * Replies the id of this primitive.
     104     *
     105     * @return the id of this primitive.
     106     */
    29107    long getId();
    30108
     109    /**
     110     * Replies the unique primitive id for this primitive
     111     *
     112     * @return the unique primitive id for this primitive
     113     */
    31114    PrimitiveId getPrimitiveId();
    32115
     116    /**
     117     * Replies the version number as returned by the API. The version is 0 if the id is 0 or
     118     * if this primitive is incomplete.
     119     * @return the version number as returned by the API
     120     *
     121     * @see PrimitiveData#setVersion(int)
     122     */
    33123    int getVersion();
    34124
     125    /**
     126     * Sets the id and the version of this primitive if it is known to the OSM API.
     127     *
     128     * Since we know the id and its version it can't be incomplete anymore. incomplete
     129     * is set to false.
     130     *
     131     * @param id the id. &gt; 0 required
     132     * @param version the version &gt; 0 required
     133     * @throws IllegalArgumentException if id &lt;= 0
     134     * @throws IllegalArgumentException if version &lt;= 0
     135     * @throws DataIntegrityProblemException if id is changed and primitive was already added to the dataset
     136     */
    35137    void setOsmId(long id, int version);
    36138
     139    /**
     140     * Replies the user who has last touched this object. May be null.
     141     *
     142     * @return the user who has last touched this object. May be null.
     143     */
    37144    User getUser();
    38145
     146    /**
     147     * Sets the user who has last touched this object.
     148     *
     149     * @param user the user
     150     */
    39151    void setUser(User user);
    40152
     153    /**
     154     * Time of last modification to this object. This is not set by JOSM but
     155     * read from the server and delivered back to the server unmodified. It is
     156     * used to check against edit conflicts.
     157     *
     158     * @return date of last modification
     159     * @see #setTimestamp
     160     */
    41161    Date getTimestamp();
    42162
     163    /**
     164     * Time of last modification to this object. This is not set by JOSM but
     165     * read from the server and delivered back to the server unmodified. It is
     166     * used to check against edit conflicts.
     167     *
     168     * @return last modification as timestamp
     169     * @see #setRawTimestamp
     170     */
    43171    int getRawTimestamp();
    44172
     173    /**
     174     * Sets time of last modification to this object
     175     * @param timestamp date of last modification
     176     * @see #getTimestamp
     177     */
    45178    void setTimestamp(Date timestamp);
    46179
     180    /**
     181     * Sets time of last modification to this object
     182     * @param timestamp date of last modification
     183     * @see #getRawTimestamp
     184     */
    47185    void setRawTimestamp(int timestamp);
    48186
     187    /**
     188     * Determines if this primitive has no timestam information.
     189     * @return {@code true} if this primitive has no timestam information
     190     * @see #getTimestamp
     191     * @see #getRawTimestamp
     192     */
    49193    boolean isTimestampEmpty();
    50194
     195    /**
     196     * Replies the id of the changeset this primitive was last uploaded to.
     197     * 0 if this primitive wasn't uploaded to a changeset yet or if the
     198     * changeset isn't known.
     199     *
     200     * @return the id of the changeset this primitive was last uploaded to.
     201     */
    51202    int getChangesetId();
    52203
     204    /**
     205     * Sets the changeset id of this primitive. Can't be set on a new primitive.
     206     *
     207     * @param changesetId the id. &gt;= 0 required.
     208     * @throws IllegalStateException if this primitive is new.
     209     * @throws IllegalArgumentException if id &lt; 0
     210     */
    53211    void setChangesetId(int changesetId);
    54212
     213    /**
     214     * Makes the given visitor visit this primitive.
     215     * @param visitor visitor
     216     */
    55217    void accept(PrimitiveVisitor visitor);
    56218
     219    /**
     220     * Replies the name of this primitive. The default implementation replies the value
     221     * of the tag <tt>name</tt> or null, if this tag is not present.
     222     *
     223     * @return the name of this primitive
     224     */
    57225    String getName();
    58226
     227    /**
     228     * Replies a localized name for this primitive given by the value of the name tags
     229     * accessed from very specific (language variant) to more generic (default name).
     230     *
     231     * @return the name of this primitive, <code>null</code> if no name exists
     232     * @see LanguageInfo#getLanguageCodes
     233     */
    59234    String getLocalName();
    60235}
  • trunk/src/org/openstreetmap/josm/data/osm/IRelation.java

    r8510 r9460  
    22package org.openstreetmap.josm.data.osm;
    33
     4/**
     5 * IRelation captures the common functions of {@link Relation} and {@link RelationData}.
     6 * @since 4098
     7 */
    48public interface IRelation extends IPrimitive {
    59
     10    /**
     11     * Returns the number of members.
     12     * @return number of members
     13     */
    614    int getMembersCount();
    715
     16    /**
     17     * Returns id of the member at given index.
     18     * @param idx member index
     19     * @return id of the member at given index
     20     */
    821    long getMemberId(int idx);
    922
     23    /**
     24     * Returns role of the member at given index.
     25     * @param idx member index
     26     * @return role of the member at given index
     27     */
    1028    String getRole(int idx);
    1129
     30    /**
     31     * Returns type of the member at given index.
     32     * @param idx member index
     33     * @return type of the member at given index
     34     */
    1235    OsmPrimitiveType getMemberType(int idx);
    1336}
  • trunk/src/org/openstreetmap/josm/data/osm/IWay.java

    r8510 r9460  
    22package org.openstreetmap.josm.data.osm;
    33
     4/**
     5 * IWay captures the common functions of {@link Way} and {@link WayData}.
     6 * @since 4098
     7 */
    48public interface IWay extends IPrimitive {
    59
     10    /**
     11     * Replies the number of nodes in this way.
     12     *
     13     * @return the number of nodes in this way.
     14     */
    615    int getNodesCount();
    716
     17    /**
     18     * Returns id of the node at given index.
     19     * @param idx node index
     20     * @return id of the node at given index
     21     */
    822    long getNodeId(int idx);
    923
     24    /**
     25     * Determines if this way is closed.
     26     * @return {@code true} if this way is closed, {@code false} otherwise
     27     */
    1028    boolean isClosed();
    1129}
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r9243 r9460  
    6767    }
    6868
    69     /**
    70      * @return number of members
    71      */
    7269    @Override
    7370    public int getMembersCount() {
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r9243 r9460  
    9999    }
    100100
    101     /**
    102      * Replies the number of nodes in this way.
    103      *
    104      * @return the number of nodes in this way.
    105      * @since 1862
    106      */
    107101    @Override
    108102    public int getNodesCount() {
Note: See TracChangeset for help on using the changeset viewer.