Class ServiceLegSegmentImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.directed.EdgeSegmentImpl<ServiceLeg>
-
- org.goplanit.network.layer.service.ServiceLegSegmentImpl
-
- All Implemented Interfaces:
Serializable,Comparable<IdAble>,EdgeSegment,GraphEntity,ExternalIdAble,IdAble,ManagedId,ServiceLegSegment
public class ServiceLegSegmentImpl extends EdgeSegmentImpl<ServiceLeg> implements ServiceLegSegment
A service leg segment implementation.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<? extends LinkSegment>networkLayerLinkSegmentsService leg's underlying links connecting its two service nodes-
Fields inherited from interface org.goplanit.utils.graph.directed.EdgeSegment
EDGE_SEGMENT_ID_CLASS, getDownstreamVertex, getUpstreamVertex
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedServiceLegSegmentImpl(ServiceLegSegmentImpl other, boolean deepCopy)Copy constructorprotectedServiceLegSegmentImpl(IdGroupingToken tokenId, ServiceLeg parentLeg, boolean directionAB)Constructor with no reference to underlying physical links (to be populated later)protectedServiceLegSegmentImpl(IdGroupingToken tokenId, ServiceLeg parentLeg, boolean directionAB, List<LinkSegment> networkLayerLinkSegments)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceLegSegmentImpldeepClone()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.org.locationtech.jts.geom.LineStringgetGeometry()Collect the geometry of this service leg segment.doublegetLengthKm()Sum of the underlying network layer link lengths.ServiceLeggetParent()Collect the parent edge of the segmentList<? extends LinkSegment>getPhysicalParentSegments()Collect the links that make up this leg ordered and in direction from A to BbooleanhasGeometry()verify if geometry is present based on parent's geometryvoidsetPhysicalParentSegments(List<? extends LinkSegment> networkLayerLinkSegments)Set the network layer links that make up this leg irrespective wether they have been set before.ServiceLegSegmentImplshallowClone()Create a shallow copy of this entitybooleanvalidate()Validate based on edge that it is, but also make sure that the references to parent network are consistent, i.e., the service nodes reside on the parent links in the right location as well-
Methods inherited from class org.goplanit.graph.directed.EdgeSegmentImpl
isDirectionAb, removeParentEdge, setParent, validate
-
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, getOppositeDirectionSegment, getParentName, getUpstreamVertex, hasParent, hasParentName, isAdjacent, isDirectionAb, isParentGeometryInSegmentDirection, removeParentEdge, setParent
-
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
-
Methods inherited from interface org.goplanit.utils.network.layer.service.ServiceLegSegment
getDownstreamServiceNode, getFirstPhysicalLinkSegment, getLastPhysicalLinkSegment, getUpstreamServiceNode, hasPhysicalParentSegments
-
-
-
-
Field Detail
-
networkLayerLinkSegments
protected List<? extends LinkSegment> networkLayerLinkSegments
Service leg's underlying links connecting its two service nodes
-
-
Constructor Detail
-
ServiceLegSegmentImpl
protected ServiceLegSegmentImpl(IdGroupingToken tokenId, ServiceLeg parentLeg, boolean directionAB)
Constructor with no reference to underlying physical links (to be populated later)- Parameters:
tokenId- contiguous id generation within this group for instances of this classparentLeg- parent leg of segmentdirectionAB- direction of travel
-
ServiceLegSegmentImpl
protected ServiceLegSegmentImpl(IdGroupingToken tokenId, ServiceLeg parentLeg, boolean directionAB, List<LinkSegment> networkLayerLinkSegments)
Constructor- Parameters:
tokenId- contiguous id generation within this group for instances of this classparentLeg- parent leg of segmentdirectionAB- direction of travelnetworkLayerLinkSegments- to use
-
ServiceLegSegmentImpl
protected ServiceLegSegmentImpl(ServiceLegSegmentImpl other, boolean deepCopy)
Copy constructor- Parameters:
other- to copydeepCopy- when true, create a deep cpy, shallow copy otherwise
-
-
Method Detail
-
getParent
public ServiceLeg getParent()
Collect the parent edge of the segment- Specified by:
getParentin interfaceEdgeSegment- Specified by:
getParentin interfaceServiceLegSegment- Overrides:
getParentin classEdgeSegmentImpl<ServiceLeg>- Returns:
- parentEdge
-
getGeometry
public org.locationtech.jts.geom.LineString getGeometry()
Collect the geometry of this service leg segment. Because service leg segments comprise one or more physical link segments, they may have unique geometry compared to their opposite direction counterpart. Therefore, they are expected to be able to provide their own unique access to their geometry rather than rely on their parent, also this may be generated on the fly rather than stored on the instance- Specified by:
getGeometryin interfaceServiceLegSegment- Returns:
- lineString
-
getLengthKm
public double getLengthKm()
Sum of the underlying network layer link lengths. If no links are registered 0 is returned- Specified by:
getLengthKmin interfaceEdgeSegment- Returns:
- found length
-
hasGeometry
public boolean hasGeometry()
Description copied from interface:EdgeSegmentverify if geometry is present based on parent's geometry- Specified by:
hasGeometryin interfaceEdgeSegment- Specified by:
hasGeometryin interfaceServiceLegSegment- Returns:
- true when all underlying links have a geometry, false otherwise
-
getPhysicalParentSegments
public List<? extends LinkSegment> getPhysicalParentSegments()
Collect the links that make up this leg ordered and in direction from A to B- Specified by:
getPhysicalParentSegmentsin interfaceServiceLegSegment- Returns:
- parent links this leg represents
-
setPhysicalParentSegments
public void setPhysicalParentSegments(List<? extends LinkSegment> networkLayerLinkSegments)
Set the network layer links that make up this leg irrespective wether they have been set before. Use with caution- Specified by:
setPhysicalParentSegmentsin interfaceServiceLegSegment- Parameters:
networkLayerLinkSegments- to use
-
validate
public boolean validate()
Validate based on edge that it is, but also make sure that the references to parent network are consistent, i.e., the service nodes reside on the parent links in the right location as well- Specified by:
validatein interfaceEdgeSegment- Overrides:
validatein classEdgeSegmentImpl<ServiceLeg>- Returns:
- true when valid, false otherwise
-
shallowClone
public ServiceLegSegmentImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceEdgeSegment- Specified by:
shallowClonein interfaceGraphEntity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceServiceLegSegment- Overrides:
shallowClonein classEdgeSegmentImpl<ServiceLeg>- Returns:
- shallow copy of entity
-
deepClone
public ServiceLegSegmentImpl 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 interfaceServiceLegSegment- Overrides:
deepClonein classEdgeSegmentImpl<ServiceLeg>- Returns:
- deep copy of entity
-
-