org.openstreetmap.josm.data.osm
Class SimplePrimitiveId

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.SimplePrimitiveId
All Implemented Interfaces:
java.io.Serializable, PrimitiveId

public class SimplePrimitiveId
extends java.lang.Object
implements PrimitiveId, java.io.Serializable

See Also:
Serialized Form

Field Summary
private  long id
           
private  OsmPrimitiveType type
           
 
Constructor Summary
SimplePrimitiveId(long id, OsmPrimitiveType type)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static SimplePrimitiveId fromString(java.lang.String s)
          Parses a OsmPrimitiveType from the string s.
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private final long id

type

private final OsmPrimitiveType type
Constructor Detail

SimplePrimitiveId

public SimplePrimitiveId(long id,
                         OsmPrimitiveType type)
Method Detail

getType

public OsmPrimitiveType getType()
Description copied from interface: PrimitiveId
Gets the type of object represented by this object.

Specified by:
getType in interface PrimitiveId
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 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 OsmPrimitiveType from the string s.

Parameters:
s - the string to be parsed, e.g., n1, node1, w1, way1, r1, rel1, relation1.
Returns:
the parsed OsmPrimitiveType
Throws:
java.lang.IllegalArgumentException - if the string does not match the pattern


JOSM