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 protected
DirectedEdgeImpl(DirectedEdgeImpl directedEdgeImpl)
Copy Constructor.protected
DirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB)
Constructor which injects link lengths directlyprotected
DirectedEdgeImpl(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 DirectedEdgeImpl
clone()
Create a shallow copy of this entityEdgeSegment
getEdgeSegmentAb()
Edge segment in the direction from A to BEdgeSegment
getEdgeSegmentBa()
Edge segment in the direction from B to ADirectedVertex
getVertexA()
Vertex A of the edgeDirectedVertex
getVertexB()
Vertex B of the edgeEdgeSegment
registerEdgeSegment(EdgeSegment edgeSegment, boolean directionAB)
Register EdgeSegment.void
replace(EdgeSegment edgeSegmentToReplace, EdgeSegment edgeSegmentToReplaceWith)
replace passed in edge segment (if present) with the passed in oneprotected void
setEdgeSegmentAb(EdgeSegment edgeSegmentAb)
set edge segment from A to Bprotected void
setEdgeSegmentBa(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:
getVertexA
in interfaceDirectedEdge
- Specified by:
getVertexA
in interfaceEdge
- Overrides:
getVertexA
in classEdgeImpl
- Returns:
- vertex A
-
getVertexB
public DirectedVertex getVertexB()
Vertex B of the edge- Specified by:
getVertexB
in interfaceDirectedEdge
- Specified by:
getVertexB
in interfaceEdge
- Overrides:
getVertexB
in 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:
registerEdgeSegment
in 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:
getEdgeSegmentAb
in interfaceDirectedEdge
- Returns:
- edge segment AB
-
getEdgeSegmentBa
public EdgeSegment getEdgeSegmentBa()
Edge segment in the direction from B to A- Specified by:
getEdgeSegmentBa
in 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:
replace
in interfaceDirectedEdge
- Parameters:
edgeSegmentToReplace
- the one to replaceedgeSegmentToReplaceWith
- the one to replace it with
-
-