Class SimplePrimitiveId

    • Constructor Detail

      • SimplePrimitiveId

        public SimplePrimitiveId​(long id,
                                 OsmPrimitiveType type)
        Create a new primitive id
        Parameters:
        id - The id
        type - The type of the primitive
    • Method Detail

      • getUniqueId

        public long getUniqueId()
        Description copied from interface: PrimitiveId
        Gets a unique id representing this object (the OSM server id for OSM objects)
        Specified by:
        getUniqueId in interface PrimitiveId
        Returns:
        the id number
      • isNew

        public boolean isNew()
        Description copied from interface: PrimitiveId
        Replies true if this id represents a new primitive.
        Specified by:
        isNew in interface PrimitiveId
        Returns:
        true if this id represents a new primitive.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromString

        public static SimplePrimitiveId fromString​(java.lang.String s)
        Parses a SimplePrimitiveId from the string s.
        Parameters:
        s - the string to be parsed, e.g., n1, node1, w1, way1, r1, rel1, relation1.
        Returns:
        the parsed SimplePrimitiveId
        Throws:
        java.lang.IllegalArgumentException - if the string does not match the pattern
      • multipleFromString

        public static java.util.List<SimplePrimitiveIdmultipleFromString​(java.lang.String s)
        Parses a range SimplePrimitiveId from the string s.
        Parameters:
        s - the string to be parsed, e.g., node1, node1-7, node70-7.
        Returns:
        the parsed SimplePrimitiveIds
        Throws:
        java.lang.IllegalArgumentException - if the string does not match the pattern
      • fuzzyParse

        public static java.util.List<SimplePrimitiveIdfuzzyParse​(java.lang.String s)
        Attempts to parse extract any primitive id from the string s.
        Parameters:
        s - the string to be parsed, e.g., "n1, w1", "node1 and rel2", "node 123-29".
        Returns:
        the parsed list of OsmPrimitiveTypes.
      • toSimpleId

        public static java.lang.String toSimpleId​(PrimitiveId primitive)
        Convert a primitive to a simple id
        Parameters:
        primitive - The primitive to convert
        Returns:
        The type (may be n, w, or r, or something else) + the id (e.g., w42)
        Since:
        18829