Package ghidra.trace.database.target.visitors

# Interface TreeTraversal.Visitor

All Known Subinterfaces:
  `TreeTraversal.SpanIntersectingVisitor`

All Known Implementing Classes:
  `AllPathsVisitor`, `AncestorsRelativeVisitor`, `AncestorsRootVisitor`, `CanonicalSuccessorsRelativeVisitor`, `OrderedSuccessorsVisitor`, `SuccessorsRelativeVisitor`

Enclosing class:
  `TreeTraversal`

public static interface TreeTraversal.Visitor
An object-tree visitor

Traversal starts at a seed object or value (node or edge, respectively) and proceeds in alternating fashion from object to value to object and so on via `continueObject(TraceObjectValue)` and `continueValues(TraceObject, Lifespan, TraceObjectValPath)`. Filtering is performed on values via `visitValue(TraceObjectValue, TraceObjectValPath)`. As traversal descends, paths and spans are composed to inform filtering and construct the final result stream. Note that some traversals start at a seed and "descend" along the ancestry.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TraceObjectValPath`
  `composePath(TraceObjectValPath pre, TraceObjectValue value)`
  When descending in a value, what path leads to the value
  `Lifespan`
  `composeSpan(Lifespan pre, TraceObjectValue value)`
  When descending in a value, what span to consider in the subtree
  `TraceObject`
  `continueObject(TraceObjectValue value)`
  When descending in a value, the object to consider next
  `Stream<? extends TraceObjectValue>`
  `continueValues(TraceObject object, Lifespan span, TraceObjectValPath path)`
  When descending in an object, the values to consider next
  `TreeTraversal.VisitResult`
  `visitValue(TraceObjectValue value, TraceObjectValPath path)`
  Visit a value

- ## Method Details

  - ### composeSpan

    Lifespan composeSpan(Lifespan pre, TraceObjectValue value)
    When descending in a value, what span to consider in the subtree

    Usually this is intersection. See `TreeTraversal.SpanIntersectingVisitor`

    Parameters:
      `pre` - the span composed from values from seed to but excluding the current value
      `value` - the current value
    Returns:
      the span composed from values from seed to and including the current value

  - ### composePath

    TraceObjectValPath composePath(TraceObjectValPath pre, TraceObjectValue value)
    When descending in a value, what path leads to the value

    This is usually `TraceObjectValPath.append(TraceObjectValue)` or `TraceObjectValPath.prepend(TraceObjectValue)`.

    Parameters:
      `pre` - the path from seed to the but excluding the current value
      `value` - the path from seed to the and including the current value
    Returns:
      the path from seed to and including the current value

  - ### visitValue

    TreeTraversal.VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path)
    Visit a value

    Note that the path is the composed path, so it will likely have the current value at its beginning or end.

    Parameters:
      `value` - the current value
      `path` - the path from seed to value
    Returns:
      directions for how traversal should proceed

  - ### continueObject

    TraceObject continueObject(TraceObjectValue value)
    When descending in a value, the object to consider next

    This is usually `TraceObjectValue.getChild()` or `TraceObjectValue.getParent()`.

    Parameters:
      `value` - the current value
    Returns:
      the next object

  - ### continueValues

    Stream<? extends TraceObjectValue> continueValues(TraceObject object, Lifespan span, TraceObjectValPath path)
    When descending in an object, the values to consider next
    Parameters:
      `object` - the current object
      `span` - the composed span of values from seed to the current object
      `path` - the path from seed to the current object
    Returns:
      the next values