Package org.goplanit.utils.id
Interface ManagedIdEntities<E extends ManagedId>
-
- Type Parameters:
E
- type of managed id entity
- All Superinterfaces:
Iterable<E>
,LongMapWrapper<E>
,MapWrapper<Long,E>
- All Known Subinterfaces:
ConjugateConnectoidNodes
,ConjugateConnectoidSegments
,ConjugateLinks
,ConjugateLinkSegments
,ConjugateNodes
,Connectoids<T>
,DirectedConnectoids
,Links<L>
,LinkSegments
,MacroscopicLinks
,MacroscopicLinkSegments
,MacroscopicLinkSegmentTypes
,MacroscopicNetworkLayers
,ManagedDirectedPaths
,ManagedGraphEntities<E>
,Modes
,NetworkLayers<T>
,Nodes
,OdZones
,RoutedModeServices
,RoutedServicesLayers
,RoutedTripDepartures
,RoutedTrips<T>
,RoutedTripsFrequency
,RoutedTripsSchedule
,ServiceLegs
,ServiceLegSegments
,ServiceNetworkLayers
,ServiceNodes
,TopologicalLayers<T>
,TransferZoneGroups
,TransferZones
,UndirectedConnectoids
,UntypedDirectedGraphLayers<L>
,UntypedPhysicalNetworkLayers<L>
,Zones<Z>
- All Known Implementing Classes:
CentroidVerticesImpl
,ConjugateConnectoidEdgesImpl
,ConjugateConnectoidNodesImpl
,ConjugateConnectoidSegmentsImpl
,ConjugateLinkSegmentsImpl
,ConjugateLinksImpl
,ConjugateNodesImpl
,ConnectoidEdgesImpl
,ConnectoidSegmentsImpl
,ConnectoidsImpl
,DirectedConnectoidsImpl
,LinksImpl
,MacroscopicLinkSegmentsImpl
,MacroscopicLinkSegmentTypesImpl
,MacroscopicLinksImpl
,MacroscopicNetworkLayersImpl
,ManagedDirectedPathsImpl
,ManagedGraphEntitiesImpl
,ManagedIdEntitiesImpl
,ModesImpl
,NodesImpl
,OdZonesImpl
,RoutedModeServicesImpl
,RoutedServicesLayersImpl
,RoutedTripDeparturesImpl
,RoutedTripsFrequencyImpl
,RoutedTripsImpl
,RoutedTripsScheduleImpl
,ServiceLegSegmentsImpl
,ServiceLegsImpl
,ServiceNetworkLayersImpl
,ServiceNodesImpl
,TimePeriods
,TopologicalLayersImpl
,TransferZoneGroupsImpl
,TransferZonesImpl
,TransportLayersImpl
,TravellerTypes
,UndirectedConnectoidsImpl
,UntypedPhysicalNetworkLayersImpl
,UserClasses
,ZonesImpl
public interface ManagedIdEntities<E extends ManagedId> extends LongMapWrapper<E>
Container class for any managed id derived entities and a factory to create them- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
containsKey(long id)
Verify if presentManagedIdEntities<E>
deepClone()
Deep clone implementationManagedIdEntities<E>
deepCloneWithMapping(BiConsumer<E,E> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperManagedIdEntityFactory<E>
getFactory()
Factory to create instance of managed id entity (for this container class)Class<? extends ManagedId>
getManagedIdClass()
Collect the class identifier used for the managed ids within the id group for instances of this class used in this containerdefault <K> Map<K,List<E>>
groupBy(Function<? super E,? extends K> classifier)
Convenience method to perform group by based on uncerlying streaming mechanismsdefault void
recreateIds()
Identical torecreateIds(boolean)
void
recreateIds(boolean resetManagedIdClass)
Recreate the ids for all registered entities with or without resetting, this includes child managed ids, i.e., nested magedidentities containers if so indicateddefault void
reset()
When reset it called, it not only clears the entries, but also resets the managedids, such that when the container is reused the managed ids start from zero again.ManagedIdEntities<E>
shallowClone()
Shallow clone implementationdefault <T extends Comparable,F extends E>
Stream<F>streamSortedBy(Function<? super E,T> sortFunction)
Stream the container sorted by the given sort function-
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.wrapper.MapWrapper
addAll, clear, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
-
-
-
Method Detail
-
getFactory
ManagedIdEntityFactory<E> getFactory()
Factory to create instance of managed id entity (for this container class)- Returns:
- entity factory
-
getManagedIdClass
Class<? extends ManagedId> getManagedIdClass()
Collect the class identifier used for the managed ids within the id group for instances of this class used in this container- Returns:
- managedIdClass for instances this factory creates
-
recreateIds
void recreateIds(boolean resetManagedIdClass)
Recreate the ids for all registered entities with or without resetting, this includes child managed ids, i.e., nested magedidentities containers if so indicated- Parameters:
resetManagedIdClass
- when true we reset the managedId's counter to zero (via its id class) before recreating the ids, otherwise we simply recreate the managed id by starting with the next available id without resetting
-
shallowClone
ManagedIdEntities<E> shallowClone()
Shallow clone implementation- Specified by:
shallowClone
in interfaceMapWrapper<Long,E extends ManagedId>
- Returns:
- clone of entities
-
deepClone
ManagedIdEntities<E> deepClone()
Deep clone implementation- Returns:
- deep copy of entities
-
deepCloneWithMapping
ManagedIdEntities<E> deepCloneWithMapping(BiConsumer<E,E> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
containsKey
default boolean containsKey(long id)
Verify if present- Specified by:
containsKey
in interfaceLongMapWrapper<E extends ManagedId>
- Parameters:
id
- to verify- Returns:
- true when present false otherwise
-
recreateIds
default void recreateIds()
Identical torecreateIds(boolean)
-
reset
default void reset()
When reset it called, it not only clears the entries, but also resets the managedids, such that when the container is reused the managed ids start from zero again. If any entries are managedEntities themselves or contain managed entities themselves, they are reset as well
-
groupBy
default <K> Map<K,List<E>> groupBy(Function<? super E,? extends K> classifier)
Convenience method to perform group by based on uncerlying streaming mechanisms- Type Parameters:
K
- classifier to apply- Parameters:
classifier
- for group by- Returns:
- map with key containing the classifier and value being a list of matched entities in the container
-
streamSortedBy
default <T extends Comparable,F extends E> Stream<F> streamSortedBy(Function<? super E,T> sortFunction)
Stream the container sorted by the given sort function- Type Parameters:
T
- the type to sort on which must be comparableF
- the return type of the stream entries- Parameters:
sortFunction
- to apply- Returns:
- sorted stream
-
-