Class ServiceNetworkLayerImpl
- 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<ServiceNode,ServiceLeg,ServiceLegSegment>
-
- org.goplanit.network.layer.service.ServiceNetworkLayerImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,NetworkLayer
,ServiceNetworkLayer
,TopologicalLayer
,UntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>
public class ServiceNetworkLayerImpl extends UntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment> implements ServiceNetworkLayer
A service network layer is built on top of a physical network (layer). Its nodes (service nodes) and links (legs) contain references to the underlying physical network resulting in an efficient use of memory while allowing one to treat the service layer as a normal network at the same time. Service Nodes are one-to-one matches to the underlying network nodes and represent locations where services can be accessed/egressed. Edges are represented by ServiceLegs, while edge segments are represented by ServiceLegSegments. A leg comprises one or more physical links in the underlying network and as long as the underlying links differ, multiple legs can exist between the same service nodes. ServiceLegSegments have a direction which determines the order in which they traverse the underlying physical links of the ServiceLeg.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected MacroscopicNetworkLayer
parentNetworkLayer
the related physical layer-
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 ServiceNetworkLayerImpl(ServiceNetworkLayerImpl other, boolean deepCopy, GraphEntityDeepCopyMapper<ServiceNode> nodeMapper, GraphEntityDeepCopyMapper<ServiceLeg> legMapper, GraphEntityDeepCopyMapper<ServiceLegSegment> legSegmentMapper)
Copy constructorprotected
ServiceNetworkLayerImpl(IdGroupingToken tokenId)
Constructor.protected
ServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentLayer)
Constructor.protected
ServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentNetworkLayer, ServiceNodes nodes, ServiceLegs legs, ServiceLegSegments legSegments)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceNetworkLayerImpl
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.ServiceNetworkLayerModifierImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
getLayerModifier()
Provide access to the modifier options for this layerServiceLegs
getLegs()
Collect the service legsServiceLegSegments
getLegSegments()
Collect the service leg segmentsMacroscopicNetworkLayer
getParentNetworkLayer()
Collect the parent layer of this service layerServiceNodes
getServiceNodes()
Collect the service nodesCollection<Mode>
getSupportedModes()
Collect supported modes, obtained from parent layervoid
logInfo(String prefix)
invoked by entities inquiring about general information about the layer to display to usersboolean
registerSupportedMode(Mode supportedMode)
A service network does not allow for registering supported modes as the supported modes are defined by its parent network already.boolean
registerSupportedModes(Collection<Mode> supportedModes)
A service network does not allow for registering supported modes as the supported modes are defined by its parent network already.protected void
setParentNetworkLayer(MacroscopicNetworkLayer parentNetworkLayer)
The parent network layer this service network layer is to be build uponServiceNetworkLayerImpl
shallowClone()
Create a shallow copy of this entityboolean
supports(Mode mode)
Result delegate from underlying parent layer-
Methods inherited from class org.goplanit.network.layer.UntypedNetworkLayerImpl
createBoundingBox, getDirectedGraph, getLayerIdGroupingToken, isEmpty, reset, transform, validate
-
Methods inherited from class org.goplanit.network.layer.NetworkLayerImpl
generateId, recreateManagedIds, 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.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.network.layer.NetworkLayer
getFirstSupportedMode, getIdClass, hasSupportedModes, isEmpty, reset, 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
-
-
-
-
Field Detail
-
parentNetworkLayer
protected MacroscopicNetworkLayer parentNetworkLayer
the related physical layer
-
-
Constructor Detail
-
ServiceNetworkLayerImpl
protected ServiceNetworkLayerImpl(IdGroupingToken tokenId)
Constructor. Instance only usable after user explicitly sets the parent network layer- Parameters:
tokenId
- to use for id generation of instances of this class
-
ServiceNetworkLayerImpl
protected ServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentLayer)
Constructor. Instance only usable after user explicitly sets the parent network layer- Parameters:
tokenId
- to use for id generation of instances of this classparentLayer
- this service layer is built on top of this network (when null user is expected to set it manually afterwards)
-
ServiceNetworkLayerImpl
protected ServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentNetworkLayer, ServiceNodes nodes, ServiceLegs legs, ServiceLegSegments legSegments)
Constructor- Parameters:
tokenId
- to use for id generation of instances of this classparentNetworkLayer
- this service layer is built on top of this network (whn null user is expected to set it manually afterwards)nodes
- to uselegs
- to uselegSegments
- to use
-
ServiceNetworkLayerImpl
public ServiceNetworkLayerImpl(ServiceNetworkLayerImpl other, boolean deepCopy, GraphEntityDeepCopyMapper<ServiceNode> nodeMapper, GraphEntityDeepCopyMapper<ServiceLeg> legMapper, GraphEntityDeepCopyMapper<ServiceLegSegment> legSegmentMapper)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwisenodeMapper
- to uselegMapper
- to uselegSegmentMapper
- to use
-
-
Method Detail
-
setParentNetworkLayer
protected void setParentNetworkLayer(MacroscopicNetworkLayer parentNetworkLayer)
The parent network layer this service network layer is to be build upon- Parameters:
parentNetworkLayer
- to use
-
getLegs
public final ServiceLegs getLegs()
Collect the service legs- Specified by:
getLegs
in interfaceServiceNetworkLayer
- Returns:
- the legs
-
getLegSegments
public final ServiceLegSegments getLegSegments()
Collect the service leg segments- Specified by:
getLegSegments
in interfaceServiceNetworkLayer
- Returns:
- the legSegments
-
getServiceNodes
public final ServiceNodes getServiceNodes()
Collect the service nodes- Specified by:
getServiceNodes
in interfaceServiceNetworkLayer
- Returns:
- the nodes
-
getParentNetworkLayer
public MacroscopicNetworkLayer getParentNetworkLayer()
Collect the parent layer of this service layer- Specified by:
getParentNetworkLayer
in interfaceServiceNetworkLayer
- Returns:
- the parent layer
-
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 classNetworkLayerImpl
- Parameters:
prefix
- optional prefix to include in each line of logging
-
registerSupportedMode
public boolean registerSupportedMode(Mode supportedMode)
A service network does not allow for registering supported modes as the supported modes are defined by its parent network already. log warning and do nothing- Specified by:
registerSupportedMode
in interfaceNetworkLayer
- Overrides:
registerSupportedMode
in classNetworkLayerImpl
- Parameters:
supportedMode
- to register- Returns:
- false
-
registerSupportedModes
public boolean registerSupportedModes(Collection<Mode> supportedModes)
A service network does not allow for registering supported modes as the supported modes are defined by its parent network already. log warning and do nothing- Specified by:
registerSupportedModes
in interfaceNetworkLayer
- Overrides:
registerSupportedModes
in classNetworkLayerImpl
- Parameters:
supportedModes
- to register- Returns:
- always return false
-
getSupportedModes
public Collection<Mode> getSupportedModes()
Collect supported modes, obtained from parent layer- Specified by:
getSupportedModes
in interfaceNetworkLayer
- Overrides:
getSupportedModes
in classNetworkLayerImpl
- Returns:
- parent layer's supported modes
-
supports
public boolean supports(Mode mode)
Result delegate from underlying parent layer- Specified by:
supports
in interfaceNetworkLayer
- Parameters:
mode
- to verify- Returns:
- parent layer's result on verifying support for a mode
-
getLayerModifier
public ServiceNetworkLayerModifierImpl<ServiceNode,ServiceLeg,ServiceLegSegment> getLayerModifier()
Provide access to the modifier options for this layer- Specified by:
getLayerModifier
in interfaceServiceNetworkLayer
- Specified by:
getLayerModifier
in interfaceTopologicalLayer
- Specified by:
getLayerModifier
in interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>
- Overrides:
getLayerModifier
in classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
- Returns:
- layer modifier
-
shallowClone
public ServiceNetworkLayerImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceNetworkLayer
- Specified by:
shallowClone
in interfaceServiceNetworkLayer
- Specified by:
shallowClone
in interfaceTopologicalLayer
- Specified by:
shallowClone
in interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>
- Specified by:
shallowClone
in classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
- Returns:
- shallow copy of entity
-
deepClone
public ServiceNetworkLayerImpl 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 interfaceNetworkLayer
- Specified by:
deepClone
in interfaceServiceNetworkLayer
- Specified by:
deepClone
in interfaceTopologicalLayer
- Specified by:
deepClone
in interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>
- Specified by:
deepClone
in classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
- Returns:
- deep copy of entity
-
-