Class EdgeImpl<V extends Vertex>

    • Field Detail

      • lineGeometry

        protected org.locationtech.jts.geom.LineString lineGeometry
        The line geometry of this link if set
      • inputProperties

        protected Map<String,​Object> inputProperties
        Generic input property storage
      • name

        protected String name
        Name of the edge
      • lengthInKm

        protected Double lengthInKm
        Length of edge
    • Constructor Detail

      • EdgeImpl

        protected EdgeImpl​(IdGroupingToken groupId,
                           V vertexA,
                           V vertexB)
        Constructor which injects link lengths directly
        Parameters:
        groupId - , contiguous id generation within this group for instances of this class
        vertexA - first vertex in the link
        vertexB - second vertex in the link
      • EdgeImpl

        protected EdgeImpl​(IdGroupingToken groupId,
                           V vertexA,
                           V vertexB,
                           double lengthKm)
        Constructor which injects link lengths directly
        Parameters:
        groupId - , contiguous id generation within this group for instances of this class
        vertexA - first vertex in the link
        vertexB - second vertex in the link
        lengthKm - length of the link
      • EdgeImpl

        protected EdgeImpl​(EdgeImpl<V> other,
                           boolean deepCopy)
        Copy constructor
        Parameters:
        other - to copy
        deepCopy - when true, create a deep copy, shallow copy otherwise
    • Method Detail

      • setVertexB

        protected void setVertexB​(V vertexB)
        set vertex B
        Parameters:
        vertexB - to set
      • setVertexA

        protected void setVertexA​(V vertexA)
        set vertex A
        Parameters:
        vertexA - to set
      • getGeometry

        public org.locationtech.jts.geom.LineString getGeometry()
        Collect the geometry of this line
        Specified by:
        getGeometry in interface Edge
        Returns:
        lineString
      • setGeometry

        public void setGeometry​(org.locationtech.jts.geom.LineString lineString)
        set the geometry of this link as a line string
        Specified by:
        setGeometry in interface Edge
        Parameters:
        lineString - to set
      • removeVertex

        public boolean removeVertex​(Vertex vertex)
        Remove vertex from edge
        Specified by:
        removeVertex in interface Edge
        Parameters:
        vertex - to remove
        Returns:
        true when successful false otherwise
      • removeVertexB

        public boolean removeVertexB()
        remove vertex B by setting it to null
        Returns:
        true
      • removeVertexA

        public boolean removeVertexA()
        remove vertex A by setting it to null
        Returns:
        true
      • addInputProperty

        public void addInputProperty​(String key,
                                     Object value)
        Add a property from the original input that is not part of the readily available link members
        Specified by:
        addInputProperty in interface Edge
        Parameters:
        key - (name) of input property
        value - of input property
      • getInputProperty

        public Object getInputProperty​(String key)
        Get input property by its key
        Specified by:
        getInputProperty in interface Edge
        Parameters:
        key - of input property
        Returns:
        value retrieved value of input property
      • getLengthKm

        public double getLengthKm()
        Return length of this edge in km
        Specified by:
        getLengthKm in interface Edge
        Returns:
        length of this edge in km
      • setLengthKm

        public void setLengthKm​(double lengthInKm)
        set length of this edge in km
        Specified by:
        setLengthKm in interface Edge
        Parameters:
        lengthInKm - of this edge in km
      • getVertexA

        public V getVertexA()
        Vertex A of the edge
        Specified by:
        getVertexA in interface Edge
        Returns:
        vertex A
      • getVertexB

        public V getVertexB()
        Vertex B of the edge
        Specified by:
        getVertexB in interface Edge
        Returns:
        vertex B
      • getName

        public String getName()
        get the name of the edge
        Specified by:
        getName in interface Edge
        Returns:
        name
      • setName

        public void setName​(String name)
        set the name of the edge
        Specified by:
        setName in interface Edge
        Parameters:
        name - to set
      • replace

        public boolean replace​(Vertex vertexToReplace,
                               Vertex vertexToReplaceWith)
        Replace one of the vertices of the link
        Specified by:
        replace in interface Edge
        Parameters:
        vertexToReplace - the vertex to replace
        vertexToReplaceWith - the vertex to replace with
        Returns:
        true when replaced, false otherwise
      • deepClone

        public EdgeImpl<V> 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 Edge
        Specified by:
        deepClone in interface GraphEntity
        Specified by:
        deepClone in interface IdAble
        Specified by:
        deepClone in class GraphEntityImpl
        Returns:
        deep copy of entity
      • validate

        public boolean validate()
        validate the contents of this edge
        Specified by:
        validate in interface Edge
        Returns:
        true when valid, false otherwise