Package org.goplanit.network.layers
Class TransportLayersImpl<T extends NetworkLayer>
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.id.ManagedIdEntitiesImpl<T>
-
- org.goplanit.network.layers.TransportLayersImpl<T>
-
- All Implemented Interfaces:
Iterable<T>
,ManagedIdEntities<T>
,NetworkLayers<T>
,LongMapWrapper<T>
,MapWrapper<Long,T>
- Direct Known Subclasses:
TopologicalLayersImpl
public abstract class TransportLayersImpl<T extends NetworkLayer> extends ManagedIdEntitiesImpl<T> implements NetworkLayers<T>
Base implementation of the TransportLayer interface, without the createNew() method- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntitiesImpl
managedIdClass
-
-
Constructor Summary
Constructors Constructor Description TransportLayersImpl(TransportLayersImpl<T> other, boolean deepCopy, BiConsumer<T,T> mapper)
ConstructorTransportLayersImpl(IdGroupingToken idToken)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TransportLayersImpl<T>
deepClone()
Deep clone implementationabstract TransportLayersImpl<T>
deepCloneWithMapping(BiConsumer<T,T> mapper)
Deep clone implementation where the mapping for its internal copies is captured by the provided mapperT
get(Mode mode)
Find the layer that supports the passed in mode.T
getByXmlId(String xmlId)
Find the layer based on non-indexed XML id rather than the managed internal id.protected IdGroupingToken
getIdToken()
Collect the token for id generationabstract TransportLayersImpl<T>
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, getFactory, 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.network.layers.NetworkLayers
get, getLayersOfType, getSupportedModes, isEachLayerEmpty
-
-
-
-
Constructor Detail
-
TransportLayersImpl
public TransportLayersImpl(IdGroupingToken idToken)
Constructor- Parameters:
idToken
- to generated id's for infrastructure layers
-
TransportLayersImpl
public TransportLayersImpl(TransportLayersImpl<T> other, boolean deepCopy, BiConsumer<T,T> mapper)
Constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwisemapper
- apply to each mapping from original to copy
-
-
Method Detail
-
getIdToken
protected IdGroupingToken getIdToken()
Collect the token for id generation- Returns:
- id token
-
get
public T get(Mode mode)
Find the layer that supports the passed in mode. Since a mode is only allowed to be supported by a single layer, this should yield the correct result. If multiple layers support the same mode for some reason, this method returns the first layer that supports the mode- Specified by:
get
in interfaceNetworkLayers<T extends NetworkLayer>
- Parameters:
mode
- to find the layer for- Returns:
- first matching layer
-
getByXmlId
public T getByXmlId(String xmlId)
Find the layer based on non-indexed XML id rather than the managed internal id.- Specified by:
getByXmlId
in interfaceNetworkLayers<T extends NetworkLayer>
- Parameters:
xmlId
- to find the layer for- Returns:
- first matching layer
-
shallowClone
public abstract TransportLayersImpl<T> 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 NetworkLayer>
- Specified by:
shallowClone
in interfaceMapWrapper<Long,T extends NetworkLayer>
- Specified by:
shallowClone
in interfaceNetworkLayers<T extends NetworkLayer>
- Specified by:
shallowClone
in classManagedIdEntitiesImpl<T extends NetworkLayer>
- Returns:
- copy
-
deepClone
public abstract TransportLayersImpl<T> deepClone()
Deep clone implementation- Specified by:
deepClone
in interfaceManagedIdEntities<T extends NetworkLayer>
- Specified by:
deepClone
in interfaceNetworkLayers<T extends NetworkLayer>
- Specified by:
deepClone
in classManagedIdEntitiesImpl<T extends NetworkLayer>
- Returns:
- deep copy of entities
-
deepCloneWithMapping
public abstract TransportLayersImpl<T> 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 NetworkLayer>
- Specified by:
deepCloneWithMapping
in interfaceNetworkLayers<T extends NetworkLayer>
- Specified by:
deepCloneWithMapping
in classManagedIdEntitiesImpl<T extends NetworkLayer>
- Parameters:
mapper
- to apply to each mapping between original and copy- Returns:
- copy
-
-