Interface IPath<N>

  • Type Parameters:
    N - The type of elements on the nodes of the path.
    All Known Subinterfaces:
    ILabeledPath<N,​A>

    public interface IPath<N>
    A path is a kind of list for items of some node type N. It is not a list, because it is not meant to be modifiable except at the end (similar to a stack). On a simple path, the edges have no label. An IPath with edge labels is defined in ILabeledPath.
    • Method Detail

      • getUnmodifiableAccessor

        IPath<N> getUnmodifiableAccessor()
        Creates an accessor to the path that cannot be changed. This can be useful for getters that want to return an immutable path.
        Returns:
        The unmodifiable accessor of the path.
      • getRoot

        N getRoot()
        Returns:
        The first node of the path.
      • getHead

        N getHead()
        Returns:
        The last node of the path.
      • getParentOfHead

        N getParentOfHead()
        Returns:
        The second-last node of the path (predecessor of head).
      • extend

        void extend​(N newHead)
        Modifies the path by adding a new node at the end.
        Parameters:
        newHead - The new head of the path.
      • cutHead

        void cutHead()
        Modifies the path by removing the last node of the path (the head).
      • getPathToParentOfHead

        IPath<N> getPathToParentOfHead()
        Creates a new path object that is identical to the current path except that the head is removed. This is equivalent to creating a copy of the current path and invoke cutHead() on it.
        Returns:
        The copy of the current path with the head being the parent of the head of the current path.
      • getPathFromChildOfRoot

        IPath<N> getPathFromChildOfRoot()
        Creates a new path object that is identical to the current path except that the root is removed.
        Returns:
        The copy of the current path with the root being the second node of the current path.
      • getNodes

        java.util.List<N> getNodes()
        Returns:
        The nodes of the path as a list.
      • isPoint

        boolean isPoint()
        Returns:
        true iff there is one point on the path
      • getNumberOfNodes

        int getNumberOfNodes()
        Returns:
        The number of nodes on the path
      • containsNode

        boolean containsNode​(N node)
        Parameters:
        node -
        Returns:
        true iff there is a node on the path with this label