Class PathFinder.Path

  • All Implemented Interfaces:
    java.lang.Iterable<Relationship>, java.util.Collection<Relationship>, java.util.List<Relationship>
    Enclosing class:
    PathFinder

    public static final class PathFinder.Path
    extends java.util.AbstractList<Relationship>
    An immutable Relationship path from a starting shape to an end shape.
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      Path​(java.util.List<Relationship> relationships)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Relationship get​(int index)  
      Shape getEndShape()
      Gets the ending shape of the Path that matched the selector and is connected to the starting shape.
      java.util.List<Shape> getShapes()
      Gets a list of all shapes in the path including the starting shape all the way to the last shape.
      Shape getStartShape()
      Gets the starting shape of the Path.
      int size()  
      java.lang.String toString()
      Converts the path to valid Selector syntax.
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Constructor Detail

      • Path

        public Path​(java.util.List<Relationship> relationships)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<Relationship>
        Specified by:
        size in interface java.util.List<Relationship>
        Specified by:
        size in class java.util.AbstractCollection<Relationship>
      • getShapes

        public java.util.List<Shape> getShapes()
        Gets a list of all shapes in the path including the starting shape all the way to the last shape.

        The returned list does not return the last element (the end shape targeted by the last neighbor) if it does not exist.

        Returns:
        Returns the list of shapes.
      • getStartShape

        public Shape getStartShape()
        Gets the starting shape of the Path.
        Returns:
        Returns the starting shape of the Path.
      • getEndShape

        public Shape getEndShape()
        Gets the ending shape of the Path that matched the selector and is connected to the starting shape.
        Returns:
        Returns the ending shape of the Path.
        Throws:
        SourceException - if the relationship is invalid.
      • toString

        public java.lang.String toString()
        Converts the path to valid Selector syntax.
        Overrides:
        toString in class java.util.AbstractCollection<Relationship>
        Returns:
        Returns the path as a selector.