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 protectedEdgeSegmentImpl(EdgeSegmentImpl<E> edgeSegmentImpl, boolean deepCopy)Copy constructorprotectedEdgeSegmentImpl(IdGroupingToken groupId, boolean directionAb)Constructor (without setting parent edge)protectedEdgeSegmentImpl(IdGroupingToken groupId, E parentEdge, boolean directionAb)ConstructorprotectedEdgeSegmentImpl(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.EgetParent()Collect the parent edge of the segmentbooleanisDirectionAb()check if edge segment runs from vertex a to b or b to avoidremoveParentEdge()remove the parent edge from this edge segmentvoidsetParent(DirectedEdge parentEdge)Set the parent edgeEdgeSegmentImpl<E>shallowClone()Create a shallow copy of this entitybooleanvalidate()validate the contents of this edge segmentprotected static booleanvalidate(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:
isDirectionAbin interfaceEdgeSegment- Returns:
- true when running from a to b, otherwise false
-
getParent
public E getParent()
Collect the parent edge of the segment- Specified by:
getParentin 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
-
shallowClone
public EdgeSegmentImpl<E> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceEdgeSegment- Specified by:
shallowClonein interfaceGraphEntity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein 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:
deepClonein interfaceEdgeSegment- Specified by:
deepClonein interfaceGraphEntity- Specified by:
deepClonein interfaceIdAble- Specified by:
deepClonein classGraphEntityImpl- Returns:
- deep copy of entity
-
validate
public boolean validate()
validate the contents of this edge segment- Specified by:
validatein interfaceEdgeSegment- Returns:
- true when valid, false otherwise
-
-