Package org.goplanit.network.layer
Class NetworkLayerImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.network.layer.NetworkLayerImpl
-
- All Implemented Interfaces:
Comparable<IdAble>,ExternalIdAble,IdAble,ManagedId,NetworkLayer
- Direct Known Subclasses:
TopologicalLayerImpl
public abstract class NetworkLayerImpl extends ExternalIdAbleImpl implements NetworkLayer
Implementation of NetworkLayer interface with only bare-bones functionality to support ids and modes. Only meant as starting point for actual implementations that built on it- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Long,Mode>supportedModesthe modes supported by this layer (not owned)-
Fields inherited from interface org.goplanit.utils.network.layer.NetworkLayer
NETWORK_LAYER_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNetworkLayerImpl(NetworkLayerImpl other, boolean deepCopy)Copy constructorprotectedNetworkLayerImpl(IdGroupingToken tokenId)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract NetworkLayerImpldeepClone()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.protected static longgenerateId(IdGroupingToken tokenId)generate unique node idCollection<Mode>getSupportedModes()collect the modes supported by this infrastructure layervoidlogInfo(String prefix)invoked by entities inquiring about general information about the layer to display to userslongrecreateManagedIds(IdGroupingToken tokenId)recreate the internal id(s) and set them including the Idable idbooleanregisterSupportedMode(Mode supportedMode)register a mode as supported by this layerbooleanregisterSupportedModes(Collection<Mode> supportedModes)register modes as supported by this layervoidreset()Reset the layerabstract NetworkLayerImplshallowClone()Create a shallow copy of this entitybooleansupportsPredefinedMode(PredefinedModeType predefinedModeType)Verify if a predefined mode is supported based on its type-
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
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.network.layer.NetworkLayer
getFirstSupportedMode, getIdClass, hasSupportedModes, isEmpty, supports, supports, validate
-
-
-
-
Constructor Detail
-
NetworkLayerImpl
protected NetworkLayerImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId- to generate id for this instance for
-
NetworkLayerImpl
protected NetworkLayerImpl(NetworkLayerImpl other, boolean deepCopy)
Copy constructor- Parameters:
other- to copydeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
generateId
protected static long generateId(IdGroupingToken tokenId)
generate unique node id- Parameters:
tokenId- contiguous id generation within this group for instances of this class- Returns:
- nodeId
-
registerSupportedMode
public boolean registerSupportedMode(Mode supportedMode)
register a mode as supported by this layer- Specified by:
registerSupportedModein interfaceNetworkLayer- Parameters:
supportedMode- to support- Returns:
- true when successful false otherwise
-
registerSupportedModes
public boolean registerSupportedModes(Collection<Mode> supportedModes)
register modes as supported by this layer- Specified by:
registerSupportedModesin interfaceNetworkLayer- Parameters:
supportedModes- to support- Returns:
- true when successful false otherwise
-
getSupportedModes
public Collection<Mode> getSupportedModes()
collect the modes supported by this infrastructure layer- Specified by:
getSupportedModesin interfaceNetworkLayer- Returns:
- the supported modes for at least some part of the available infrastructure
-
supportsPredefinedMode
public boolean supportsPredefinedMode(PredefinedModeType predefinedModeType)
Verify if a predefined mode is supported based on its type- Specified by:
supportsPredefinedModein interfaceNetworkLayer- Parameters:
predefinedModeType- to verify- Returns:
- true, when supported, false otherwise
-
logInfo
public void logInfo(String prefix)
invoked by entities inquiring about general information about the layer to display to users- Specified by:
logInfoin interfaceNetworkLayer- Parameters:
prefix- optional prefix to include in each line of logging
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIdsin interfaceManagedId- Parameters:
tokenId- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
reset
public void reset()
Reset the layer- Specified by:
resetin interfaceNetworkLayer
-
shallowClone
public abstract NetworkLayerImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceNetworkLayer- Overrides:
shallowClonein classExternalIdAbleImpl- Returns:
- shallow copy of entity
-
deepClone
public abstract NetworkLayerImpl 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- Overrides:
deepClonein classExternalIdAbleImpl- Returns:
- deep copy of entity
-
-