Package org.heigit.ohsome.oshdb.osh
Class OSHEntities
- java.lang.Object
-
- org.heigit.ohsome.oshdb.osh.OSHEntities
-
public final class OSHEntities extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OSMEntity
getByTimestamp(OSHEntity osh, OSHDBTimestamp timestamp)
Returns the OSM entity ("version") of the OSH entity which was current at the given timestamp.static <T extends OSMEntity>
List<T>toList(Iterable<T> versions)
Collects all versions of an OSH entity from an iterable (OSHEntity.getVersions()
) into a list.static <T extends OSMEntity,R>
List<R>toList(Iterable<T> versions, Function<T,R> transformer)
Collects all versions of an OSH entity from an iterable (OSHEntity.getVersions()
) into a list after applying a transformation function.
-
-
-
Method Detail
-
toList
public static <T extends OSMEntity> List<T> toList(Iterable<T> versions)
Collects all versions of an OSH entity from an iterable (OSHEntity.getVersions()
) into a list.- Type Parameters:
T
- the type of the OSM entities:OSMNode
,OSMWay
orOSMRelation
- Parameters:
versions
- the versions of an OSH entity, as returned fromOSHEntity.getVersions()
- Returns:
- all versions of the OSH entity as a list, with the most recent version first.
-
toList
public static <T extends OSMEntity,R> List<R> toList(Iterable<T> versions, Function<T,R> transformer)
Collects all versions of an OSH entity from an iterable (OSHEntity.getVersions()
) into a list after applying a transformation function.- Type Parameters:
T
- the type of the OSM entities:OSMNode
,OSMWay
orOSMRelation
R
- the type of the returned list's items- Parameters:
versions
- the versions of an OSH entity, as returned fromOSHEntity.getVersions()
transformer
- a function which is called for each version- Returns:
- all versions of the OSH entity as a list, with the most recent version first.
-
getByTimestamp
public static OSMEntity getByTimestamp(OSHEntity osh, OSHDBTimestamp timestamp)
Returns the OSM entity ("version") of the OSH entity which was current at the given timestamp.- Parameters:
osh
- the OSH entity to process.timestamp
- the timestamp for which to return the state of the OSH entity.- Returns:
- the version (OSM entity) of the OSH entity which was current at the given timestamp or
null
if none could be found.
-
-