Class LinkImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.EdgeImpl
-
- org.goplanit.graph.directed.DirectedEdgeImpl
-
- org.goplanit.network.layer.physical.LinkImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IdAble>,DirectedEdge,Edge,GraphEntity,ExternalIdAble,IdAble,ManagedId,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 longlinkIdunique internal identifier-
Fields inherited from class org.goplanit.graph.EdgeImpl
inputProperties, lengthInKm, lineGeometry, name
-
Fields inherited from interface org.goplanit.utils.graph.Edge
EDGE_ID_CLASS
-
Fields inherited from interface org.goplanit.utils.network.layer.physical.Link
LINK_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLinkImpl(LinkImpl linkImpl)Copy constructor, geometry is deep copied, see alsoDirectedEdgecopy constructedprotectedLinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB)Constructor which injects link length directlyprotectedLinkImpl(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 LinkImplclone()Create a shallow copy of this entityprotected static longgenerateLinkId(IdGroupingToken tokenId)generate unique link idlonggetLinkId()Return id of this instance.protected longrecreateLinkId(IdGroupingToken tokenId)recreate the internal link id and set itlongrecreateManagedIds(IdGroupingToken tokenId)Recreate id and link idprotected voidsetLinkId(long linkId)Set the link idbooleanvalidate()validate the contents of this edge-
Methods inherited from class org.goplanit.graph.directed.DirectedEdgeImpl
getEdgeSegmentAb, getEdgeSegmentBa, getVertexA, getVertexB, registerEdgeSegment, replace, setEdgeSegmentAb, setEdgeSegmentBa
-
Methods inherited from class org.goplanit.graph.EdgeImpl
addInputProperty, getGeometry, getInputProperty, getLengthKm, getName, removeVertex, removeVertexA, removeVertexB, replace, setGeometry, setLengthKm, setName, setVertexA, setVertexB
-
Methods inherited from class org.goplanit.graph.GraphEntityImpl
generateAndSetId, generateId, toString
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.directed.DirectedEdge
getEdgeSegment, getEdgeSegmentAb, getEdgeSegmentBa, getEdgeSegments, getVertexA, getVertexB, hasEdgeSegmentAb, hasEdgeSegmentBa, registerEdgeSegment, replace
-
Methods inherited from interface org.goplanit.utils.graph.Edge
addInputProperty, createEnvelope, getGeometry, getIdClass, getInputProperty, getLengthKm, getName, hasGeometry, hasVertex, isGeometryInAbDirection, removeVertex, replace, setGeometry, setLengthKm, setName, transformGeometry
-
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.network.layer.physical.Link
getLinkIdClass, getLinkSegment, getLinkSegmentAb, getLinkSegmentBa, getLinkSegments, getNodeA, getNodeB, hasLinkSegmentAb, hasLinkSegmentBa, hasName
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
LinkImpl
protected LinkImpl(LinkImpl linkImpl)
Copy constructor, geometry is deep copied, see alsoDirectedEdgecopy constructed- Parameters:
linkImpl- to copy
-
LinkImpl
protected LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB)
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 link
-
LinkImpl
protected LinkImpl(IdGroupingToken groupId, Node nodeA, Node nodeB, double length)
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
-
-
Method Detail
-
generateLinkId
protected static long generateLinkId(IdGroupingToken tokenId)
generate unique link id- Parameters:
tokenId- , contiguous id generation within this group for instances of this class- Returns:
- linkId created
-
setLinkId
protected void setLinkId(long linkId)
Set the link id- Parameters:
linkId- to set
-
recreateLinkId
protected long recreateLinkId(IdGroupingToken tokenId)
recreate the internal link id and set it- Parameters:
tokenId- to use- Returns:
- the created link id
-
getLinkId
public long getLinkId()
Return id of this instance. This id is expected to be generated using the org.planit.utils.misc.IdGenerator
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
Recreate id and link id- Specified by:
recreateManagedIdsin interfaceManagedId- Overrides:
recreateManagedIdsin classGraphEntityImpl- Parameters:
tokenId- to use- Returns:
- created id (updated link Id is not returned)
-
clone
public LinkImpl clone()
Create a shallow copy of this entity
-
-