Package org.goplanit.graph.directed
Class EdgeSegmentImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.directed.EdgeSegmentImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IdAble>
,EdgeSegment
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
- Direct Known Subclasses:
ConnectoidSegmentImpl
,LinkSegmentImpl
,ServiceLegSegmentImpl
public class EdgeSegmentImpl extends GraphEntityImpl implements EdgeSegment
EdgeSegment represents an edge in a particular (single) direction. Each edge has either one or two edge segments where each edge segment may have a more detailed geography than its parent link (which represents both directions via a centre line)- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.goplanit.utils.graph.EdgeSegment
EDGE_SEGMENT_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EdgeSegmentImpl(EdgeSegmentImpl edgeSegmentImpl)
Copy constructorprotected
EdgeSegmentImpl(IdGroupingToken groupId, boolean directionAB)
Constructor (without setting parent edge)protected
EdgeSegmentImpl(IdGroupingToken groupId, DirectedEdge parentEdge, boolean directionAB)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeSegmentImpl
clone()
Create a shallow copy of this entityDirectedVertex
getDownstreamVertex()
Get the segment's downstream vertexDirectedEdge
getParentEdge()
Collect the parent edge of the segmentDirectedVertex
getUpstreamVertex()
Get the segment's upstream vertexboolean
isDirectionAb()
check if edge segment runs from vertex a to b or b to aboolean
remove(DirectedVertex vertex)
Remove the vertex from the edge segment if it is either the up or downstream vertexvoid
removeParentEdge()
remove the parent edge from this edge segmentvoid
setDownstreamVertex(DirectedVertex downstreamVertex)
Set another downstream vertex.void
setParent(DirectedEdge parentEdge)
Set the parent edgevoid
setUpstreamVertex(DirectedVertex upstreamVertex)
Set another upstream vertex.boolean
validate()
validate the contents of this edge segment-
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.EdgeSegment
getIdClass, getParentName, hasParentName, replace
-
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
-
EdgeSegmentImpl
protected EdgeSegmentImpl(IdGroupingToken groupId, DirectedEdge parentEdge, boolean directionAB)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classparentEdge
- parent edge of segmentdirectionAB
- direction of travel
-
EdgeSegmentImpl
protected EdgeSegmentImpl(IdGroupingToken groupId, boolean directionAB)
Constructor (without setting parent edge)- Parameters:
groupId
- contiguous id generation within this group for instances of this classdirectionAB
- direction of travel
-
EdgeSegmentImpl
protected EdgeSegmentImpl(EdgeSegmentImpl edgeSegmentImpl)
Copy constructor- Parameters:
edgeSegmentImpl
- to copy
-
-
Method Detail
-
remove
public boolean remove(DirectedVertex vertex)
Remove the vertex from the edge segment if it is either the up or downstream vertex- Specified by:
remove
in interfaceEdgeSegment
- Parameters:
vertex
- to remove- Returns:
- true when successful, false otherwise
-
setDownstreamVertex
public void setDownstreamVertex(DirectedVertex downstreamVertex)
Set another downstream vertex.- Specified by:
setDownstreamVertex
in interfaceEdgeSegment
- Parameters:
downstreamVertex
- to use
-
setUpstreamVertex
public void setUpstreamVertex(DirectedVertex upstreamVertex)
Set another upstream vertex.- Specified by:
setUpstreamVertex
in interfaceEdgeSegment
- Parameters:
upstreamVertex
- to use
-
getUpstreamVertex
public DirectedVertex getUpstreamVertex()
Get the segment's upstream vertex- Specified by:
getUpstreamVertex
in interfaceEdgeSegment
- Returns:
- upstream vertex
-
getDownstreamVertex
public DirectedVertex getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertex
in interfaceEdgeSegment
- Returns:
- downstream vertex
-
isDirectionAb
public boolean isDirectionAb()
check if edge segment runs from vertex a to b or b to a- Specified by:
isDirectionAb
in interfaceEdgeSegment
- Returns:
- true when running from a to b, otherwise false
-
getParentEdge
public DirectedEdge getParentEdge()
Collect the parent edge of the segment- Specified by:
getParentEdge
in interfaceEdgeSegment
- Returns:
- parentEdge
-
setParent
public void setParent(DirectedEdge parentEdge)
Set the parent edge- Specified by:
setParent
in interfaceEdgeSegment
- Parameters:
parentEdge
- to set
-
removeParentEdge
public void removeParentEdge()
remove the parent edge from this edge segment- Specified by:
removeParentEdge
in interfaceEdgeSegment
-
clone
public EdgeSegmentImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceEdgeSegment
- Specified by:
clone
in interfaceIdAble
- Overrides:
clone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
validate
public boolean validate()
validate the contents of this edge segment- Specified by:
validate
in interfaceEdgeSegment
- Returns:
- true when valid, false otherwise
-
-