public class SimplePrimitiveId extends java.lang.Object implements PrimitiveId, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private long |
id |
static java.util.regex.Pattern |
ID_PATTERN
A pattern that is used to parse a textual primitive id
|
static java.util.regex.Pattern |
MULTIPLE_IDS_PATTERN
A pattern that is used to parse an id range
|
private static long |
serialVersionUID |
private OsmPrimitiveType |
type |
Constructor and Description |
---|
SimplePrimitiveId(long id,
OsmPrimitiveType type)
Create a new primtive id
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
private static java.util.List<SimplePrimitiveId> |
extractIdsInto(java.util.regex.MatchResult m,
java.util.List<SimplePrimitiveId> ids) |
static SimplePrimitiveId |
fromString(java.lang.String s)
Parses a
SimplePrimitiveId from the string s . |
static java.util.List<SimplePrimitiveId> |
fuzzyParse(java.lang.String s)
Attempts to parse extract any primitive id from the string
s . |
private static OsmPrimitiveType |
getOsmPrimitiveType(char firstChar) |
OsmPrimitiveType |
getType()
Gets the type of object represented by this object.
|
long |
getUniqueId()
Gets a unique id representing this object (the OSM server id for OSM objects)
|
int |
hashCode() |
boolean |
isNew()
Replies true if this id represents a new primitive.
|
static java.util.List<SimplePrimitiveId> |
multipleFromString(java.lang.String s)
Parses a range
SimplePrimitiveId from the string s . |
java.lang.String |
toString() |
private static final long serialVersionUID
private final long id
private final OsmPrimitiveType type
public static final java.util.regex.Pattern ID_PATTERN
public static final java.util.regex.Pattern MULTIPLE_IDS_PATTERN
public SimplePrimitiveId(long id, OsmPrimitiveType type)
id
- The idtype
- The type of the primitivepublic OsmPrimitiveType getType()
PrimitiveId
getType
in interface PrimitiveId
Node
,
Way
,
Relation
public long getUniqueId()
PrimitiveId
getUniqueId
in interface PrimitiveId
public boolean isNew()
PrimitiveId
isNew
in interface PrimitiveId
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static SimplePrimitiveId fromString(java.lang.String s)
SimplePrimitiveId
from the string s
.s
- the string to be parsed, e.g., n1
, node1
,
w1
, way1
, r1
, rel1
, relation1
.SimplePrimitiveId
java.lang.IllegalArgumentException
- if the string does not match the patternpublic static java.util.List<SimplePrimitiveId> multipleFromString(java.lang.String s)
SimplePrimitiveId
from the string s
.s
- the string to be parsed, e.g., node1
, node1-7
, node70-7
.SimplePrimitiveId
sjava.lang.IllegalArgumentException
- if the string does not match the patternpublic static java.util.List<SimplePrimitiveId> fuzzyParse(java.lang.String s)
s
.s
- the string to be parsed, e.g., "n1, w1"
, "node1 and rel2"
, "node 123-29"
.OsmPrimitiveType
s.private static java.util.List<SimplePrimitiveId> extractIdsInto(java.util.regex.MatchResult m, java.util.List<SimplePrimitiveId> ids)
private static OsmPrimitiveType getOsmPrimitiveType(char firstChar)