Interface PathFactory<P extends Path<P,​E>,​E>

  • Type Parameters:
    P - the path type
    E - the path element type

    public interface PathFactory<P extends Path<P,​E>,​E>
    A factory for Paths.
    Author:
    harald
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      P create​(java.util.List<E> elements, java.util.List<P> paths)
      Creates a new path from elements and continuation paths.
      P create​(java.util.List<E> elements, P path)
      Creates a new path by prepending elements to an existing path.
      default java.util.List<P> merge​(java.util.List<P> paths)
      Merge paths to remove redundant path segments.
      The returned consolidated paths form a hierarchical graph.
    • Method Detail

      • create

        P create​(java.util.List<E> elements,
                 java.util.List<P> paths)
        Creates a new path from elements and continuation paths.
        Parameters:
        elements - the elements of the path
        paths - the continuation paths
        Returns:
        the new path
      • create

        P create​(java.util.List<E> elements,
                 P path)
        Creates a new path by prepending elements to an existing path.
        Parameters:
        elements - the elements to prepend
        path - the path to prepend elements
        Returns:
        the new concatenated path
      • merge

        default java.util.List<P> merge​(java.util.List<P> paths)
        Merge paths to remove redundant path segments.
        The returned consolidated paths form a hierarchical graph.
         Example:
        
         given:
        
         a1 -- b1 -- c1 -- d1 -- eX
         a1 -- b1 -- c1 -- d2
         a1 -- b1 -- c2
         a1 -- b1 -- c2 -- d3
         a1 -- b1 -- c2 -- d3 -- eX
         a1 -- b2 -- cX -- dX
         a1 -- b2
        
         merged result:
        
         a1 -- b1 -- c1 -- d1 -- eX
            |     |     |
            |     |     -- d2
            |     |
            |     -- c2 -- d3 -- eX
            |
            -- b2 -- cX -- dX
        
         
        Parameters:
        paths - input paths
        Returns:
        consolidated paths