Class Node<DataT,​NodeT extends Node<DataT,​NodeT>>

  • Type Parameters:
    DataT - the type of the data stored in the node
    NodeT - the type of the node
    Direct Known Subclasses:
    DAGNode

    public class Node<DataT,​NodeT extends Node<DataT,​NodeT>>
    extends Object
    Type represents a node in a Graph.
    • Constructor Detail

      • Node

        public Node​(String key,
                    DataT data)
        Creates a graph node.
        Parameters:
        key - unique id of the node
        data - data to be stored in the node
    • Method Detail

      • key

        public String key()
        Returns:
        this node's unique id
      • data

        public DataT data()
        Returns:
        data stored in this node
      • hasChildren

        public boolean hasChildren()
        Returns:
        true if this node has any children
      • children

        public List<String> children()
        Returns:
        children (neighbours) of this node
      • addChild

        public void addChild​(String childKey)
        Parameters:
        childKey - add a child (neighbour) of this node
      • removeChild

        public void removeChild​(String childKey)
        Parameters:
        childKey - remove child (neighbour) of this node
      • setOwner

        public void setOwner​(Graph<DataT,​NodeT> ownerGraph)
        Sets reference to the graph owning this node.
        Parameters:
        ownerGraph - the owning graph
      • owner

        public Graph<DataT,​NodeT> owner()
        Returns:
        the owner (container) graph of this node.