Package org.planit.graph
Class DirectedEdgeImpl
- java.lang.Object
-
- org.planit.graph.EdgeImpl
-
- org.planit.graph.DirectedEdgeImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Idable>,DirectedEdge,Edge,ExternalIdable,Idable
- Direct Known Subclasses:
ConnectoidEdgeImpl,LinkImpl
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.planit.graph.EdgeImpl
externalId, inputProperties, lengthInKm, lineGeometry, name, xmlId
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDirectedEdgeImpl(DirectedEdgeImpl directedEdgeImpl)Copy Constructor.protectedDirectedEdgeImpl(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()Clone the edge as is, all shared members are shallow copied, fully owned members are deep copiedEdgeSegmentgetEdgeSegmentAb()Edge segment in the direction from A to BEdgeSegmentgetEdgeSegmentBa()Edge segment in the direction from B to AEdgeSegmentregisterEdgeSegment(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.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, validate
-
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, hasEdgeSegmentAb, hasEdgeSegmentBa
-
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, validate
-
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
-
-
-
-
Constructor Detail
-
DirectedEdgeImpl
protected DirectedEdgeImpl(IdGroupingToken groupId, DirectedVertex vertexA, DirectedVertex vertexB, double lengthKm) throws PlanItException
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- Throws:
PlanItException- thrown if there is an error
-
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
-
registerEdgeSegment
public EdgeSegment registerEdgeSegment(EdgeSegment edgeSegment, boolean directionAB) throws PlanItException
Register EdgeSegment. If there already exists an edgeSegment for that direction it is replaced and returned- Specified by:
registerEdgeSegmentin interfaceDirectedEdge- Parameters:
edgeSegment- the edgeSegment to be registereddirectionAB- direction of travel- Returns:
- replaced egeSegment (if any)
- Throws:
PlanItException- thrown if there is an error
-
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()
Clone the edge as is, all shared members are shallow copied, fully owned members are deep copied
-
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
-
-