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

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

    • create

      P create(List<E> elements, 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(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 List<P> merge(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