Package org.planit.network
Class InfrastructureLayerImpl
- java.lang.Object
-
- org.planit.network.InfrastructureLayerImpl
-
- All Implemented Interfaces:
Comparable<Idable>
,InfrastructureLayer
,ExternalIdable
,Idable
- Direct Known Subclasses:
PhysicalNetwork
public abstract class InfrastructureLayerImpl extends Object implements InfrastructureLayer
Implementation of infrastructure layer interface with only barebones functionality to support ids and modes. Only meant as starting point for actual implementations- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected String
externalId
external id for this infrastructure layer (if any)protected long
id
unique id for this infrastructure layerprotected Map<Long,Mode>
supportedModes
the modes supported by this layerprotected String
xmlId
xml id for this infrastructure layer
-
Constructor Summary
Constructors Constructor Description InfrastructureLayerImpl(IdGroupingToken tokenId)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static long
generateId(IdGroupingToken tokenId)
generate unique node idString
getExternalId()
get external id of the entitylong
getId()
collect id of the entityCollection<Mode>
getSupportedModes()
collect the modes supported by this infrastructure layerString
getXmlId()
the id exposed to users as the "normal" id in the PLANit native xml formatboolean
registerSupportedMode(Mode supportedMode)
register a mode as supported by this layerboolean
registerSupportedModes(Collection<Mode> supportedModes)
register modes as supported by this layervoid
setExternalId(String externalId)
set the external idprotected void
setId(Long id)
Set id on vertexvoid
setXmlId(String xmlId)
set the external id-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.ExternalIdable
hasExternalId, hasXmlId
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, idEquals, idHashCode
-
Methods inherited from interface org.planit.network.InfrastructureLayer
isEmpty, logInfo, removeDanglingSubnetworks, removeDanglingSubnetworks, supports, transform, validate
-
-
-
-
Constructor Detail
-
InfrastructureLayerImpl
public InfrastructureLayerImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- to generate id for this instance for
-
-
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
-
setId
protected void setId(Long id)
Set id on vertex- Parameters:
id
- to set
-
registerSupportedMode
public boolean registerSupportedMode(Mode supportedMode)
register a mode as supported by this layer- Specified by:
registerSupportedMode
in interfaceInfrastructureLayer
- 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:
registerSupportedModes
in interfaceInfrastructureLayer
- Parameters:
supportedModes
- to support- Returns:
- true when successful false otherwise
-
getId
public long getId()
collect id of the entity
-
getExternalId
public String getExternalId()
get external id of the entity- Specified by:
getExternalId
in interfaceExternalIdable
- Returns:
- external id
-
setExternalId
public void setExternalId(String externalId)
set the external id- Specified by:
setExternalId
in interfaceExternalIdable
- Parameters:
externalId
- to set
-
getXmlId
public String getXmlId()
the id exposed to users as the "normal" id in the PLANit native xml format- Specified by:
getXmlId
in interfaceExternalIdable
- Returns:
- xmlId
-
setXmlId
public void setXmlId(String xmlId)
set the external id- Specified by:
setXmlId
in interfaceExternalIdable
- Parameters:
xmlId
- to set
-
getSupportedModes
public final Collection<Mode> getSupportedModes()
collect the modes supported by this infrastructure layer- Specified by:
getSupportedModes
in interfaceInfrastructureLayer
- Returns:
- the supported modes for at least some part of the available infrastructure
-
-