TraversalBranch (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.graphdb.traversal

## Interface TraversalBranch

- All Superinterfaces:
    Iterable<PropertyContainer>, Path

      public interface TraversalBranch
      extends Path

  Represents a `position` and a `RelationshipExpander` with a traversal context, for example parent and an iterator of relationships to go next. It's a base to write a `BranchSelector` on top of.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `continues()`
    `void` | `evaluation(Evaluation eval)` Can change evaluation outcome in a negative direction.
    `int` | `expanded()` Returns the number of relationships this expansion source has expanded.
    `boolean` | `includes()`
    `void` | `initialize(PathExpander expander, TraversalContext metadata)` Initializes this `TraversalBranch`, the relationship iterator, `Evaluation` etc.
    `TraversalBranch` | `next(PathExpander expander, TraversalContext metadata)` Returns the next expansion source from the expanded relationships from the current node.
    `TraversalBranch` | `parent()` The parent expansion source which created this `TraversalBranch`.
    `void` | `prune()` Explicitly tell this branch to be pruned so that consecutive calls to `next(PathExpander, TraversalContext)` is guaranteed to return `null`.
    `Object` | `state()` Returns the state associated with this branch.

    - ### Methods inherited from interface org.neo4j.graphdb.Path

      `endNode, iterator, lastRelationship, length, nodes, relationships, reverseNodes, reverseRelationships, startNode, toString`

- - ### Method Detail

    - #### parent

          TraversalBranch parent()

      The parent expansion source which created this `TraversalBranch`.
      Returns:
        the parent of this expansion source.

    - #### next

          TraversalBranch next(PathExpander expander,
                             TraversalContext metadata)

      Returns the next expansion source from the expanded relationships from the current node.
      Returns:
        the next expansion source from this expansion source.

    - #### expanded

          int expanded()

      Returns the number of relationships this expansion source has expanded. In this count isn't included the relationship which led to coming here (since that could also be traversed, although skipped, when expanding this source).
      Returns:
        the number of relationships this expansion source has expanded.

    - #### prune

          void prune()

      Explicitly tell this branch to be pruned so that consecutive calls to `next(PathExpander, TraversalContext)` is guaranteed to return `null`.

    - #### continues

          boolean continues()

      Returns:
        whether or not the traversal should continue further along this branch.

    - #### includes

          boolean includes()

      Returns:
        whether or not this branch (the `Path` representation of this branch at least) should be included in the result of this traversal, i.e. returned as one of the `Path`s from f.ex. `TraversalDescription.traverse(org.neo4j.graphdb.Node...)`

    - #### evaluation

          void evaluation(Evaluation eval)

      Can change evaluation outcome in a negative direction. For example to force pruning.
      Parameters:
        `eval` - the `Evaluation` to AND with the current evaluation.

    - #### initialize

          void initialize(PathExpander expander,
                        TraversalContext metadata)

      Initializes this `TraversalBranch`, the relationship iterator, `Evaluation` etc.
      Parameters:
        `expander` - `RelationshipExpander` to use for getting relationships.
        `metadata` - `TraversalContext` to update on progress.

    - #### state

          Object state()

      Returns the state associated with this branch. Why is this of type `Object`? The state object type only exists when specifying the expander in the `TraversalDescription`, not anywhere else. So in the internals of the traversal the state type is unknown and ignored.
      Returns:
        the state assocuated with this branch.

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.