Interface BidirectionalTraversalDescription


public interface BidirectionalTraversalDescription
Represents a description of a bidirectional traversal. A Bidirectional traversal has a start side and an end side and an evaluator to handle collisions between those two sides, collisions which generates paths between start and end node(s). A BidirectionalTraversalDescription is immutable and each method which adds or modifies the behavior returns a new instances that includes the new modification, leaving the instance which returns the new instance intact. The interface is still experimental and may still change significantly.
See Also:
  • Method Details

    • startSide

      Sets the start side TraversalDescription of this bidirectional traversal. The point of a bidirectional traversal is that the start and end side will meet (or collide) in the middle somewhere and generate paths evaluated and returned by this traversal.
      Parameters:
      startSideDescription - the TraversalDescription to use for the start side traversal.
      Returns:
      a new traversal description with the new modifications.
    • endSide

      Sets the end side TraversalDescription of this bidirectional traversal. The point of a bidirectional traversal is that the start and end side will meet (or collide) in the middle somewhere and generate paths evaluated and returned by this traversal.
      Parameters:
      endSideDescription - the TraversalDescription to use for the end side traversal.
      Returns:
      a new traversal description with the new modifications.
    • mirroredSides

      Sets both the start side and end side of this bidirectional traversal, the start side is assigned the sideDescription and the end side is assigned the same description, although reversed. This will replace any traversal description previously set by startSide(TraversalDescription) or endSide(TraversalDescription).
      Parameters:
      sideDescription - the TraversalDescription to use for both sides of the bidirectional traversal. The end side will have it reversed
      Returns:
      a new traversal description with the new modifications.
    • collisionPolicy

      BidirectionalTraversalDescription collisionPolicy(BranchCollisionPolicy collisionDetection)
      Sets the collision policy to use during this traversal. Branch collisions happen between TraversalBranches where start and end branches meet and Paths are generated from it.
      Parameters:
      collisionDetection - the BranchCollisionPolicy to use during this traversal.
      Returns:
      a new traversal description with the new modifications.
    • collisionEvaluator

      BidirectionalTraversalDescription collisionEvaluator(Evaluator collisionEvaluator)
      Sets the Evaluator to use for branch collisions. The outcome returned from the evaluator affects the colliding branches.
      Parameters:
      collisionEvaluator - the Evaluator to use for evaluating branch collisions.
      Returns:
      a new traversal description with the new modifications.
    • collisionEvaluator

      BidirectionalTraversalDescription collisionEvaluator(PathEvaluator collisionEvaluator)
      Sets the PathEvaluator to use for branch collisions. The outcome returned from the evaluator affects the colliding branches.
      Parameters:
      collisionEvaluator - the PathEvaluator to use for evaluating branch collisions.
      Returns:
      a new traversal description with the new modifications.
    • sideSelector

      BidirectionalTraversalDescription sideSelector(SideSelectorPolicy sideSelector, int maxDepth)
      In a bidirectional traversal the traverser alternates which side (start or end) to move further for each step. This sets the SideSelectorPolicy to use.
      Parameters:
      sideSelector - the SideSelectorPolicy to use for this traversal.
      maxDepth - optional max depth parameter to the side selector. Why is max depth a concern of the SideSelector? Because it has got knowledge of both the sides of the traversal at any given point.
      Returns:
      a new traversal description with the new modifications.
    • traverse

      Traverser traverse(Node start, Node end)
      Traverse between a given start and end node with all applied rules and behavior in this traversal description. A Traverser is returned which is used to step through the graph and getting results back. The traversal is not guaranteed to start before the Traverser is used.
      Parameters:
      start - Node to use as starting point for the start side in this traversal.
      end - Node to use as starting point for the end side in this traversal.
      Returns:
      a Traverser used to step through the graph and to get results from.
    • traverse

      Traverser traverse(Iterable<Node> start, Iterable<Node> end)
      Traverse between a set of start and end nodes with all applied rules and behavior in this traversal description. A Traverser is returned which is used to step through the graph and getting results back. The traversal is not guaranteed to start before the Traverser is used.
      Parameters:
      start - set of nodes to use as starting points for the start side in this traversal.
      end - set of nodes to use as starting points for the end side in this traversal.
      Returns:
      a Traverser used to step through the graph and to get results from.