Class ServiceNodeImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.VertexImpl<Edge>
-
- org.goplanit.graph.directed.DirectedVertexImpl<ServiceLegSegment>
-
- org.goplanit.network.layer.service.ServiceNodeImpl
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,DirectedVertex
,GraphEntity
,Vertex
,ExternalIdAble
,IdAble
,ManagedId
,ServiceNode
public class ServiceNodeImpl extends DirectedVertexImpl<ServiceLegSegment> implements ServiceNode
A ServiceNode is used in a ServiceNetwork where it holds a reference to a DirectedNode of the ServiceNetworkLayer's underlying physical network layer. Each ServiceNode represents a location where at least a single service exists, e.g. a stop location of a public service vehicle- Author:
- markr
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.goplanit.graph.directed.DirectedVertexImpl
DirectedVertexImpl.EdgeSegmentIterable<ESI extends EdgeSegment>, DirectedVertexImpl.EdgeSegmentIterator<ES extends EdgeSegment>
-
-
Field Summary
-
Fields inherited from class org.goplanit.graph.directed.DirectedVertexImpl
entryEdgeSegments, exitEdgeSegments
-
Fields inherited from class org.goplanit.graph.VertexImpl
edges, inputProperties, position
-
Fields inherited from interface org.goplanit.utils.graph.directed.DirectedVertex
getEntryEdgeSegments, getExitEdgeSegments
-
Fields inherited from interface org.goplanit.utils.graph.Vertex
VERTEX_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ServiceNodeImpl(ServiceNodeImpl other, boolean deepCopy)
Copy constructorprotected
ServiceNodeImpl(IdGroupingToken tokenId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceNodeImpl
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.protected Stream<Node>
getEntrySegmentsDownstreamPhysicalNodeStream()
Collect stream of downstream physical nodes of attached entry service leg segments (if any)protected Stream<Node>
getExitSegmentsUpstreamPhysicalNodeStream()
Collect stream of upstream physical nodes of attached exit service leg segments (if any)Set<Node>
getPhysicalParentNodes()
Collect the physical nodes at the extremities of all underlying physical link segments.org.locationtech.jts.geom.Point
getPosition()
Construct new position based on underlying physical node(s).boolean
hasPhysicalParentNodes()
Verify if a physical parent node is linked to this service nodeboolean
isMappedToPhysicalParentNode(Node physicalParentNode)
Verify if provided node is registered as a physical parent node of this service nodevoid
setPosition(org.locationtech.jts.geom.Point position)
##Set the center point geometry for a vertexServiceNodeImpl
shallowClone()
Create a shallow copy of this entity-
Methods inherited from class org.goplanit.graph.directed.DirectedVertexImpl
getEdges, getEntryEdgeSegments, getExitEdgeSegments
-
Methods inherited from class org.goplanit.graph.VertexImpl
addEdge, addInputProperty, getInputProperty, removeAllEdges, removeEdge
-
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.DirectedVertex
getEdges, getEdgeSegment, getEntryEdgeSegments, getExitEdgeSegments, getNumberOfEntryEdgeSegments, getNumberOfExitEdgeSegments, hasEntryEdgeSegments, hasEntrySegment, hasExitEdgeSegments, hasExitSegment
-
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.ServiceNode
getEntryLegSegments, getExitLegSegments, getFirstEntryLegSegment, getFirstExitLegSegment, getLegs, getLegSegment
-
Methods inherited from interface org.goplanit.utils.graph.Vertex
addEdge, addEdges, addInputProperty, getEdges, getIdClass, getInputProperty, getNumberOfEdges, hasPosition, isPositionEqual2D, isPositionEqual2D, removeAllEdges, removeEdge, removeEdge, removeEdges, replace, transformPosition, validate
-
-
-
-
Constructor Detail
-
ServiceNodeImpl
protected ServiceNodeImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- contiguous id generation within this group for instances of this class
-
ServiceNodeImpl
protected ServiceNodeImpl(ServiceNodeImpl other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
getEntrySegmentsDownstreamPhysicalNodeStream
protected Stream<Node> getEntrySegmentsDownstreamPhysicalNodeStream()
Collect stream of downstream physical nodes of attached entry service leg segments (if any)- Returns:
- the stream
-
getExitSegmentsUpstreamPhysicalNodeStream
protected Stream<Node> getExitSegmentsUpstreamPhysicalNodeStream()
Collect stream of upstream physical nodes of attached exit service leg segments (if any)- Returns:
- the stream
-
getPosition
public final org.locationtech.jts.geom.Point getPosition()
Construct new position based on underlying physical node(s). If multiple physical nodes are used to represent this service node, the average position of each of them is returned. Unlike physical nodes, the position of service nodes does not live on the object instance, it is recreated every time the position is queried.- Specified by:
getPosition
in interfaceVertex
- Overrides:
getPosition
in classVertexImpl<Edge>
- Returns:
- newly inferred service node position
-
setPosition
public void setPosition(org.locationtech.jts.geom.Point position)
Description copied from class:VertexImpl
#Set the center point geometry for a vertex- Specified by:
setPosition
in interfaceVertex
- Overrides:
setPosition
in classVertexImpl<Edge>
- Parameters:
position
- the center point for a vertex
-
getPhysicalParentNodes
public final Set<Node> getPhysicalParentNodes()
Collect the physical nodes at the extremities of all underlying physical link segments. Since these can be different, these might result in multiple physical nodes rather than one- Specified by:
getPhysicalParentNodes
in interfaceServiceNode
- Returns:
- related network layer node(s)
-
hasPhysicalParentNodes
public boolean hasPhysicalParentNodes()
Description copied from interface:ServiceNode
Verify if a physical parent node is linked to this service node- Specified by:
hasPhysicalParentNodes
in interfaceServiceNode
- Returns:
- true when present false otherwise
-
shallowClone
public ServiceNodeImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceServiceNode
- Specified by:
shallowClone
in interfaceVertex
- Overrides:
shallowClone
in classDirectedVertexImpl<ServiceLegSegment>
- Returns:
- shallow copy of entity
-
deepClone
public ServiceNodeImpl 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 interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceServiceNode
- Specified by:
deepClone
in interfaceVertex
- Overrides:
deepClone
in classDirectedVertexImpl<ServiceLegSegment>
- Returns:
- deep copy of entity
-
isMappedToPhysicalParentNode
public boolean isMappedToPhysicalParentNode(Node physicalParentNode)
Verify if provided node is registered as a physical parent node of this service node- Specified by:
isMappedToPhysicalParentNode
in interfaceServiceNode
- Parameters:
physicalParentNode
- to verify- Returns:
- true when registered, false otherwise
-
-