Package org.goplanit.network.layer
Class ServiceNetworkLayerImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.network.layer.TransportLayerImpl
-
- org.goplanit.network.layer.TopologicalLayerImpl
-
- org.goplanit.network.layer.UntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
-
- org.goplanit.network.layer.ServiceNetworkLayerImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,ServiceNetworkLayer
,TopologicalLayer
,TransportLayer
,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 parent layer-
Fields inherited from class org.goplanit.network.layer.UntypedNetworkLayerImpl
layerModifier
-
Fields inherited from class org.goplanit.network.layer.TransportLayerImpl
supportedModes
-
Fields inherited from interface org.goplanit.utils.network.layer.TransportLayer
TRANSPORT_LAYER_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description ServiceNetworkLayerImpl(ServiceNetworkLayerImpl serviceNetworkLayerImpl)
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
clone()
Create a shallow copy of this entityServiceLegs
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 uponboolean
supports(Mode mode)
Result delegate from underlying parent layer-
Methods inherited from class org.goplanit.network.layer.UntypedNetworkLayerImpl
getGraph, getLayerIdGroupingToken, getLayerModifier, isEmpty, reset, transform, validate
-
Methods inherited from class org.goplanit.network.layer.TransportLayerImpl
generateId, recreateManagedIds
-
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
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, 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.TopologicalLayer
transform
-
Methods inherited from interface org.goplanit.utils.network.layer.TransportLayer
getFirstSupportedMode, getIdClass, hasSupportedModes, isEmpty, reset, validate
-
Methods inherited from interface org.goplanit.utils.network.layer.UntypedDirectedGraphLayer
getLayerIdGroupingToken, getLayerModifier
-
-
-
-
Field Detail
-
parentNetworkLayer
protected MacroscopicNetworkLayer parentNetworkLayer
the parent 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 serviceNetworkLayerImpl)
Copy constructor- Parameters:
serviceNetworkLayerImpl
- to copy
-
-
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 interfaceTransportLayer
- Overrides:
logInfo
in classTransportLayerImpl
- Parameters:
prefix
- optional prefix to include in each line of logging
-
clone
public ServiceNetworkLayerImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Specified by:
clone
in classUntypedNetworkLayerImpl<ServiceNode,ServiceLeg,ServiceLegSegment>
- Returns:
- shallow copy of entity
-
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 interfaceTransportLayer
- Overrides:
registerSupportedMode
in classTransportLayerImpl
- 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 interfaceTransportLayer
- Overrides:
registerSupportedModes
in classTransportLayerImpl
- Parameters:
supportedModes
- to register- Returns:
- always return false
-
getSupportedModes
public Collection<Mode> getSupportedModes()
Collect supported modes, obtained from parent layer- Specified by:
getSupportedModes
in interfaceTransportLayer
- Overrides:
getSupportedModes
in classTransportLayerImpl
- Returns:
- parent layer's supported modes
-
supports
public boolean supports(Mode mode)
Result delegate from underlying parent layer- Specified by:
supports
in interfaceTransportLayer
- Parameters:
mode
- to verify- Returns:
- parent layer's result on verifying support for a mode
-
-