Package org.goplanit.service.routed
Class RoutedTripDeparturesImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<RoutedTripDeparture>
-
- org.goplanit.service.routed.RoutedTripDeparturesImpl
-
- All Implemented Interfaces:
Iterable<RoutedTripDeparture>
,ManagedIdEntities<RoutedTripDeparture>
,RoutedTripDepartures
,LongMapWrapper<RoutedTripDeparture>
,MapWrapper<Long,RoutedTripDeparture>
public class RoutedTripDeparturesImpl extends ManagedIdEntitiesImpl<RoutedTripDeparture> implements RoutedTripDepartures
Class that manages all routed trip departures for a given routed trip schedule- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Modifier Constructor Description RoutedTripDeparturesImpl(RoutedTripDeparturesImpl other, boolean deepCopy, BiConsumer<RoutedTripDeparture,RoutedTripDeparture> mapper)
Copy constructor, also creates new factory with this as its underlying containerprotected
RoutedTripDeparturesImpl(IdGroupingToken tokenId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allDepartEarlierBy(LocalTime departureTimeIncrease)
Make all departures of the routed trip departure depart later by the given amountvoid
allDepartLaterBy(LocalTime departureTimeIncrease)
Make all departures of the routed trip departure depart later by the given amountRoutedTripDeparturesImpl
deepClone()
Deep clone implementationRoutedTripDeparturesImpl
deepCloneWithMapping(BiConsumer<RoutedTripDeparture,RoutedTripDeparture> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperRoutedTripDepartureFactoryImpl
getFactory()
Factory to create instance of managed id entity (for this container class)RoutedTripDeparturesImpl
shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly createdString
toString()
String representation of departures-
Methods inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
getManagedIdClass, recreateIds, reset, updateIdMapping
-
Methods inherited from class org.goplanit.utils.wrapper.LongMapWrapperImpl
containsKey, get, remove
-
Methods inherited from class org.goplanit.utils.wrapper.MapWrapperImpl
clear, containsValue, createEmptyInstance, firstMatch, get, getKeyByValue, getMap, getValueToKey, isEmpty, iterator, register, remove, removeIf, setMap, size, toCollection, valuesAsNewSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.wrapper.LongMapWrapper
get, remove
-
Methods inherited from interface org.goplanit.utils.id.ManagedIdEntities
containsKey, getManagedIdClass, groupBy, recreateIds, recreateIds, reset, streamSortedBy
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, clear, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
Methods inherited from interface org.goplanit.utils.service.routed.RoutedTripDepartures
streamAscDepartureTime
-
-
-
-
Constructor Detail
-
RoutedTripDeparturesImpl
protected RoutedTripDeparturesImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- to use
-
RoutedTripDeparturesImpl
public RoutedTripDeparturesImpl(RoutedTripDeparturesImpl other, boolean deepCopy, BiConsumer<RoutedTripDeparture,RoutedTripDeparture> mapper)
Copy constructor, also creates new factory with this as its underlying container- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwisemapper
- to use for tracking mapping between original and copied entity (may be null)
-
-
Method Detail
-
getFactory
public RoutedTripDepartureFactoryImpl getFactory()
Factory to create instance of managed id entity (for this container class)- Specified by:
getFactory
in interfaceManagedIdEntities<RoutedTripDeparture>
- Specified by:
getFactory
in interfaceRoutedTripDepartures
- Returns:
- entity factory
-
allDepartLaterBy
public void allDepartLaterBy(LocalTime departureTimeIncrease)
Make all departures of the routed trip departure depart later by the given amount- Specified by:
allDepartLaterBy
in interfaceRoutedTripDepartures
- Parameters:
departureTimeIncrease
- to apply
-
allDepartEarlierBy
public void allDepartEarlierBy(LocalTime departureTimeIncrease)
Make all departures of the routed trip departure depart later by the given amount- Specified by:
allDepartEarlierBy
in interfaceRoutedTripDepartures
- Parameters:
departureTimeIncrease
- to apply
-
shallowClone
public RoutedTripDeparturesImpl shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created- Specified by:
shallowClone
in interfaceManagedIdEntities<RoutedTripDeparture>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,RoutedTripDeparture>
- Specified by:
shallowClone
in interfaceRoutedTripDepartures
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<RoutedTripDeparture>
- Returns:
- copy
-
deepClone
public RoutedTripDeparturesImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<RoutedTripDeparture>
- Specified by:
deepClone
in interfaceRoutedTripDepartures
- Specified by:
deepClone
in classManagedIdEntitiesImpl<RoutedTripDeparture>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public RoutedTripDeparturesImpl deepCloneWithMapping(BiConsumer<RoutedTripDeparture,RoutedTripDeparture> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<RoutedTripDeparture>
- Specified by:
deepCloneWithMapping
in classManagedIdEntitiesImpl<RoutedTripDeparture>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
-