public class RouteSegment extends Object implements Validatable
RouteSegment is a part of a route that is traveled with a single
ModeOfTransport.
In its minimal form getNr(), getFrom(), getTo(),
getDistanceMeters(), getDurationSeconds(),
getModeOfTransport(), getStartTime(),
getEndTime(), and at least one of the geometry types are present.
Since this is a lot no createMinimal method is offered as its
invocations would be hardly readable.
A note on public transport: transfers between two lines (e.g. from bus 28A to subway U6) can be represented in two variants.
Constants.DetailedModeOfTransportType.TRANSFER is inserted before, between, and
after public transport segments. Such a transfer segment represents the
transfer within a (logical) public transport station including waiting times
for the next line. It contains the walking distance in the station (
getDistanceMeters()), the walking time (
getDurationSeconds() minus alighting time), and the waiting time for
the next public transport line (getAlightingSeconds()). The public
transport segments themselves only contain the ride time (without any
boarding or alighting time). When using this variant it is much easier to
differentiate between transfer and ride, e.g. regarding accessibility.getBoardingSeconds()), the transfer time to the next segment (
getAlightingSeconds()), and of course the ride time (
getDurationSeconds() minus boarding and alighting time).| Constructor and Description |
|---|
RouteSegment() |
public int getNr()
public Location<?> getFrom()
public Location<?> getTo()
public int getDistanceMeters()
public int getDurationSeconds()
public int getTravelTimeSeconds()
RouteSegment excluding
getBoardingSeconds() and getAlightingSeconds()
Note: not exported to JSON since it can be inferred
public ModeOfTransport getModeOfTransport()
public Optional<Integer> getBoardingSeconds()
public Optional<Integer> getAlightingSeconds()
Constants.DetailedModeOfTransportType.TRANSFER segment (PT_DETAILED),
transfer (walking) time in case this is a public transport segment
(PT_CONDENSED),..public String getStartTime()
RouteSegment, i.e. when boarding startspublic ZonedDateTime getStartTimeAsZonedDateTime()
public ZonedDateTime getDepartureTimeAsZonedDateTime()
RouteSegment, i.e. after boarding is
finished
Note: not exported to JSON since it can be inferred
public ZonedDateTime getArrivalTimeAsZonedDateTime()
RouteSegment, i.e. when alighting starts
Note: not exported to JSON since it can be inferred
public String getEndTime()
RouteSegment, i.e. when alighting is
finishedpublic ZonedDateTime getEndTimeAsZonedDateTime()
public List<IntermediateStop> getIntermediateStops()
public Optional<GeoJSONFeature<GeoJSONPolygon>> getBoundingBox()
public Optional<String> getGeometryEncodedPolyLine()
public Optional<GeoJSONFeature<GeoJSONLineString>> getGeometryGeoJson()
public Optional<GeoJSONFeatureCollection<GeoJSONLineString>> getGeometryGeoJsonEdges()
public List<Instruction<?>> getNavigationInstructions()
public List<Constants.Accessibility> getAccessibility()
public Map<String,Object> getAdditionalInfo()
public RouteSegment setNr(int nr)
public RouteSegment setFrom(Location<?> from)
public RouteSegment setTo(Location<?> to)
public RouteSegment setDistanceMeters(int distanceMeters)
public RouteSegment setDurationSeconds(int durationSeconds)
public RouteSegment setModeOfTransport(ModeOfTransport modeOfTransport)
public RouteSegment setBoardingSeconds(Integer boardingSeconds)
public RouteSegment setAlightingSeconds(Integer alightingSeconds)
public RouteSegment setStartTime(ZonedDateTime startTime)
public RouteSegment setStartTime(String startTime)
public RouteSegment setEndTime(ZonedDateTime endTime)
public RouteSegment setEndTime(String endTime)
public RouteSegment setIntermediateStops(List<IntermediateStop> intermediateStops)
public RouteSegment setBoundingBox(GeoJSONFeature<GeoJSONPolygon> boundingBox)
public RouteSegment setGeometryEncodedPolyLine(String geometryEncodedPolyLine)
public RouteSegment setGeometryGeoJson(GeoJSONFeature<GeoJSONLineString> geometryGeoJson)
public RouteSegment setGeometryGeoJsonEdges(GeoJSONFeatureCollection<GeoJSONLineString> geometryGeoJsonEdges)
public RouteSegment setNavigationInstructions(List<Instruction<?>> navigationInstructions)
public RouteSegment setAccessibility(List<Constants.Accessibility> accessibility)
public RouteSegment setAdditionalInfo(Map<String,Object> additionalInfo)
public RouteSegment shiftBySeconds(int amountToAdd)
public static RouteSegment createShallowCopy(RouteSegment s)
public void validate()
ValidatableIllegalArgumentException including a description of the
invalid state is thrown.validate in interface Validatablepublic void validate(boolean strongValidation)
strongValidation - with strong validation even for minor errors an
IllegalArgumentException is thrown (instead of a
logged warning)Copyright © 2018. All rights reserved.