Package org.openstreetmap.josm.data.osm
Class SimplePrimitiveId
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.SimplePrimitiveId
-
- All Implemented Interfaces:
Serializable
,PrimitiveId
public class SimplePrimitiveId extends Object implements PrimitiveId, Serializable
A primitive id and a primitive type- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private long
id
static Pattern
ID_PATTERN
A pattern that is used to parse a textual primitive idstatic Pattern
MULTIPLE_IDS_PATTERN
A pattern that is used to parse an id rangeprivate static long
serialVersionUID
private OsmPrimitiveType
type
-
Constructor Summary
Constructors Constructor Description SimplePrimitiveId(long id, OsmPrimitiveType type)
Create a new primitive id
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
private static List<SimplePrimitiveId>
extractIdsInto(MatchResult m, List<SimplePrimitiveId> ids)
static SimplePrimitiveId
fromString(String s)
Parses aSimplePrimitiveId
from the strings
.static List<SimplePrimitiveId>
fuzzyParse(String s)
Attempts to parse extract any primitive id from the strings
.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 List<SimplePrimitiveId>
multipleFromString(String s)
Parses a rangeSimplePrimitiveId
from the strings
.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
id
private final long id
-
type
private final OsmPrimitiveType type
-
ID_PATTERN
public static final Pattern ID_PATTERN
A pattern that is used to parse a textual primitive id
-
MULTIPLE_IDS_PATTERN
public static final Pattern MULTIPLE_IDS_PATTERN
A pattern that is used to parse an id range
-
-
Constructor Detail
-
SimplePrimitiveId
public SimplePrimitiveId(long id, OsmPrimitiveType type)
Create a new primitive id- Parameters:
id
- The idtype
- The type of the primitive
-
-
Method Detail
-
getType
public OsmPrimitiveType getType()
Description copied from interface:PrimitiveId
Gets the type of object represented by this object.- Specified by:
getType
in interfacePrimitiveId
- Returns:
- the object type
- See Also:
Node
,Way
,Relation
-
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 interfacePrimitiveId
- 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 interfacePrimitiveId
- Returns:
- true if this id represents a new primitive.
-
fromString
public static SimplePrimitiveId fromString(String s)
Parses aSimplePrimitiveId
from the strings
.- Parameters:
s
- the string to be parsed, e.g.,n1
,node1
,w1
,way1
,r1
,rel1
,relation1
.- Returns:
- the parsed
SimplePrimitiveId
- Throws:
IllegalArgumentException
- if the string does not match the pattern
-
multipleFromString
public static List<SimplePrimitiveId> multipleFromString(String s)
Parses a rangeSimplePrimitiveId
from the strings
.- Parameters:
s
- the string to be parsed, e.g.,node1
,node1-7
,node70-7
.- Returns:
- the parsed
SimplePrimitiveId
s - Throws:
IllegalArgumentException
- if the string does not match the pattern
-
fuzzyParse
public static List<SimplePrimitiveId> fuzzyParse(String s)
Attempts to parse extract any primitive id from the strings
.- Parameters:
s
- the string to be parsed, e.g.,"n1, w1"
,"node1 and rel2"
,"node 123-29"
.- Returns:
- the parsed list of
OsmPrimitiveType
s.
-
extractIdsInto
private static List<SimplePrimitiveId> extractIdsInto(MatchResult m, List<SimplePrimitiveId> ids)
-
getOsmPrimitiveType
private static OsmPrimitiveType getOsmPrimitiveType(char firstChar)
-
-