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 MacroscopicNetworkLayerparentNetworkLayerthe 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 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 ServiceNetworkLayerImplclone()Create a shallow copy of this entityServiceLegsgetLegs()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 uponbooleansupports(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:
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 interfaceTransportLayer- Overrides:
logInfoin 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:
clonein interfaceIdAble- Specified by:
clonein 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:
registerSupportedModein interfaceTransportLayer- Overrides:
registerSupportedModein 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:
registerSupportedModesin interfaceTransportLayer- Overrides:
registerSupportedModesin classTransportLayerImpl- Parameters:
supportedModes- to register- Returns:
- always return false
-
getSupportedModes
public Collection<Mode> getSupportedModes()
Collect supported modes, obtained from parent layer- Specified by:
getSupportedModesin interfaceTransportLayer- Overrides:
getSupportedModesin classTransportLayerImpl- Returns:
- parent layer's supported modes
-
supports
public boolean supports(Mode mode)
Result delegate from underlying parent layer- Specified by:
supportsin interfaceTransportLayer- Parameters:
mode- to verify- Returns:
- parent layer's result on verifying support for a mode
-
-