Package org.goplanit.graph.directed
Class EdgeSegmentImpl<E extends DirectedEdge>
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.directed.EdgeSegmentImpl<E>
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,EdgeSegment
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
- Direct Known Subclasses:
ConjugateConnectoidSegmentImpl
,ConjugateEdgeSegmentImpl
,ConjugateLinkSegmentImpl
,ConnectoidSegmentImpl
,LinkSegmentBase
,ServiceLegSegmentImpl
public class EdgeSegmentImpl<E extends DirectedEdge> 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.directed.EdgeSegment
EDGE_SEGMENT_ID_CLASS, getDownstreamVertex, getUpstreamVertex
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EdgeSegmentImpl(EdgeSegmentImpl<E> edgeSegmentImpl, boolean deepCopy)
Copy constructorprotected
EdgeSegmentImpl(IdGroupingToken groupId, boolean directionAb)
Constructor (without setting parent edge)protected
EdgeSegmentImpl(IdGroupingToken groupId, E parentEdge, boolean directionAb)
Constructorprotected
EdgeSegmentImpl(IdGroupingToken groupId, E parentEdge, boolean directionAb, Class<? extends EdgeSegment> idClazz)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeSegmentImpl<E>
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.E
getParent()
Collect the parent edge of the segmentboolean
isDirectionAb()
check if edge segment runs from vertex a to b or b to avoid
removeParentEdge()
remove the parent edge from this edge segmentvoid
setParent(DirectedEdge parentEdge)
Set the parent edgeEdgeSegmentImpl<E>
shallowClone()
Create a shallow copy of this entityboolean
validate()
validate the contents of this edge segmentprotected static boolean
validate(EdgeSegment edgeSegment)
Validate given edge segment on validity-
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.directed.EdgeSegment
getDownstreamVertex, getIdClass, getLengthKm, getOppositeDirectionSegment, getParentName, getUpstreamVertex, hasGeometry, hasParent, hasParentName, isAdjacent, isParentGeometryInSegmentDirection
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, 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, E parentEdge, boolean directionAb, Class<? extends EdgeSegment> idClazz)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classparentEdge
- parent edge of segmentdirectionAb
- direction of travelidClazz
- custom id class to use
-
EdgeSegmentImpl
protected EdgeSegmentImpl(IdGroupingToken groupId, E 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<E> edgeSegmentImpl, boolean deepCopy)
Copy constructor- Parameters:
edgeSegmentImpl
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
validate
protected static final boolean validate(EdgeSegment edgeSegment)
Validate given edge segment on validity- Parameters:
edgeSegment
- to validate- Returns:
- true when valid, false when not
-
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
-
getParent
public E getParent()
Collect the parent edge of the segment- Specified by:
getParent
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
-
shallowClone
public EdgeSegmentImpl<E> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceEdgeSegment
- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in classGraphEntityImpl
- Returns:
- shallow copy of entity
-
deepClone
public EdgeSegmentImpl<E> deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClone
in interfaceEdgeSegment
- Specified by:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in classGraphEntityImpl
- Returns:
- deep 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
-
-