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 MacroscopicNetworkLayerparentNetworkLayerthe 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 constructorprotectedServiceNetworkLayerImpl(IdGroupingToken tokenId)Constructor.protectedServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentLayer)Constructor.protectedServiceNetworkLayerImpl(IdGroupingToken tokenId, MacroscopicNetworkLayer parentNetworkLayer, ServiceNodes nodes, ServiceLegs legs, ServiceLegSegments legSegments)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceNetworkLayerImpldeepClone()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 layerServiceLegsgetLegs()Collect the service legsServiceLegSegmentsgetLegSegments()Collect the service leg segmentsMacroscopicNetworkLayergetParentNetworkLayer()Collect the parent layer of this service layerServiceNodesgetServiceNodes()Collect the service nodesCollection<Mode>getSupportedModes()Collect supported modes, obtained from parent layervoidlogInfo(String prefix)invoked by entities inquiring about general information about the layer to display to usersbooleanregisterSupportedMode(Mode supportedMode)A service network does not allow for registering supported modes as the supported modes are defined by its parent network already.booleanregisterSupportedModes(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 voidsetParentNetworkLayer(MacroscopicNetworkLayer parentNetworkLayer)The parent network layer this service network layer is to be build uponServiceNetworkLayerImplshallowClone()Create a shallow copy of this entitybooleansupports(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:
getLegsin interfaceServiceNetworkLayer- Returns:
- the legs
-
getLegSegments
public final ServiceLegSegments getLegSegments()
Collect the service leg segments- Specified by:
getLegSegmentsin interfaceServiceNetworkLayer- Returns:
- the legSegments
-
getServiceNodes
public final ServiceNodes getServiceNodes()
Collect the service nodes- Specified by:
getServiceNodesin interfaceServiceNetworkLayer- Returns:
- the nodes
-
getParentNetworkLayer
public MacroscopicNetworkLayer getParentNetworkLayer()
Collect the parent layer of this service layer- Specified by:
getParentNetworkLayerin 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:
logInfoin interfaceNetworkLayer- Overrides:
logInfoin 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:
registerSupportedModein interfaceNetworkLayer- Overrides:
registerSupportedModein 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:
registerSupportedModesin interfaceNetworkLayer- Overrides:
registerSupportedModesin classNetworkLayerImpl- Parameters:
supportedModes- to register- Returns:
- always return false
-
getSupportedModes
public Collection<Mode> getSupportedModes()
Collect supported modes, obtained from parent layer- Specified by:
getSupportedModesin interfaceNetworkLayer- Overrides:
getSupportedModesin classNetworkLayerImpl- Returns:
- parent layer's supported modes
-
supports
public boolean supports(Mode mode)
Result delegate from underlying parent layer- Specified by:
supportsin 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:
getLayerModifierin interfaceServiceNetworkLayer- Specified by:
getLayerModifierin interfaceTopologicalLayer- Specified by:
getLayerModifierin interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>- Overrides:
getLayerModifierin classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>- Returns:
- layer modifier
-
shallowClone
public ServiceNetworkLayerImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceNetworkLayer- Specified by:
shallowClonein interfaceServiceNetworkLayer- Specified by:
shallowClonein interfaceTopologicalLayer- Specified by:
shallowClonein interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>- Specified by:
shallowClonein 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:
deepClonein interfaceIdAble- Specified by:
deepClonein interfaceNetworkLayer- Specified by:
deepClonein interfaceServiceNetworkLayer- Specified by:
deepClonein interfaceTopologicalLayer- Specified by:
deepClonein interfaceUntypedDirectedGraphLayer<ServiceNode,ServiceLeg,ServiceLegSegment>- Specified by:
deepClonein classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>- Returns:
- deep copy of entity
-
-