Interface RoutedTripSchedule
-
- All Superinterfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,Iterable<RelativeLegTiming>
,ManagedId
,RoutedTrip
- All Known Implementing Classes:
RoutedTripScheduleImpl
public interface RoutedTripSchedule extends RoutedTrip, Iterable<RelativeLegTiming>
The schedule with on or more departures for a routed service as well as the relative timings of each leg for each departure. Each leg timing is in an ordered position, meaning that the first timing represents the first leg of the routed service and the last leg the final leg etc.- Author:
- markr
-
-
Field Summary
-
Fields inherited from interface org.goplanit.utils.service.routed.RoutedTrip
ROUTED_TRIP_ID_CLASS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description RelativeLegTiming
addRelativeLegSegmentTiming(ServiceLegSegment parentLegSegment, LocalTime duration, LocalTime dwellTime)
Add a new leg's timing to the end of the already registered leg timings.default void
clear()
Clear the instance by removing both departures and leg timings from it.void
clearDepartures()
Clear all departures from the tripvoid
clearRelativeLegTimings()
Clear all leg timings from the tripRoutedTripSchedule
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.LocalTime
getDefaultDwellTime()
Get defaultRoutedTripDepartures
getDepartures()
Access to the departures of this scheduledefault RelativeLegTiming
getFirstRelativeLegTiming()
Collect the first relative leg timing available, i.e., having the lowest indexdefault RelativeLegTiming
getLastRelativeLegTiming()
Collect the last relative leg timing available, i.e., having the highest indexdefault int
getLastRelativeLegTimingIndex()
Get last index that is valid, when no entries exist, -1 is returnedRelativeLegTiming
getRelativeLegTiming(int index)
Collect a leg timing based on its indexdefault Stream<RelativeLegTiming>
getRelativeLegTimingsAsStream()
Collect the relative leg timings as stream rather than iterableint
getRelativeLegTimingsSize()
Collect the number of registered leg timingsdefault boolean
hasDepartures()
Verify if any departures are present on the scheduledefault boolean
hasRelativeLegTimings()
Verify if any relative leg timing entries existdefault boolean
isValidRelativeLegTimingsIndex(int relTimingsIndex)
Verify if given index is a valid relative leg timings indexvoid
removeLegTiming(int legTimingIndex)
Remove the leg timing with the given index from the leg timingsdefault void
removeLegTimingsIn(List<Integer> legTimingIndices)
Remove the leg timings in ascending order.RoutedTripSchedule
shallowClone()
Create a shallow copy of this entityLocalTime
updateDefaultDwellTimeToMostCommon()
Update the default dwell time to the most commonly found dwell time across all rell timings and update the relative lge timings acccordingly-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.service.routed.RoutedTrip
getIdClass, getUsedServiceNodes
-
-
-
-
Method Detail
-
getDepartures
RoutedTripDepartures getDepartures()
Access to the departures of this schedule- Returns:
- departures
-
hasDepartures
default boolean hasDepartures()
Verify if any departures are present on the schedule- Returns:
- true when present, false otherwise
-
clearRelativeLegTimings
void clearRelativeLegTimings()
Clear all leg timings from the trip
-
clearDepartures
void clearDepartures()
Clear all departures from the trip
-
addRelativeLegSegmentTiming
RelativeLegTiming addRelativeLegSegmentTiming(ServiceLegSegment parentLegSegment, LocalTime duration, LocalTime dwellTime)
Add a new leg's timing to the end of the already registered leg timings.- Parameters:
parentLegSegment
- (directed leg) to add to the trip's routeduration
- duration of the leg segmentdwellTime
- at the destination of the leg segment- Returns:
- the added timing
-
getRelativeLegTiming
RelativeLegTiming getRelativeLegTiming(int index)
Collect a leg timing based on its index- Parameters:
index
- to collect- Returns:
- the relative leg timing found
-
getRelativeLegTimingsSize
int getRelativeLegTimingsSize()
Collect the number of registered leg timings- Returns:
- number of relative leg timings registered
-
getLastRelativeLegTiming
default RelativeLegTiming getLastRelativeLegTiming()
Collect the last relative leg timing available, i.e., having the highest index- Returns:
- found relative leg timing if any, otherwise null
-
getLastRelativeLegTimingIndex
default int getLastRelativeLegTimingIndex()
Get last index that is valid, when no entries exist, -1 is returned- Returns:
- last valid index, -1 if no valid entries exist
-
getRelativeLegTimingsAsStream
default Stream<RelativeLegTiming> getRelativeLegTimingsAsStream()
Collect the relative leg timings as stream rather than iterable- Returns:
- stream of relative leg timings
-
getDefaultDwellTime
LocalTime getDefaultDwellTime()
Get default- Returns:
- default dwell time
-
updateDefaultDwellTimeToMostCommon
LocalTime updateDefaultDwellTimeToMostCommon()
Update the default dwell time to the most commonly found dwell time across all rell timings and update the relative lge timings acccordingly- Returns:
- updated default dwell time
-
getFirstRelativeLegTiming
default RelativeLegTiming getFirstRelativeLegTiming()
Collect the first relative leg timing available, i.e., having the lowest index- Returns:
- found relative leg timing if any, otherwise null
-
hasRelativeLegTimings
default boolean hasRelativeLegTimings()
Verify if any relative leg timing entries exist- Returns:
- true when present, false otherwise
-
isValidRelativeLegTimingsIndex
default boolean isValidRelativeLegTimingsIndex(int relTimingsIndex)
Verify if given index is a valid relative leg timings index- Parameters:
relTimingsIndex
- to verify- Returns:
- true when entry exists, false otherwise
-
clear
default void clear()
Clear the instance by removing both departures and leg timings from it. Use with caution
-
removeLegTiming
void removeLegTiming(int legTimingIndex)
Remove the leg timing with the given index from the leg timings- Parameters:
legTimingIndex
- to remove
-
removeLegTimingsIn
default void removeLegTimingsIn(List<Integer> legTimingIndices)
Remove the leg timings in ascending order. Note that after removal indices might have shifted due to removal of entries- Parameters:
legTimingIndices
- to remove, should be in ascending order
-
shallowClone
RoutedTripSchedule shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceRoutedTrip
- Returns:
- shallow copy of entity
-
deepClone
RoutedTripSchedule deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceRoutedTrip
- Returns:
- deep copy of entity
-
-