Interface EdgeSegment

    • Method Detail

      • getVertexForEdgeSegmentLambda

        static Function<EdgeSegment,​DirectedVertex> getVertexForEdgeSegmentLambda​(boolean upstreamVertex)
        Collect vertex of given edge segment lambda
        Parameters:
        upstreamVertex - when true collect upstream vertex, downstream vertex otherwise
        Returns:
        lambda function
      • hasSegment

        static boolean hasSegment​(EdgeSegment edgeSegment,
                                  Iterable<? extends EdgeSegment> edgeSegments)
        Find segment in iterable of segments
        Parameters:
        edgeSegment - to find
        edgeSegments - to find them in
        Returns:
        true when present, false otherwise
      • getUpstreamVertex

        default DirectedVertex getUpstreamVertex()
        Get the segment's upstream vertex
        Returns:
        upstream vertex
      • getDownstreamVertex

        default DirectedVertex getDownstreamVertex()
        Get the segment's downstream vertex
        Returns:
        downstream vertex
      • getParent

        DirectedEdge getParent()
        Collect the parent edge of the segment
        Returns:
        parentEdge
      • hasParent

        default boolean hasParent()
        Verify if segment has parent set
        Returns:
        true if present, false otherwise
      • removeParentEdge

        void removeParentEdge()
        remove the parent edge from this edge segment
      • isDirectionAb

        boolean isDirectionAb()
        check if edge segment runs from vertex a to b or b to a
        Returns:
        true when running from a to b, otherwise false
      • validate

        boolean validate()
        validate the contents of this edge segment
        Returns:
        true when valid, false otherwise
      • deepClone

        EdgeSegment 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 interface GraphEntity
        Specified by:
        deepClone in interface IdAble
        Returns:
        deep copy of entity
      • setParent

        void setParent​(DirectedEdge parentEdge)
        Set the parent edge
        Parameters:
        parentEdge - to set
      • getIdClass

        default Class<? extends EdgeSegment> getIdClass()
        All edges use the EDGE_SEGMENT_ID_CLASS to generate the unique internal ids
        Specified by:
        getIdClass in interface ManagedId
        Returns:
        idClass to use for generating ids for instances of this idable derived class
      • hasParentName

        default boolean hasParentName()
        verify if parent (edge) has a name
        Returns:
        true when present, false otherwise
      • getParentName

        default String getParentName()
        verify if parent (edge) has a name
        Returns:
        true when present, false otherwise
      • getOppositeDirectionSegment

        default EdgeSegment getOppositeDirectionSegment()
        Collect the opposite direction segment of this edge segment (if any)
        Returns:
        opposite direction segment, null if not present
      • isParentGeometryInSegmentDirection

        default boolean isParentGeometryInSegmentDirection​(boolean allowSingleVertexWithoutGeometry)
        Assuming geometry is present, if not false is returned, we verify if the geometry is provided in the direction of the segment or not
        Parameters:
        allowSingleVertexWithoutGeometry - when true, we assume that geometry of edge is ok to be not matching vertex on one end
        Returns:
        true when geometry direction coincides with segment direction, false otherwise
      • isAdjacent

        default boolean isAdjacent​(EdgeSegment other,
                                   boolean allowUTurn)
        Verify if provided edge segment is adjacent to this edge segment taking direction into account, i.e., either an upstream segment is directly adjacent to this segment, or this segment connects to a directly adjcent downstream segment
        Parameters:
        other - edge segment to verify adjacency
        allowUTurn - when true the opposite direction segment is considered adjacent, otherwise not
        Returns:
        true when adjacent, false otherwise
      • getLengthKm

        default double getLengthKm()
        Provides the length in km based on its parent's information
        Returns:
        length in km of the segment
      • hasGeometry

        default boolean hasGeometry()
        verify if geometry is present based on parent's geometry
        Returns:
        true when parent has geometry, false otherwise