Class TransitNetwork
java.lang.Object
rgu.transport.geospatial.multimodal.TransitNetwork
A multi-modal transit network. TransitNetwork is thread-safe, however, the builder object is not
thread-safe.
- Author:
- Lee A. Christie
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class, instance is obtained frombuilder(). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TransitNetwork.Builderbuilder()Creates a builder object from HashTransitNetwork.static TransitNetwork.Builderbuilder(boolean suppressDuplicates) Creates a builder object from HashTransitNetwork.static TransitNetwork.BuildercopyAll(Collection<TransitNetwork> networks, BiConsumer<GeoLocation, GeoLocation> edgeConsumer) Creates a builder by copying the contents of a collection of transit networks.voidDeprecated.booleanChecks whether this transit network is equal to the other object.inthashCode()A hashcode.Deprecated, for removal: This API element is subject to removal in a future version.Returns a neighbour finder based on which location is nearest on the Haversine space.nearestStretchedEuclidean(double ratio) Returns a neighbour finder based on which location is nearest on the Euclidean space.Returns a neighbour finder based on which location is nearest on the Euclidean space.outgoingTrips(GeoLocation from) Returns a list of Trips which depart from a given location.static final TransitNetworkstatic final TransitNetworkread(ObjectInputStream in, BiConsumer<GeoLocation, GeoLocation> consumer, BiConsumer<GeoLocation, GeoLocation> consumerArtificial) static final TransitNetworkread(ObjectInputStream in, Predicate<GeoLocation> spatialFilter, BiConsumer<GeoLocation, GeoLocation> consumer, BiConsumer<GeoLocation, GeoLocation> consumerArtificial) roadNeighbours(GeoLocation location) Returns a list of locations which are departure or arrival points for transit edges.Returns a list of Trips which arrive at a given location.searcher()Returns a search wrapper for this network.spatialTemporalGraph(boolean freeArtificial) spatialTemporalGraph(Map<GeoLocation, List<Trip>> extra) spatialTemporalGraph(Map<GeoLocation, List<Trip>> extra, boolean freeArtificial) Returns a list of locations which are departure points for transit edges.transitNeighbours(GeoLocation location) voidwrite(ObjectOutputStream out) Saves the transit network to the specified output stream.
-
Field Details
-
DEFAULT_WALK_SPEED
-
DEFAULT_CAR_SPEED
-
-
Method Details
-
searcher
Returns a search wrapper for this network.- Returns:
- a search wrapper for this network
-
copyAll
public static TransitNetwork.Builder copyAll(Collection<TransitNetwork> networks, BiConsumer<GeoLocation, GeoLocation> edgeConsumer) Creates a builder by copying the contents of a collection of transit networks.- Parameters:
networks- the networks to copy, not nulledgeConsumer- consumer for edges, can be null if not needed- Returns:
- a builder formed from a copy of the given networks
-
nearestHaversine
Returns a neighbour finder based on which location is nearest on the Haversine space.- Returns:
- a nearest finder
-
nearestEuclidean
Deprecated, for removal: This API element is subject to removal in a future version.Returns a neighbour finder based on which location is nearest on the Euclidean space.- Returns:
- a nearest finder
-
nearestStretchedEuclidean
Returns a neighbour finder based on which location is nearest on the Euclidean space.- Parameters:
ratio- the stretch ratio, finite, positive- Returns:
- a nearest finder
-
nearestStretchedEuclidean
Returns a neighbour finder based on which location is nearest on the Euclidean space.- Parameters:
at- the location to used to estimate local curvature- Returns:
- a nearest finder
-
transitDeparturePoints
Returns a list of locations which are departure points for transit edges. -
scanForAllTransitPoints
Returns a list of locations which are departure or arrival points for transit edges. Requires complete scan of all trips. -
outgoingTrips
Returns a list of Trips which depart from a given location. -
scanForIncomingTrips
Returns a list of Trips which arrive at a given location. Requires complete scan of all trips. -
hashCode
-
equals
-
builder
Creates a builder object from HashTransitNetwork. Builder is not thread-safe.- Returns:
- a new builder
-
builder
Creates a builder object from HashTransitNetwork. If suppressDuplicate is set, then no exception will be throw on adding duplicates, instead, the operation will be ignored. Builder is not thread-safe.- Returns:
- a new builder
-
locations
-
spatialTemporalGraph
-
spatialTemporalGraph
-
spatialTemporalGraph
-
spatialTemporalGraph
public Graph<JourneyState, Duration> spatialTemporalGraph(Map<GeoLocation, List<Trip>> extra, boolean freeArtificial) -
roadNeighbours
-
transitNeighbours
-
write
Saves the transit network to the specified output stream.- Parameters:
out- the output stream, not null- Throws:
IOException- if unable to write the network
-
read
- Throws:
IOException
-
read
public static final TransitNetwork read(ObjectInputStream in, BiConsumer<GeoLocation, GeoLocation> consumer, BiConsumer<GeoLocation, GeoLocation> consumerArtificial) throws IOException - Throws:
IOException
-
read
public static final TransitNetwork read(ObjectInputStream in, Predicate<GeoLocation> spatialFilter, BiConsumer<GeoLocation, GeoLocation> consumer, BiConsumer<GeoLocation, GeoLocation> consumerArtificial) throws IOException - Throws:
IOException
-
debugDump
Deprecated.- Throws:
FileNotFoundException
-
nearestStretchedEuclidean(double)ornearestStretchedEuclidean(double)