Class Walker


  • public final class Walker
    extends java.lang.Object
    Walks connected shapes within a shape index.

    Any shape that is connected to another shape is "walked". A single shape can have multiple relationships to the same shape. For example, a resource can have both a "get" and a "child" relationship to an operation; however, the referenced operation will appear only once in the walker output.

    Only shapes form a connected graph. Relationships created by traits are not traversed by the walker.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<Shape> walkShapes​(Shape shape)
      Walks connected shapes in the shape index, returning them in a set.
      java.util.Set<Shape> walkShapes​(Shape shape, java.util.function.Predicate<Relationship> predicate)
      Walks connected shapes in the shape index, returning them in a set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Walker

        public Walker​(Model model)
      • Walker

        @Deprecated
        public Walker​(ShapeIndex shapeIndex)
        Deprecated.
    • Method Detail

      • walkShapes

        public java.util.Set<Shape> walkShapes​(Shape shape)
        Walks connected shapes in the shape index, returning them in a set.
        Parameters:
        shape - The shape to start the traversal from.
        Returns:
        Returns a set of connected shapes.
      • walkShapes

        public java.util.Set<Shape> walkShapes​(Shape shape,
                                               java.util.function.Predicate<Relationship> predicate)
        Walks connected shapes in the shape index, returning them in a set.
        Parameters:
        shape - The shape to start the traversal from.
        predicate - Predicate used to prevent traversing relationships.
        Returns:
        Returns a set of connected shapes.