Package org.goplanit.zoning
Class TransferZoneGroupsImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<TransferZoneGroup>
-
- org.goplanit.zoning.TransferZoneGroupsImpl
-
- All Implemented Interfaces:
Iterable<TransferZoneGroup>
,EventListener
,EventListener
,ManagedIdEntities<TransferZoneGroup>
,LongMapWrapper<TransferZoneGroup>
,MapWrapper<Long,TransferZoneGroup>
,ZoningModifierListener
,TransferZoneGroups
public class TransferZoneGroupsImpl extends ManagedIdEntitiesImpl<TransferZoneGroup> implements TransferZoneGroups
Container for transfer zone groups where each transfer zone group logically groups multiple transfer zones together. Practically this can be used to represent public transport stations for example- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description TransferZoneGroupsImpl(IdGroupingToken groupId)
ConstructorTransferZoneGroupsImpl(IdGroupingToken groupId, TransferZoneGroupFactory transferZoneGroupFactory)
ConstructorTransferZoneGroupsImpl(TransferZoneGroupsImpl other, boolean deepCopy, BiConsumer<TransferZoneGroup,TransferZoneGroup> mapper)
Copy constructor, also creates new factory with this as its underlying container
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferZoneGroupsImpl
deepClone()
Deep clone implementationTransferZoneGroupsImpl
deepCloneWithMapping(BiConsumer<TransferZoneGroup,TransferZoneGroup> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperTransferZoneGroupFactory
getFactory()
Factory to create instance of managed id entity (for this container class)EventType[]
getKnownSupportedEventTypes()
Collect explicitly supported event types that are known.void
onZoningModifierEvent(ZoningModificationEvent event)
Notify method for zoning modification eventsprotected void
recreateTransferZoneGroupsZoneIdMapping()
Update all transfer zone groups' id mappings for underlying transfer zones since the transfer zone id might have changedTransferZoneGroupsImpl
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 org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
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
-
-
-
-
Constructor Detail
-
TransferZoneGroupsImpl
public TransferZoneGroupsImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- to use for creating ids for instances
-
TransferZoneGroupsImpl
public TransferZoneGroupsImpl(IdGroupingToken groupId, TransferZoneGroupFactory transferZoneGroupFactory)
Constructor- Parameters:
groupId
- to use for creating ids for instancestransferZoneGroupFactory
- the factory to use
-
TransferZoneGroupsImpl
public TransferZoneGroupsImpl(TransferZoneGroupsImpl other, boolean deepCopy, BiConsumer<TransferZoneGroup,TransferZoneGroup> mapper)
Copy constructor, also creates new factory with this as its underlying container- Parameters:
other
- to copydeepCopy
- when true, create a eep copy, shallow copy otherwisemapper
- to use for tracking mapping between original and copied entity (may be null)
-
-
Method Detail
-
recreateTransferZoneGroupsZoneIdMapping
protected void recreateTransferZoneGroupsZoneIdMapping()
Update all transfer zone groups' id mappings for underlying transfer zones since the transfer zone id might have changed
-
getFactory
public TransferZoneGroupFactory getFactory()
Factory to create instance of managed id entity (for this container class)- Specified by:
getFactory
in interfaceManagedIdEntities<TransferZoneGroup>
- Specified by:
getFactory
in interfaceTransferZoneGroups
- Returns:
- entity factory
-
getKnownSupportedEventTypes
public EventType[] getKnownSupportedEventTypes()
Collect explicitly supported event types that are known. When not defined the user has to explicitly provide them upon registering the listener on an event producer, otherwise they can be extracted from here- Specified by:
getKnownSupportedEventTypes
in interfaceEventListener
- Returns:
- the supported event types
-
onZoningModifierEvent
public void onZoningModifierEvent(ZoningModificationEvent event)
Notify method for zoning modification events- Specified by:
onZoningModifierEvent
in interfaceZoningModifierListener
- Parameters:
event
- representing the zoning modification event at hand
-
shallowClone
public TransferZoneGroupsImpl 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<TransferZoneGroup>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,TransferZoneGroup>
- Specified by:
shallowClone
in interfaceTransferZoneGroups
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<TransferZoneGroup>
- Returns:
- copy
-
deepClone
public TransferZoneGroupsImpl deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<TransferZoneGroup>
- Specified by:
deepClone
in interfaceTransferZoneGroups
- Specified by:
deepClone
in classManagedIdEntitiesImpl<TransferZoneGroup>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public TransferZoneGroupsImpl deepCloneWithMapping(BiConsumer<TransferZoneGroup,TransferZoneGroup> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapper- Specified by:
deepCloneWithMapping
in interfaceManagedIdEntities<TransferZoneGroup>
- Specified by:
deepCloneWithMapping
in interfaceTransferZoneGroups
- Specified by:
deepCloneWithMapping
in classManagedIdEntitiesImpl<TransferZoneGroup>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
-