Package org.planit.network.physical
Class LinkImpl
- java.lang.Object
-
- org.planit.graph.EdgeImpl
-
- org.planit.graph.DirectedEdgeImpl
-
- org.planit.network.physical.LinkImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Idable>
,DirectedEdge
,Edge
,ExternalIdable
,Idable
,Link
public class LinkImpl extends DirectedEdgeImpl 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 long
linkId
unique internal identifier-
Fields inherited from class org.planit.graph.EdgeImpl
externalId, inputProperties, lengthInKm, lineGeometry, name, xmlId
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LinkImpl(LinkImpl linkImpl)
Copy constructor, geometry is deep copied, see alsoDirectedEdge
copy constructedprotected
LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB, double length)
Constructor which injects link length directly
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LinkImpl
clone()
Clone the edge as is, all shared members are shallow copied, fully owned members are deep copiedprotected static long
generateLinkId(IdGroupingToken groupId)
generate unique link idlong
getLinkId()
Return id of this instance.protected void
setLinkId(long linkId)
Set the link idboolean
validate()
validate the contents of this edge-
Methods inherited from class org.planit.graph.DirectedEdgeImpl
getEdgeSegmentAb, getEdgeSegmentBa, registerEdgeSegment, replace, setEdgeSegmentAb, setEdgeSegmentBa
-
Methods inherited from class org.planit.graph.EdgeImpl
addInputProperty, equals, generateEdgeId, getExternalId, getGeometry, getId, getInputProperty, getLengthKm, getName, getVertexA, getVertexB, getXmlId, hasExternalId, hashCode, removeVertex, removeVertexA, removeVertexB, replace, setExternalId, setGeometry, setId, setLengthKm, setName, setVertexA, setVertexB, setXmlId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.graph.DirectedEdge
getEdgeSegment, getEdgeSegmentAb, getEdgeSegmentBa, hasEdgeSegmentAb, hasEdgeSegmentBa, registerEdgeSegment, replace
-
Methods inherited from interface org.planit.utils.graph.Edge
addInputProperty, getGeometry, getInputProperty, getLengthKm, getName, getVertexA, getVertexB, hasGeometry, hasVertex, isGeometryInAbDirection, removeVertex, replace, setGeometry, setLengthKm, setName, transformGeometry
-
Methods inherited from interface org.planit.utils.id.ExternalIdable
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.planit.utils.network.physical.Link
getLinkSegment, getLinkSegmentAb, getLinkSegmentBa, getNodeA, getNodeB, hasLinkSegmentAb, hasLinkSegmentBa, hasName
-
-
-
-
Constructor Detail
-
LinkImpl
protected LinkImpl(LinkImpl linkImpl)
Copy constructor, geometry is deep copied, see alsoDirectedEdge
copy constructed- Parameters:
linkImpl
- to copy
-
LinkImpl
protected LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB, double length) 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 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
-
setLinkId
protected void setLinkId(long linkId)
Set the link id- Parameters:
linkId
- to set
-
getLinkId
public long getLinkId()
Return id of this instance. This id is expected to be generated using the org.planit.utils.misc.IdGenerator
-
clone
public LinkImpl clone()
Clone the edge as is, all shared members are shallow copied, fully owned members are deep copied- Specified by:
clone
in interfaceEdge
- Overrides:
clone
in classDirectedEdgeImpl
- Returns:
- copy of this edge
-
-