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 MacroscopicLinkSegmentTypeslinkSegmentTypesThe 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 protectedMacroscopicNetworkLayerImpl(MacroscopicNetworkLayerImpl other, boolean deepCopy, GraphEntityDeepCopyMapper<Node> nodeMapper, GraphEntityDeepCopyMapper<MacroscopicLink> linkMapper, GraphEntityDeepCopyMapper<MacroscopicLinkSegment> linkSegmentMapper, ManagedIdDeepCopyMapper<MacroscopicLinkSegmentType> linkSegmentTypeMapper)Copy constructorprotectedMacroscopicNetworkLayerImpl(IdGroupingToken groupId)ConstructorprotectedMacroscopicNetworkLayerImpl(IdGroupingToken groupId, Nodes nodes, MacroscopicLinks links, MacroscopicLinkSegments linkSegments)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConjugateMacroscopicNetworkLayercreateConjugate(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.MacroscopicNetworkLayerImpldeepClone()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.MacroscopicLinksgetLinks()Collect the linksMacroscopicLinkSegmentsgetLinkSegments()Collect the link segmentsMacroscopicLinkSegmentTypesgetLinkSegmentTypes()collect the link segment types, alternative to using the public memberNodesgetNodes()Collect the nodesvoidlogInfo(String prefix)invoked by entities inquiring about general information about the layer to display to usersvoidreset()Reset the layervoidresetChildManagedIdEntities()Each class that has a managed id, should be able to reset any children that themselves are managedIdEntity containers.MacroscopicNetworkLayerImplshallowClone()Create a shallow copy of this entityvoidupdateLinkSegmentLinkSegmentTypes(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:
logInfoin interfaceNetworkLayer- Overrides:
logInfoin 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:
getLinkSegmentTypesin interfaceMacroscopicNetworkLayer- Returns:
- the link segment types
-
getLinks
public MacroscopicLinks getLinks()
Collect the links- Specified by:
getLinksin interfaceMacroscopicNetworkLayer- Specified by:
getLinksin interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Returns:
- the links
-
getLinkSegments
public MacroscopicLinkSegments getLinkSegments()
Collect the link segments- Specified by:
getLinkSegmentsin interfaceMacroscopicNetworkLayer- Specified by:
getLinkSegmentsin interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Returns:
- the linkSegments
-
getNodes
public Nodes getNodes()
Collect the nodes- Specified by:
getNodesin interfaceMacroscopicNetworkLayer- Specified by:
getNodesin interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Returns:
- the nodes
-
shallowClone
public MacroscopicNetworkLayerImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceMacroscopicNetworkLayer- Specified by:
shallowClonein interfaceNetworkLayer- Specified by:
shallowClonein interfaceTopologicalLayer- Specified by:
shallowClonein interfaceUntypedDirectedGraphLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Specified by:
shallowClonein interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Specified by:
shallowClonein 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:
deepClonein interfaceIdAble- Specified by:
deepClonein interfaceMacroscopicNetworkLayer- Specified by:
deepClonein interfaceNetworkLayer- Specified by:
deepClonein interfaceTopologicalLayer- Specified by:
deepClonein interfaceUntypedDirectedGraphLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Specified by:
deepClonein interfaceUntypedPhysicalLayer<Node,MacroscopicLink,MacroscopicLinkSegment>- Specified by:
deepClonein classUntypedPhysicalLayerImpl<Node,MacroscopicLink,MacroscopicLinkSegment>- Returns:
- deep copy of entity
-
reset
public void reset()
Reset the layer- Specified by:
resetin interfaceNetworkLayer- Overrides:
resetin 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:
resetChildManagedIdEntitiesin 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:
createConjugatein 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
-
-