Modifier and Type | Class and Description |
---|---|
private static interface |
History.FilterPredicate |
Modifier and Type | Field and Description |
---|---|
private long |
id
the object id
|
private OsmPrimitiveType |
type
the object type
|
private List<HistoryOsmPrimitive> |
versions
the list of object snapshots
|
Modifier | Constructor and Description |
---|---|
protected |
History(long id,
OsmPrimitiveType type,
List<HistoryOsmPrimitive> versions)
Creates a new history for an OSM primitive.
|
Modifier and Type | Method and Description |
---|---|
History |
between(Date fromDate,
Date untilDate)
Returns a new partial copy of this history, between the given dates
|
History |
between(long fromVersion,
long untilVersion)
Returns a new partial copy of this history, betwwen the given version numbers
|
boolean |
contains(long version)
Determines if this history contains a specific version number.
|
private static History |
filter(History history,
History.FilterPredicate predicate) |
History |
forUserId(long uid)
Returns a new partial copy of this history, for the given user id
|
History |
from(Date fromDate)
Returns a new partial copy of this history, from the given date
|
History |
from(long fromVersion)
Returns a new partial copy of this history, from the given version number
|
HistoryOsmPrimitive |
get(int idx)
Replies the history primitive at index
idx . |
HistoryOsmPrimitive |
getByDate(Date date)
Replies the history primitive at given
date . |
HistoryOsmPrimitive |
getByVersion(long version)
Replies the history primitive with version
version . |
HistoryOsmPrimitive |
getEarliest()
Replies the earliest entry of this history.
|
long |
getId()
Replies the primitive id for this history.
|
HistoryOsmPrimitive |
getLatest()
Replies the latest entry of this history.
|
int |
getNumVersions()
Replies the number of versions.
|
PrimitiveId |
getPrimitiveId()
Replies the primitive id for this history.
|
OsmPrimitiveType |
getType()
Replies the primitive type for this history.
|
boolean |
isEmpty()
Returns true if this history contains no version.
|
History |
sortAscending()
Returns a new copy of this history, sorted in ascending order.
|
History |
sortDescending()
Returns a new copy of this history, sorted in descending order.
|
String |
toString() |
History |
until(Date untilDate)
Returns a new partial copy of this history, until the given date
|
History |
until(long untilVersion)
Returns a new partial copy of this history, to the given version number
|
private final List<HistoryOsmPrimitive> versions
private final long id
private final OsmPrimitiveType type
protected History(long id, OsmPrimitiveType type, List<HistoryOsmPrimitive> versions)
id
- the id. > 0 required.type
- the primitive type. Must not be null.versions
- a list of versions. Can be null.IllegalArgumentException
- if id <= 0IllegalArgumentException
- if type is nullprivate static History filter(History history, History.FilterPredicate predicate)
public History sortAscending()
public History sortDescending()
public History from(Date fromDate)
fromDate
- the starting datepublic History until(Date untilDate)
untilDate
- the end datepublic History between(Date fromDate, Date untilDate)
fromDate
- the starting dateuntilDate
- the end datepublic History from(long fromVersion)
fromVersion
- the starting version numberpublic History until(long untilVersion)
untilVersion
- the ending version numberpublic History between(long fromVersion, long untilVersion)
fromVersion
- the starting version numberuntilVersion
- the ending version numberpublic History forUserId(long uid)
uid
- the user idpublic long getId()
getPrimitiveId()
,
getType()
public PrimitiveId getPrimitiveId()
getId()
public boolean contains(long version)
version
- the version number to look fortrue
if this history contains version
, false
otherwisepublic HistoryOsmPrimitive getByVersion(long version)
version
. null,
if no such primitive exists.version
- the versionversion
public HistoryOsmPrimitive getByDate(Date date)
date
. null,
if no such primitive exists.date
- the datedate
public HistoryOsmPrimitive get(int idx) throws IndexOutOfBoundsException
idx
.idx
- the indexidx
IndexOutOfBoundsException
- if index out or rangepublic HistoryOsmPrimitive getEarliest()
public HistoryOsmPrimitive getLatest()
public int getNumVersions()
public final boolean isEmpty()
true
if this history contains no version, false
otherwisepublic OsmPrimitiveType getType()
getId()