Class MacroscopicNetworkLayerImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.network.layer.NetworkLayerImpl
-
- org.goplanit.network.layer.TopologicalLayerImpl
-
- org.goplanit.network.layer.UntypedNetworkLayerImpl<N,L,LS>
-
- org.goplanit.network.layer.physical.UntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>
-
- org.goplanit.network.layer.macroscopic.MacroscopicNetworkLayerImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,MacroscopicNetworkLayer
,NetworkLayer
,UntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
,TopologicalLayer
,UntypedDirectedGraphLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
public class MacroscopicNetworkLayerImpl extends UntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment> implements MacroscopicNetworkLayer
Macroscopic physical Network (layer) that supports one or more modes and link segment types, where the modes are registered on the network (Infrastructure network) level- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description MacroscopicLinkSegmentTypes
linkSegmentTypes
The container for the link segment types available across all link segments-
Fields inherited from class org.goplanit.network.layer.UntypedNetworkLayerImpl
directedGraph, layerModifier
-
Fields inherited from class org.goplanit.network.layer.NetworkLayerImpl
supportedModes
-
Fields inherited from interface org.goplanit.utils.network.layer.NetworkLayer
NETWORK_LAYER_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MacroscopicNetworkLayerImpl(MacroscopicNetworkLayerImpl other, boolean deepCopy, GraphEntityDeepCopyMapper<Node> nodeMapper, GraphEntityDeepCopyMapper<MacroscopicLink> linkMapper, GraphEntityDeepCopyMapper<MacroscopicLinkSegment> linkSegmentMapper, ManagedIdDeepCopyMapper<MacroscopicLinkSegmentType> linkSegmentTypeMapper)
Copy constructorprotected
MacroscopicNetworkLayerImpl(IdGroupingToken groupId)
Constructorprotected
MacroscopicNetworkLayerImpl(IdGroupingToken groupId, Nodes nodes, MacroscopicLinks links, MacroscopicLinkSegments linkSegments)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConjugateMacroscopicNetworkLayer
createConjugate(IdGroupingToken idToken, ConjugateVirtualNetwork conjugateVirtualNetwork)
Create a conjugate version of this layer, also known as the edge-to-vertex-dual representation, where all edges become vertices and all two adjacent edges (turns) become the edges on the conjugate version.MacroscopicNetworkLayerImpl
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.MacroscopicLinks
getLinks()
Collect the linksMacroscopicLinkSegments
getLinkSegments()
Collect the link segmentsMacroscopicLinkSegmentTypes
getLinkSegmentTypes()
collect the link segment types, alternative to using the public memberNodes
getNodes()
Collect the nodesvoid
logInfo(String prefix)
invoked by entities inquiring about general information about the layer to display to usersvoid
reset()
Reset the layervoid
resetChildManagedIdEntities()
Each class that has a managed id, should be able to reset any children that themselves are managedIdEntity containers.MacroscopicNetworkLayerImpl
shallowClone()
Create a shallow copy of this entityvoid
updateLinkSegmentLinkSegmentTypes(Function<MacroscopicLinkSegmentType,MacroscopicLinkSegmentType> lsTypeToLsTypeMapping, boolean removeMissingMappings)
Update the parent edge of all edge segments based on the mapping provided (if any)-
Methods inherited from class org.goplanit.network.layer.UntypedNetworkLayerImpl
createBoundingBox, getDirectedGraph, getLayerIdGroupingToken, getLayerModifier, isEmpty, transform, validate
-
Methods inherited from class org.goplanit.network.layer.NetworkLayerImpl
generateId, getSupportedModes, recreateManagedIds, registerSupportedMode, registerSupportedModes, supportsPredefinedMode
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.network.layer.MacroscopicNetworkLayer
findMaximumPaceHKm, findMaximumSpeedLimitKmH
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds
-
Methods inherited from interface org.goplanit.utils.network.layer.NetworkLayer
getFirstSupportedMode, getIdClass, getSupportedModes, hasSupportedModes, isEmpty, registerSupportedMode, registerSupportedModes, supports, supports, supportsPredefinedMode, validate
-
Methods inherited from interface org.goplanit.utils.network.layer.TopologicalLayer
createBoundingBox, transform
-
Methods inherited from interface org.goplanit.utils.network.layer.UntypedDirectedGraphLayer
getLayerIdGroupingToken, getLayerModifier
-
Methods inherited from interface org.goplanit.utils.network.layer.physical.UntypedPhysicalLayer
getNumberOfLinks, getNumberOfLinkSegments, getNumberOfNodes
-
-
-
-
Field Detail
-
linkSegmentTypes
public final MacroscopicLinkSegmentTypes linkSegmentTypes
The container for the link segment types available across all link segments
-
-
Constructor Detail
-
MacroscopicNetworkLayerImpl
protected MacroscopicNetworkLayerImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this class
-
MacroscopicNetworkLayerImpl
protected MacroscopicNetworkLayerImpl(IdGroupingToken groupId, Nodes nodes, MacroscopicLinks links, MacroscopicLinkSegments linkSegments)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classnodes
- to uselinks
- to uselinkSegments
- to use
-
MacroscopicNetworkLayerImpl
protected MacroscopicNetworkLayerImpl(MacroscopicNetworkLayerImpl other, boolean deepCopy, GraphEntityDeepCopyMapper<Node> nodeMapper, GraphEntityDeepCopyMapper<MacroscopicLink> linkMapper, GraphEntityDeepCopyMapper<MacroscopicLinkSegment> linkSegmentMapper, ManagedIdDeepCopyMapper<MacroscopicLinkSegmentType> linkSegmentTypeMapper)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep cpy, shallow copy otherwisenodeMapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)linkMapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)linkSegmentMapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)linkSegmentTypeMapper
- to apply in case of deep copy to each original to copy combination (when provided, may be null)
-
-
Method Detail
-
updateLinkSegmentLinkSegmentTypes
public void updateLinkSegmentLinkSegmentTypes(Function<MacroscopicLinkSegmentType,MacroscopicLinkSegmentType> lsTypeToLsTypeMapping, boolean removeMissingMappings)
Update the parent edge of all edge segments based on the mapping provided (if any)- Parameters:
lsTypeToLsTypeMapping
- to use should contain original link segment type as currently used on link segment and then the value is the new link segment type to replace itremoveMissingMappings
- when true if there is no mapping, the type is nullified, otherwise it is left in-tact
-
logInfo
public void logInfo(String prefix)
invoked by entities inquiring about general information about the layer to display to users- Specified by:
logInfo
in interfaceNetworkLayer
- Overrides:
logInfo
in classUntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>
- Parameters:
prefix
- optional prefix to include in each line of logging
-
getLinkSegmentTypes
public MacroscopicLinkSegmentTypes getLinkSegmentTypes()
collect the link segment types, alternative to using the public member- Specified by:
getLinkSegmentTypes
in interfaceMacroscopicNetworkLayer
- Returns:
- the link segment types
-
getLinks
public MacroscopicLinks getLinks()
Collect the links- Specified by:
getLinks
in interfaceMacroscopicNetworkLayer
- Specified by:
getLinks
in interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Returns:
- the links
-
getLinkSegments
public MacroscopicLinkSegments getLinkSegments()
Collect the link segments- Specified by:
getLinkSegments
in interfaceMacroscopicNetworkLayer
- Specified by:
getLinkSegments
in interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Returns:
- the linkSegments
-
getNodes
public Nodes getNodes()
Collect the nodes- Specified by:
getNodes
in interfaceMacroscopicNetworkLayer
- Specified by:
getNodes
in interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Returns:
- the nodes
-
shallowClone
public MacroscopicNetworkLayerImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceMacroscopicNetworkLayer
- Specified by:
shallowClone
in interfaceNetworkLayer
- Specified by:
shallowClone
in interfaceTopologicalLayer
- Specified by:
shallowClone
in interfaceUntypedDirectedGraphLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Specified by:
shallowClone
in interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Specified by:
shallowClone
in classUntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>
- Returns:
- shallow copy of entity
-
deepClone
public MacroscopicNetworkLayerImpl deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceMacroscopicNetworkLayer
- Specified by:
deepClone
in interfaceNetworkLayer
- Specified by:
deepClone
in interfaceTopologicalLayer
- Specified by:
deepClone
in interfaceUntypedDirectedGraphLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Specified by:
deepClone
in interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>
- Specified by:
deepClone
in classUntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>
- Returns:
- deep copy of entity
-
reset
public void reset()
Reset the layer- Specified by:
reset
in interfaceNetworkLayer
- Overrides:
reset
in classUntypedNetworkLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>
-
resetChildManagedIdEntities
public void resetChildManagedIdEntities()
Each class that has a managed id, should be able to reset any children that themselves are managedIdEntity containers. This ensures that when resetting such a container any child containers are also reset- Specified by:
resetChildManagedIdEntities
in interfaceManagedId
-
createConjugate
public ConjugateMacroscopicNetworkLayer createConjugate(IdGroupingToken idToken, ConjugateVirtualNetwork conjugateVirtualNetwork)
Create a conjugate version of this layer, also known as the edge-to-vertex-dual representation, where all edges become vertices and all two adjacent edges (turns) become the edges on the conjugate version. When the provided id token is the same as an existing layer, vertex,edge,edge segmentids will continue numbering which might not be ideal. It is reocmmended to have a separate idToken for all conjugate layers such that all conjugate vertices, edges, edge segments are numbered uniquely within the context.- Specified by:
createConjugate
in interfaceMacroscopicNetworkLayer
- Parameters:
idToken
- to use for generating ids within the layerconjugateVirtualNetwork
- to use for encountered connections to zones, when null connectoid edges/edge segments are ignored- Returns:
- conjugate version of this layer
-
-