Package org.goplanit.service.routed
Class RoutedTripsImpl<T extends RoutedTrip>
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<T>
-
- org.goplanit.service.routed.RoutedTripsImpl<T>
-
- All Implemented Interfaces:
Iterable<T>
,ManagedIdEntities<T>
,RoutedTrips<T>
,LongMapWrapper<T>
,MapWrapper<Long,T>
- Direct Known Subclasses:
RoutedTripsFrequencyImpl
,RoutedTripsScheduleImpl
public abstract class RoutedTripsImpl<T extends RoutedTrip> extends ManagedIdEntitiesImpl<T> implements RoutedTrips<T>
Base class for toued trips of some derived type (either schedule or frequency based for example).- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected RoutedTripFactoryImpl<T>
factory
factory for this container class-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RoutedTripsImpl(RoutedTripsImpl<T> routedTripsBase, boolean deepCopy, BiConsumer<T,T> mapper)
Copy constructor, incomplete, requires derived class to explicitly set factoryprotected
RoutedTripsImpl(IdGroupingToken tokenId)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract RoutedTripsImpl
deepClone()
Deep clone implementationabstract RoutedTripsImpl
deepCloneWithMapping(BiConsumer<T,T> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperRoutedTripFactoryImpl<T>
getFactory()
Factory to create instance of managed id entity (for this container class)protected void
setFactory(RoutedTripFactoryImpl<T> factory)
The factory to use.abstract RoutedTripsImpl
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-
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, toString, 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.RoutedTrips
determineUsedServiceNodes
-
-
-
-
Field Detail
-
factory
protected RoutedTripFactoryImpl<T extends RoutedTrip> factory
factory for this container class
-
-
Constructor Detail
-
RoutedTripsImpl
protected RoutedTripsImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- to use
-
RoutedTripsImpl
protected RoutedTripsImpl(RoutedTripsImpl<T> routedTripsBase, boolean deepCopy, BiConsumer<T,T> mapper)
Copy constructor, incomplete, requires derived class to explicitly set factory- Parameters:
routedTripsBase
- 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
-
setFactory
protected void setFactory(RoutedTripFactoryImpl<T> factory)
The factory to use. To be set once by super class immediately after construction of the instance- Parameters:
factory
- to use
-
getFactory
public RoutedTripFactoryImpl<T> getFactory()
Factory to create instance of managed id entity (for this container class)- Specified by:
getFactory
in interfaceManagedIdEntities<T extends RoutedTrip>
- Specified by:
getFactory
in interfaceRoutedTrips<T extends RoutedTrip>
- Returns:
- entity factory
-
shallowClone
public abstract RoutedTripsImpl 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<T extends RoutedTrip>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,T extends RoutedTrip>
- Specified by:
shallowClone
in interfaceRoutedTrips<T extends RoutedTrip>
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<T extends RoutedTrip>
- Returns:
- copy
-
deepClone
public abstract RoutedTripsImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<T extends RoutedTrip>
- Specified by:
deepClone
in interfaceRoutedTrips<T extends RoutedTrip>
- Specified by:
deepClone
in classManagedIdEntitiesImpl<T extends RoutedTrip>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public abstract RoutedTripsImpl deepCloneWithMapping(BiConsumer<T,T> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<T extends RoutedTrip>
- Specified by:
deepCloneWithMapping
in interfaceRoutedTrips<T extends RoutedTrip>
- Specified by:
deepCloneWithMapping
in classManagedIdEntitiesImpl<T extends RoutedTrip>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
-