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 protectedEdgeSegmentImpl(EdgeSegmentImpl edgeSegmentImpl)Copy constructorprotectedEdgeSegmentImpl(IdGroupingToken groupId, boolean directionAB)Constructor (without setting parent edge)protectedEdgeSegmentImpl(IdGroupingToken groupId, DirectedEdge parentEdge, boolean directionAB)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeSegmentImplclone()Create a shallow copy of this entityDirectedVertexgetDownstreamVertex()Get the segment's downstream vertexDirectedEdgegetParentEdge()Collect the parent edge of the segmentDirectedVertexgetUpstreamVertex()Get the segment's upstream vertexbooleanisDirectionAb()check if edge segment runs from vertex a to b or b to abooleanremove(DirectedVertex vertex)Remove the vertex from the edge segment if it is either the up or downstream vertexvoidremoveParentEdge()remove the parent edge from this edge segmentvoidsetDownstreamVertex(DirectedVertex downstreamVertex)Set another downstream vertex.voidsetParent(DirectedEdge parentEdge)Set the parent edgevoidsetUpstreamVertex(DirectedVertex upstreamVertex)Set another upstream vertex.booleanvalidate()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:
removein interfaceEdgeSegment- Parameters:
vertex- to remove- Returns:
- true when successful, false otherwise
-
setDownstreamVertex
public void setDownstreamVertex(DirectedVertex downstreamVertex)
Set another downstream vertex.- Specified by:
setDownstreamVertexin interfaceEdgeSegment- Parameters:
downstreamVertex- to use
-
setUpstreamVertex
public void setUpstreamVertex(DirectedVertex upstreamVertex)
Set another upstream vertex.- Specified by:
setUpstreamVertexin interfaceEdgeSegment- Parameters:
upstreamVertex- to use
-
getUpstreamVertex
public DirectedVertex getUpstreamVertex()
Get the segment's upstream vertex- Specified by:
getUpstreamVertexin interfaceEdgeSegment- Returns:
- upstream vertex
-
getDownstreamVertex
public DirectedVertex getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertexin interfaceEdgeSegment- Returns:
- downstream vertex
-
isDirectionAb
public boolean isDirectionAb()
check if edge segment runs from vertex a to b or b to a- Specified by:
isDirectionAbin interfaceEdgeSegment- Returns:
- true when running from a to b, otherwise false
-
getParentEdge
public DirectedEdge getParentEdge()
Collect the parent edge of the segment- Specified by:
getParentEdgein interfaceEdgeSegment- Returns:
- parentEdge
-
setParent
public void setParent(DirectedEdge parentEdge)
Set the parent edge- Specified by:
setParentin interfaceEdgeSegment- Parameters:
parentEdge- to set
-
removeParentEdge
public void removeParentEdge()
remove the parent edge from this edge segment- Specified by:
removeParentEdgein interfaceEdgeSegment
-
clone
public EdgeSegmentImpl clone()
Create a shallow copy of this entity- Specified by:
clonein interfaceEdgeSegment- Specified by:
clonein interfaceIdAble- Overrides:
clonein classExternalIdAbleImpl- Returns:
- shallow copy of entity
-
validate
public boolean validate()
validate the contents of this edge segment- Specified by:
validatein interfaceEdgeSegment- Returns:
- true when valid, false otherwise
-
-