org.openstreetmap.josm.data.osm.history
Class HistoryWay

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
      extended by org.openstreetmap.josm.data.osm.history.HistoryWay
All Implemented Interfaces:
java.lang.Comparable<HistoryOsmPrimitive>

public class HistoryWay
extends HistoryOsmPrimitive

Represents an immutable OSM way in the context of a historical view on OSM data.


Field Summary
private  java.util.ArrayList<java.lang.Long> nodeIds
           
 
Constructor Summary
HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.util.Date timestamp)
          Constructs a new HistoryWay.
HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.util.Date timestamp, java.util.ArrayList<java.lang.Long> nodeIdList)
          Constructs a new HistoryWay with a given list of node ids.
HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.util.Date timestamp, boolean checkHistoricParams)
          Constructs a new HistoryWay with a configurable checking of historic parameters.
HistoryWay(Way w)
          Constructs a new HistoryWay from an existing Way.
 
Method Summary
 void addNode(long ref)
          adds a node id to the list nodes of this way
 java.lang.String getDisplayName(HistoryNameFormatter formatter)
          Replies the display name of a primitive formatted by formatter
 long getNodeId(int idx)
          replies the idx-th node id in the list of node ids of this way
 java.util.List<java.lang.Long> getNodes()
          replies an immutable list of the ways node ids
 int getNumNodes()
          replies the number of nodes in this way
 OsmPrimitiveType getType()
          replies the ways type, i.e.
 boolean isClosed()
          Replies true if this way is closed.
 
Methods inherited from class org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
compareTo, ensurePositiveLong, equals, forOsmPrimitive, get, getChangesetId, getId, getLocalName, getName, getPrimitiveId, getTags, getTimestamp, getUser, getVersion, hashCode, hasTag, isVisible, matches, matches, put, setTags, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeIds

private java.util.ArrayList<java.lang.Long> nodeIds
Constructor Detail

HistoryWay

public HistoryWay(long id,
                  long version,
                  boolean visible,
                  User user,
                  long changesetId,
                  java.util.Date timestamp)
           throws java.lang.IllegalArgumentException
Constructs a new HistoryWay.

Parameters:
id - the id (> 0 required)
version - the version (> 0 required)
visible - whether the node is still visible
user - the user (! null required)
changesetId - the changeset id (> 0 required if checkHistoricParams is true)
timestamp - the timestamp (! null required if checkHistoricParams is true)
Throws:
java.lang.IllegalArgumentException - if preconditions are violated

HistoryWay

public HistoryWay(long id,
                  long version,
                  boolean visible,
                  User user,
                  long changesetId,
                  java.util.Date timestamp,
                  boolean checkHistoricParams)
           throws java.lang.IllegalArgumentException
Constructs a new HistoryWay with a configurable checking of historic parameters. This is needed to build virtual HistoryWays for modified ways, which do not have a timestamp and a changeset id.

Parameters:
id - the id (> 0 required)
version - the version (> 0 required)
visible - whether the node is still visible
user - the user (! null required)
changesetId - the changeset id (> 0 required if checkHistoricParams is true)
timestamp - the timestamp (! null required if checkHistoricParams is true)
checkHistoricParams - if true, checks values of changesetId and timestamp
Throws:
java.lang.IllegalArgumentException - if preconditions are violated
Since:
5440

HistoryWay

public HistoryWay(long id,
                  long version,
                  boolean visible,
                  User user,
                  long changesetId,
                  java.util.Date timestamp,
                  java.util.ArrayList<java.lang.Long> nodeIdList)
           throws java.lang.IllegalArgumentException
Constructs a new HistoryWay with a given list of node ids.

Parameters:
id - the id (> 0 required)
version - the version (> 0 required)
visible - whether the node is still visible
user - the user (! null required)
changesetId - the changeset id (> 0 required if checkHistoricParams is true)
timestamp - the timestamp (! null required if checkHistoricParams is true)
nodeIdList - the node ids (! null required)
Throws:
java.lang.IllegalArgumentException - if preconditions are violated

HistoryWay

public HistoryWay(Way w)
Constructs a new HistoryWay from an existing Way.

Parameters:
w - the way
Method Detail

getNumNodes

public int getNumNodes()
replies the number of nodes in this way

Returns:
the number of nodes

getNodeId

public long getNodeId(int idx)
               throws java.lang.IndexOutOfBoundsException
replies the idx-th node id in the list of node ids of this way

Parameters:
idx - the index
Returns:
the idx-th node id
Throws:
java.lang.IndexOutOfBoundsException - thrown, if idx <0 || idx >= {#see getNumNodes()

getNodes

public java.util.List<java.lang.Long> getNodes()
replies an immutable list of the ways node ids

Returns:
the ways node ids

getType

public OsmPrimitiveType getType()
replies the ways type, i.e. OsmPrimitiveType.WAY

Specified by:
getType in class HistoryOsmPrimitive
Returns:
the ways type

addNode

public void addNode(long ref)
adds a node id to the list nodes of this way

Parameters:
ref - the node id to add

isClosed

public boolean isClosed()
Replies true if this way is closed.

Returns:
true if this way is closed.

getDisplayName

public java.lang.String getDisplayName(HistoryNameFormatter formatter)
Description copied from class: HistoryOsmPrimitive
Replies the display name of a primitive formatted by formatter

Specified by:
getDisplayName in class HistoryOsmPrimitive
Parameters:
formatter - The formatter used to generate a display name
Returns:
the display name


JOSM