Class LinkImpl<N extends DirectedVertex,LS extends EdgeSegment>
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.EdgeImpl<V>
-
- org.goplanit.graph.directed.DirectedEdgeImpl<N,LS>
-
- org.goplanit.network.layer.physical.LinkImpl<N,LS>
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,DirectedEdge
,Edge
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
,Link
- Direct Known Subclasses:
MacroscopicLinkImpl
public class LinkImpl<N extends DirectedVertex,LS extends EdgeSegment> extends DirectedEdgeImpl<N,LS> 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.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 protected
LinkImpl(LinkImpl<N,LS> other, boolean deepCopy)
Copy constructorprotected
LinkImpl(IdGroupingToken groupId, N nodeA, N nodeB)
Constructor which injects link length directlyprotected
LinkImpl(IdGroupingToken groupId, N nodeA, N 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<N,LS>
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.protected static long
generateLinkId(IdGroupingToken tokenId)
generate unique link idlong
getLinkId()
Return id of this instance.protected long
recreateLinkId(IdGroupingToken tokenId)
recreate the internal link id and set itlong
recreateManagedIds(IdGroupingToken tokenId)
Recreate id and link idprotected void
setLinkId(long linkId)
Set the link idLinkImpl<N,LS>
shallowClone()
Create a shallow copy of this entityboolean
validate()
validate the contents of this edge-
Methods inherited from class org.goplanit.graph.directed.DirectedEdgeImpl
getEdgeSegmentAb, getEdgeSegmentBa, registerEdgeSegment, removeEdgeSegmentAb, removeEdgeSegmentBa, replace, setEdgeSegmentAb, setEdgeSegmentBa
-
Methods inherited from class org.goplanit.graph.EdgeImpl
addInputProperty, getGeometry, getInputProperty, getLengthKm, getName, getVertexA, getVertexB, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.directed.DirectedEdge
forEachSegment, getEdgeSegment, getEdgeSegmentAb, getEdgeSegmentBa, getEdgeSegments, getVertexA, getVertexB, hasEdgeSegment, hasEdgeSegmentAb, hasEdgeSegmentBa, registerEdgeSegment, registerEdgeSegment, removeEdgeSegment, removeEdgeSegmentAb, removeEdgeSegmentBa, removeEdgeSegments, replace
-
Methods inherited from interface org.goplanit.utils.graph.Edge
addInputProperty, createEnvelope, getGeometry, getIdClass, getInputProperty, getLengthKm, getName, hasGeometry, hasVertex, hasVertexA, hasVertexB, hasVertices, isGeometryInAbDirection, isGeometryInAbDirection, isVertexA, populateBasicGeometry, removeVertex, replace, setGeometry, setLengthKm, setName, transformGeometry, updateGeometryInjectCoordinateAtProjectedLocation
-
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.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<N,LS> other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
LinkImpl
protected LinkImpl(IdGroupingToken groupId, N nodeA, N 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, N nodeA, N 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:
recreateManagedIds
in interfaceManagedId
- Overrides:
recreateManagedIds
in classGraphEntityImpl
- Parameters:
tokenId
- to use- Returns:
- created id (updated link Id is not returned)
-
shallowClone
public LinkImpl<N,LS> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceDirectedEdge
- Specified by:
shallowClone
in interfaceEdge
- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceLink
- Overrides:
shallowClone
in classDirectedEdgeImpl<N extends DirectedVertex,LS extends EdgeSegment>
- Returns:
- shallow copy of entity
-
deepClone
public LinkImpl<N,LS> 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:
deepClone
in interfaceDirectedEdge
- Specified by:
deepClone
in interfaceEdge
- Specified by:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceLink
- Overrides:
deepClone
in classDirectedEdgeImpl<N extends DirectedVertex,LS extends EdgeSegment>
- Returns:
- deep copy of entity
-
-