Package org.goplanit.graph.directed
Class DirectedEdgeImpl
- 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
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IdAble>,DirectedEdge,Edge,GraphEntity,ExternalIdAble,IdAble,ManagedId
- Direct Known Subclasses:
ConnectoidEdgeImpl,LinkImpl,ServiceLegImpl
public class DirectedEdgeImpl extends EdgeImpl implements DirectedEdge
Edge class connecting two vertices via some geometry. Each edge has one or two underlying edge segments in a particular direction which may carry additional information for each particular direction of the edge.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.goplanit.graph.EdgeImpl
inputProperties, lengthInKm, lineGeometry, name
-
Fields inherited from interface org.goplanit.utils.graph.Edge
EDGE_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDirectedEdgeImpl(DirectedEdgeImpl directedEdgeImpl)Copy Constructor.protectedDirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB)Constructor which injects link lengths directlyprotectedDirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB, double lengthKm)Constructor which injects link lengths directly
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DirectedEdgeImplclone()Create a shallow copy of this entityEdgeSegmentgetEdgeSegmentAb()Edge segment in the direction from A to BEdgeSegmentgetEdgeSegmentBa()Edge segment in the direction from B to ADirectedVertexgetVertexA()Vertex A of the edgeDirectedVertexgetVertexB()Vertex B of the edgeEdgeSegmentregisterEdgeSegment(EdgeSegment edgeSegment, boolean directionAB)Register EdgeSegment.voidreplace(EdgeSegment edgeSegmentToReplace, EdgeSegment edgeSegmentToReplaceWith)replace passed in edge segment (if present) with the passed in oneprotected voidsetEdgeSegmentAb(EdgeSegment edgeSegmentAb)set edge segment from A to Bprotected voidsetEdgeSegmentBa(EdgeSegment edgeSegmentBa)set edge segment from B to A-
Methods inherited from class org.goplanit.graph.EdgeImpl
addInputProperty, getGeometry, getInputProperty, getLengthKm, getName, removeVertex, removeVertexA, removeVertexB, replace, setGeometry, setLengthKm, setName, setVertexA, setVertexB, validate
-
Methods inherited from class org.goplanit.graph.GraphEntityImpl
generateAndSetId, generateId, recreateManagedIds, 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, getEdgeSegments, hasEdgeSegmentAb, hasEdgeSegmentBa
-
Methods inherited from interface org.goplanit.utils.graph.Edge
addInputProperty, createEnvelope, getGeometry, getIdClass, getInputProperty, getLengthKm, getName, hasGeometry, hasName, hasVertex, isGeometryInAbDirection, removeVertex, replace, setGeometry, setLengthKm, setName, transformGeometry, validate
-
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.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
DirectedEdgeImpl
protected DirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB)
Constructor which injects link lengths directly- Parameters:
groupId- , contiguous id generation within this group for instances of this classvertexA- first vertex in the linkvertexB- second vertex in the link
-
DirectedEdgeImpl
protected DirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB, double lengthKm)
Constructor which injects link lengths directly- Parameters:
groupId- , contiguous id generation within this group for instances of this classvertexA- first vertex in the linkvertexB- second vertex in the linklengthKm- length of the link in km
-
DirectedEdgeImpl
protected DirectedEdgeImpl(DirectedEdgeImpl directedEdgeImpl)
Copy Constructor. Edge segments are shallow copied and point to the passed in edge as their parent So additional effort is needed to make the new edge usable- Parameters:
directedEdgeImpl- to copy
-
-
Method Detail
-
setEdgeSegmentBa
protected void setEdgeSegmentBa(EdgeSegment edgeSegmentBa)
set edge segment from B to A- Parameters:
edgeSegmentBa- to set
-
setEdgeSegmentAb
protected void setEdgeSegmentAb(EdgeSegment edgeSegmentAb)
set edge segment from A to B- Parameters:
edgeSegmentAb- to set
-
getVertexA
public DirectedVertex getVertexA()
Vertex A of the edge- Specified by:
getVertexAin interfaceDirectedEdge- Specified by:
getVertexAin interfaceEdge- Overrides:
getVertexAin classEdgeImpl- Returns:
- vertex A
-
getVertexB
public DirectedVertex getVertexB()
Vertex B of the edge- Specified by:
getVertexBin interfaceDirectedEdge- Specified by:
getVertexBin interfaceEdge- Overrides:
getVertexBin classEdgeImpl- Returns:
- vertex B
-
registerEdgeSegment
public EdgeSegment registerEdgeSegment(EdgeSegment edgeSegment, boolean directionAB)
Register EdgeSegment. If there already exists an edgeSegment for that direction it is replaced and returned. If the edge segment has no parent edge, this edge is set. If there is a discrepancy between the edge segment's parent edge and this edge a warning is issued and the edge segment is not registered- Specified by:
registerEdgeSegmentin interfaceDirectedEdge- Parameters:
edgeSegment- the edgeSegment to be registereddirectionAB- direction of travel- Returns:
- replaced egeSegment (if any)
-
getEdgeSegmentAb
public EdgeSegment getEdgeSegmentAb()
Edge segment in the direction from A to B- Specified by:
getEdgeSegmentAbin interfaceDirectedEdge- Returns:
- edge segment AB
-
getEdgeSegmentBa
public EdgeSegment getEdgeSegmentBa()
Edge segment in the direction from B to A- Specified by:
getEdgeSegmentBain interfaceDirectedEdge- Returns:
- edge segment BA
-
clone
public DirectedEdgeImpl clone()
Create a shallow copy of this entity
-
replace
public void replace(EdgeSegment edgeSegmentToReplace, EdgeSegment edgeSegmentToReplaceWith)
replace passed in edge segment (if present) with the passed in one- Specified by:
replacein interfaceDirectedEdge- Parameters:
edgeSegmentToReplace- the one to replaceedgeSegmentToReplaceWith- the one to replace it with
-
-