Changeset 13669 in josm for trunk


Ignore:
Timestamp:
2018-04-23T22:40:10+02:00 (7 years ago)
Author:
Don-vip
Message:

move a few methods from Node to INode

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

Legend:

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

    r13666 r13669  
    4343    void setEastNorth(EastNorth eastNorth);
    4444
     45    /**
     46     * Check whether this node connects 2 ways.
     47     *
     48     * @return true if isReferredByWays(2) returns true
     49     * @see #isReferredByWays(int)
     50     * @since 13669
     51     */
     52    default boolean isConnectionNode() {
     53        return isReferredByWays(2);
     54    }
     55
     56    /**
     57     * Return true, if this primitive is referred by at least n ways
     58     * @param n Minimal number of ways to return true. Must be positive
     59     * @return {@code true} if this primitive is referred by at least n ways
     60     * @since 13669
     61     */
     62    boolean isReferredByWays(int n);
     63
    4564    @Override
    4665    default int compareTo(IPrimitive o) {
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r13666 r13669  
    325325    }
    326326
    327     /**
    328      * Check whether this node connects 2 ways.
    329      *
    330      * @return true if isReferredByWays(2) returns true
    331      * @see #isReferredByWays(int)
    332      */
    333     public boolean isConnectionNode() {
    334         return isReferredByWays(2);
     327    @Override
     328    public boolean isReferredByWays(int n) {
     329        return isNodeReferredByWays(n);
    335330    }
    336331
  • trunk/src/org/openstreetmap/josm/data/osm/NodeData.java

    r13173 r13669  
    9999        visitor.visit(this);
    100100    }
     101
     102    @Override
     103    public boolean isReferredByWays(int n) {
     104        return false;
     105    }
    101106}
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13667 r13669  
    10241024
    10251025    /**
    1026       Return true, if this primitive is referred by at least n ways
    1027       @param n Minimal number of ways to return true. Must be positive
     1026     * Return true, if this primitive is a node referred by at least n ways
     1027     * @param n Minimal number of ways to return true. Must be positive
    10281028     * @return {@code true} if this primitive is referred by at least n ways
    10291029     */
    1030     public final boolean isReferredByWays(int n) {
     1030    protected final boolean isNodeReferredByWays(int n) {
    10311031        // Count only referrers that are members of the same dataset (primitive can have some fake references, for example
    10321032        // when way is cloned
Note: See TracChangeset for help on using the changeset viewer.