org.openstreetmap.osmosis.core.domain.v0_6
Class Way

java.lang.Object
  extended by org.openstreetmap.osmosis.core.domain.v0_6.Entity
      extended by org.openstreetmap.osmosis.core.domain.v0_6.Way
All Implemented Interfaces:
java.lang.Comparable<Way>, Storeable

public class Way
extends Entity
implements java.lang.Comparable<Way>

A data class representing a single OSM way.

Author:
Brett Henderson

Constructor Summary
Way(CommonEntityData entityData)
          Creates a new instance.
Way(CommonEntityData entityData, java.util.List<WayNode> wayNodes)
          Creates a new instance.
Way(long id, int version, java.util.Date timestamp, OsmUser user, long changesetId)
          Creates a new instance.
Way(long id, int version, java.util.Date timestamp, OsmUser user, long changesetId, java.util.Collection<Tag> tags, java.util.List<WayNode> wayNodes)
          Creates a new instance.
Way(long id, int version, TimestampContainer timestampContainer, OsmUser user, long changesetId)
          Creates a new instance.
Way(long id, int version, TimestampContainer timestampContainer, OsmUser user, long changesetId, java.util.Collection<Tag> tags, java.util.List<WayNode> wayNodes)
          Creates a new instance.
Way(StoreReader sr, StoreClassRegister scr)
          Creates a new instance.
 
Method Summary
 int compareTo(Way comparisonWay)
          Compares this way to the specified way.
protected  int compareWayNodes(java.util.List<WayNode> comparisonWayNodes)
          Compares this node list to the specified node list.
 boolean equals(java.lang.Object o)
          
 EntityType getType()
          Returns the specific data type represented by this entity.
 java.util.List<WayNode> getWayNodes()
          Returns the attached list of way nodes.
 Way getWriteableInstance()
          Returns a writeable instance of this entity.
 int hashCode()
          
 boolean isClosed()
          Is this way closed? (A way is closed if the first node id equals the last node id.)
 void makeReadOnly()
          Configures the object to be read-only.
 void store(StoreWriter sw, StoreClassRegister scr)
          Stores all state to the specified store writer.
 java.lang.String toString()
          $.
 
Methods inherited from class org.openstreetmap.osmosis.core.domain.v0_6.Entity
assertWriteable, compareTags, getChangesetId, getFormattedTimestamp, getId, getTags, getTimestamp, getTimestampContainer, getUser, getVersion, isReadOnly, setChangesetId, setId, setTimestamp, setTimestampContainer, setUser, setVersion
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Way

public Way(long id,
           int version,
           java.util.Date timestamp,
           OsmUser user,
           long changesetId)
Creates a new instance.

Parameters:
id - The unique identifier.
version - The version of the entity.
timestamp - The last updated timestamp.
user - The user that last modified this entity.
changesetId - The id of the changeset that this version of the entity was created by.

Way

public Way(long id,
           int version,
           TimestampContainer timestampContainer,
           OsmUser user,
           long changesetId)
Creates a new instance.

Parameters:
id - The unique identifier.
version - The version of the entity.
timestampContainer - The container holding the timestamp in an alternative timestamp representation.
user - The name of the user that last modified this entity.
changesetId - The id of the changeset that this version of the entity was created by.

Way

public Way(CommonEntityData entityData)
Creates a new instance.

Parameters:
entityData - The common entity data.

Way

public Way(long id,
           int version,
           java.util.Date timestamp,
           OsmUser user,
           long changesetId,
           java.util.Collection<Tag> tags,
           java.util.List<WayNode> wayNodes)
Creates a new instance.

Parameters:
id - The unique identifier.
version - The version of the entity.
timestamp - The last updated timestamp.
user - The user that last modified this entity.
changesetId - The id of the changeset that this version of the entity was created by.
tags - The tags to apply to the object.
wayNodes - The way nodes to apply to the object

Way

public Way(long id,
           int version,
           TimestampContainer timestampContainer,
           OsmUser user,
           long changesetId,
           java.util.Collection<Tag> tags,
           java.util.List<WayNode> wayNodes)
Creates a new instance.

Parameters:
id - The unique identifier.
version - The version of the entity.
timestampContainer - The container holding the timestamp in an alternative timestamp representation.
user - The name of the user that last modified this entity.
changesetId - The id of the changeset that this version of the entity was created by.
tags - The tags to apply to the object.
wayNodes - The way nodes to apply to the object

Way

public Way(CommonEntityData entityData,
           java.util.List<WayNode> wayNodes)
Creates a new instance.

Parameters:
entityData - The common entity data.
wayNodes - The way nodes to apply to the object

Way

public Way(StoreReader sr,
           StoreClassRegister scr)
Creates a new instance.

Parameters:
sr - The store to read state from.
scr - Maintains the mapping between classes and their identifiers within the store.
Method Detail

store

public void store(StoreWriter sw,
                  StoreClassRegister scr)
Stores all state to the specified store writer.

Specified by:
store in interface Storeable
Overrides:
store in class Entity
Parameters:
sw - The writer that persists data to an underlying store.
scr - Maintains the mapping between classes and their identifiers within the store.

getType

public EntityType getType()
Returns the specific data type represented by this entity.

Specified by:
getType in class Entity
Returns:
The entity type enum value.

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

compareWayNodes

protected int compareWayNodes(java.util.List<WayNode> comparisonWayNodes)
Compares this node list to the specified node list. The comparison is based on a direct comparison of the node ids.

Parameters:
comparisonWayNodes - The node list to compare to.
Returns:
0 if equal, < 0 if considered "smaller", and > 0 if considered "bigger".

compareTo

public int compareTo(Way comparisonWay)
Compares this way to the specified way. The way comparison is based on a comparison of id, version, timestamp, wayNodeList and tags in that order.

Specified by:
compareTo in interface java.lang.Comparable<Way>
Parameters:
comparisonWay - The way to compare to.
Returns:
0 if equal, < 0 if considered "smaller", and > 0 if considered "bigger".

makeReadOnly

public void makeReadOnly()
Configures the object to be read-only. This should be called if the object is to be processed by multiple threads concurrently. It updates the read-only status of the object, and makes all collections unmodifiable. This must be overridden by sub-classes to make their own collections unmodifiable.

Overrides:
makeReadOnly in class Entity

getWayNodes

public java.util.List<WayNode> getWayNodes()
Returns the attached list of way nodes. The returned list is read-only.

Returns:
The wayNodeList.

getWriteableInstance

public Way getWriteableInstance()
Returns a writeable instance of this entity. If the object is read-only a clone is created, if it is already writeable then this object is returned.

Specified by:
getWriteableInstance in class Entity
Returns:
A writeable instance of this entity.

isClosed

public boolean isClosed()
Is this way closed? (A way is closed if the first node id equals the last node id.)

Returns:
True or false

toString

public java.lang.String toString()
$.

Overrides:
toString in class java.lang.Object