Interface Graph.Edge<ID>

  • Type Parameters:
    ID - type of identifier
    All Known Implementing Classes:
    AbstractGraph.SimpleEdge
    Enclosing interface:
    Graph<ID>

    public static interface Graph.Edge<ID>
    An edge between two vertices in a graph. Edge direction depends on graph type. If the graph is directed isDirected() will return true.
    • Method Detail

      • getId

        Optional<ID> getId()
        Returns optional identifier of this edge.
        Returns:
        optional identifier
      • setId

        void setId​(ID id)
        Sets identifier of this edge.
        Parameters:
        id - of edge
        Throws:
        NullPointerException - if id is null
      • getFrom

        ID getFrom()
        Returns vertex id of 'from' endpoint.
        Returns:
        id of 'from' endpoint
      • setFrom

        void setFrom​(ID from)
        Sets vertex id of 'from' endpoint. If vertex does not exist it is created.
        Parameters:
        from - endpoint
        Throws:
        NullPointerException - if from is null
      • from

        ID from()
        Returns vertex id of 'from' endpoint.
        Returns:
        id of 'from' endpoint
      • from

        Graph.Edge<ID> from​(ID from)
        Sets vertex id of 'from' endpoint. If vertex does not exist it is created.
        Parameters:
        from - endpoint
        Returns:
        this edge
        Throws:
        NullPointerException - if from is null
      • getTo

        ID getTo()
        Returns vertex id of 'to' endpoint.
        Returns:
        id of 'to' endpoint
      • setTo

        void setTo​(ID to)
        Sets vertex id of 'to' endpoint. If vertex does not exist it is created.
        Parameters:
        to - endpoint
        Throws:
        NullPointerException - if to is null
      • to

        ID to()
        Returns vertex id of 'to' endpoint.
        Returns:
        id of 'to' endpoint
      • to

        Graph.Edge<ID> to​(ID to)
        Sets vertex id of 'to' endpoint. If vertex does not exist it is created.
        Parameters:
        to - endpoint
        Returns:
        this edge
      • endpoints

        List<ID> endpoints()
        Returns ordered pair of endpoint ids. 'from' endpoint id is always first followed by 'to' endpoint id.
        Returns:
        order pair of endpoints
      • fromVertex

        Graph.Vertex<ID> fromVertex()
        Returns 'from' vertex
        Returns:
        'from' vertex
      • toVertex

        Graph.Vertex<ID> toVertex()
        Returns 'to' vertex
        Returns:
        'to' vertex
      • isDirected

        boolean isDirected()
        Returns true if this edge is directed. This edge is always directed if the parent graph is directed.
        Returns:
        true if this edge is directed
      • getProperty

        Optional<Object> getProperty​(String name)
        Returns Optional of a property. If the property does not exist the returned Optional is empty.

        A property is resolved by first checking properties set on this edge. If the local property does not exist edgeProperties in the graph are checked.

        Parameters:
        name - of property
        Returns:
        optional of named property
        Throws:
        NullPointerException - if name is null
      • setProperty

        void setProperty​(String name,
                         Object value)
        Sets the value of a local property.
        Parameters:
        name - of property
        value - of property
        Throws:
        NullPointerException - if name or value is null
      • property

        Graph.Edge<ID> property​(String name,
                                Object value)
        Sets the value of a local property returning this edge.
        Parameters:
        name - of property
        value - of property
        Returns:
        this edge
        Throws:
        NullPointerException - if name or value is null
      • removeProperty

        Graph.Edge<ID> removeProperty​(String name)
        Removes property from local properties returning this edge.
        Parameters:
        name - of property
        Returns:
        this edge
        Throws:
        NullPointerException - if name is null
      • inherited

        Map<String,​Object> inherited()
        Returns an unmodifiable map of inherited properties
        Returns:
        map of inherited properties
      • local

        Map<String,​Object> local()
        Returns an unmodifiable map of local properties
        Returns:
        map of local properties