Package org.planit.network.physical
Class LinkImpl
- java.lang.Object
-
- org.planit.graph.EdgeImpl
-
- org.planit.network.physical.LinkImpl
-
- All Implemented Interfaces:
Serializable
,Comparable<Edge>
,Edge
,Link
public class LinkImpl extends EdgeImpl implements Link
Link class connecting two nodes via some geometry. Each link has one or two underlying link segments in a particular direction which may carry additional information for each particular direction of the link.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Object
externalId
External Id of the physical linkprotected long
linkId
unique internal identifier-
Fields inherited from class org.planit.graph.EdgeImpl
edgeSegmentAB, edgeSegmentBA, id, inputProperties, length, name, vertexA, vertexB
-
-
Constructor Summary
Constructors Constructor Description LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB, double length, String name)
Constructor which injects link length directly
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static long
generateLinkId(IdGroupingToken groupId)
generate unique link idObject
getExternalId()
Collect the external idlong
getLinkId()
Return id of this instance.boolean
hasExternalId()
Returns whether the external Id has been setLinkSegment
registerLinkSegment(LinkSegment linkSegment, boolean directionAB)
Register linkSegment.void
setExternalId(Object externalId)
Set the external id-
Methods inherited from class org.planit.graph.EdgeImpl
addInputProperty, compareTo, generateEdgeId, getEdgeSegmentAB, getEdgeSegmentBA, getId, getInputProperty, getLength, getName, getVertexA, getVertexB, registerEdgeSegment, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.planit.utils.graph.Edge
addInputProperty, getEdgeSegmentAB, getEdgeSegmentBA, getId, getInputProperty, getLength, getName, getVertexA, getVertexB
-
-
-
-
Field Detail
-
linkId
protected final long linkId
unique internal identifier
-
externalId
protected Object externalId
External Id of the physical link
-
-
Constructor Detail
-
LinkImpl
public LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB, double length, String name) throws PlanItException
Constructor which injects link length directly- Parameters:
groupId
- , contiguous id generation within this group for instances of this classnodeA
- the first node in the linknodeB
- the second node in the linklength
- the length of the linkname
- the name of the link- Throws:
PlanItException
- thrown if there is an error
-
-
Method Detail
-
generateLinkId
protected static long generateLinkId(IdGroupingToken groupId)
generate unique link id- Parameters:
groupId
- , contiguous id generation within this group for instances of this class- Returns:
- linkId
-
registerLinkSegment
public LinkSegment registerLinkSegment(LinkSegment linkSegment, boolean directionAB) throws PlanItException
Register linkSegment. If there already exists a linkSegment for that direction it is replaced and returned- Specified by:
registerLinkSegment
in interfaceLink
- Parameters:
linkSegment
- the link segment to be registereddirectionAB
- direction of travel- Returns:
- the replaced LinkSegment
- Throws:
PlanItException
- thrown if there is an error
-
getLinkId
public long getLinkId()
Description copied from interface:Link
Return id of this instance. This id is expected to be generated using the org.planit.utils.misc.IdGenerator
-
setExternalId
public void setExternalId(Object externalId)
Description copied from interface:Link
Set the external id- Specified by:
setExternalId
in interfaceLink
- Parameters:
externalId
- the external id to set
-
getExternalId
public Object getExternalId()
Description copied from interface:Link
Collect the external id- Specified by:
getExternalId
in interfaceLink
- Returns:
- externalID
-
hasExternalId
public boolean hasExternalId()
Description copied from interface:Link
Returns whether the external Id has been set- Specified by:
hasExternalId
in interfaceLink
- Returns:
- true if the external Id has been set, false otherwise
-
-