Class GraphPaths


  • public class GraphPaths
    extends Object
    Factory for generating paths which provides for a standard separator and an escaping mechanism. All names in an path are escaped which ensures GraphPath.toString() and parse(String) are inverses.
    • Method Detail

      • first

        public static String first​(GraphPath path)
        Returns the first element of the path
        Parameters:
        path - the graph path
        Returns:
        the first element of the path
      • last

        public static String last​(GraphPath path)
        Returns the last element of the path
        Parameters:
        path - the graph path
        Returns:
        the last element of the path
      • remainder

        public static GraphPath remainder​(GraphPath path)
        Returns a GraphPath consisting of all but the first element of the path
        Parameters:
        path - the original path
        Returns:
        all but the first element of the path
        Throws:
        IllegalArgumentException - if the path does not have at least two elements
      • path

        public static final GraphPath path​(String name)
        Create a path containing a single name.
        Parameters:
        name - The name to convert to a path
        Returns:
        A path consisting only of name
      • path

        public static final GraphPath path​(String... names)
        Create a path containing the given sequence of names.
        Parameters:
        names - An array of names to convert to a path
        Returns:
        A path consisting of the elements of names in their original order
      • parse

        public static final GraphPath parse​(String pathString)
        De-serializes a path from the given string.
        Parameters:
        pathString - String serialization of a path
        Returns:
        The path whose serialization is pathString