Package ghidra.trace.model

# Interface TraceTimeViewport

All Known Implementing Classes:
  `DBTraceTimeViewport`

public interface TraceTimeViewport
A convenience for tracking the time structure of a trace and querying the trace accordingly.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `TraceTimeViewport.Occlusion<T>`
  `static interface`
  `TraceTimeViewport.QueryOcclusion<T>`
  `static interface`
  `TraceTimeViewport.RangeQueryOcclusion<T>`
  `static interface`
  `TraceTimeViewport.SetQueryOcclusion<T>`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addChangeListener(Runnable l)`
  Add a listener for when the forking structure of this viewport changes
  `<T> AddressSet`
  `computeVisibleParts(AddressSetView set, Lifespan lifespan, T object, TraceTimeViewport.Occlusion<T> occlusion)`
  Compute the parts of a given object that are visible past more-recent objects
  `boolean`
  `containsAnyUpper(Lifespan lifespan)`
  Check if the given lifespan contains any upper snap among the involved spans
  `List<Long>`
  `getOrderedSnaps()`
  Get the snaps involved in the view in most-recent-first order
  `List<Lifespan>`
  `getOrderedSpans()`
  Get the spans involved in the view in most-recent-first order
  `List<Long>`
  `getReversedSnaps()`
  Get the snaps involved in the view in least-recent-first order
  `List<Lifespan>`
  `getReversedSpans()`
  Get the spans involved in the view in least-recent-first order
  `<T> T`
  `getTop(Function<Long,T> func)`
  Get the first non-null result of the function, applied to the most-recent snaps first
  `<T> boolean`
  `isCompletelyVisible(AddressRange range, Lifespan lifespan, T object, TraceTimeViewport.Occlusion<T> occlusion)`
  Check if any part of the given object is occluded by more-recent objects
  `boolean`
  `isForked()`
  Check if this view is forked
  `<T> Iterator<T>`
  `mergedIterator(Function<Long,Iterator<T>> iterFunc, Comparator<? super T> comparator)`
  Merge iterators from each involved snap into a single iterator
  `void`
  `removeChangeListener(Runnable l)`
  Remove a listener for forking structure changes
  `void`
  `setSnap(long snap)`
  Set the snapshot for this viewport
  `AddressSetView`
  `unionedAddresses(Function<Long,AddressSetView> setFunc)`
  Union address sets from each involved snap

- ## Method Details

  - ### setSnap

    void setSnap(long snap)
    Set the snapshot for this viewport
    Parameters:
      `snap` - the snap

  - ### addChangeListener

    void addChangeListener(Runnable l)
    Add a listener for when the forking structure of this viewport changes

    This can occur when the snap changes or when any snapshot involved changes

    Parameters:
      `l` - the listener

  - ### removeChangeListener

    void removeChangeListener(Runnable l)
    Remove a listener for forking structure changes
    Parameters:
      `l` - the listener
    See Also:
      - `addChangeListener(Runnable)`

  - ### isForked

    boolean isForked()
    Check if this view is forked

    The view is considered forked if any snap previous to this has a schedule with an initial snap other than the immediately-preceding one. Such forks "break" the linearity of the trace's usual time line.

    Returns:
      true if forked, false otherwise

  - ### containsAnyUpper

    boolean containsAnyUpper(Lifespan lifespan)
    Check if the given lifespan contains any upper snap among the involved spans
    Parameters:
      `lifespan` - the lifespan to consider
    Returns:
      true if it contains any upper snap, false otherwise.

  - ### isCompletelyVisible

    <T> boolean isCompletelyVisible(AddressRange range, Lifespan lifespan, T object, TraceTimeViewport.Occlusion<T> occlusion)
    Check if any part of the given object is occluded by more-recent objects
    Type Parameters:
      `T` - the type of the object
    Parameters:
      `range` - the address range of the object
      `lifespan` - the lifespan of the object
      `object` - optionally, the object to examine. Used to avoid "self occlusion"
      `occlusion` - a mechanism for querying other like objects and checking for occlusion
    Returns:
      true if completely visible, false if even partially occluded

  - ### computeVisibleParts

    <T> AddressSet computeVisibleParts(AddressSetView set, Lifespan lifespan, T object, TraceTimeViewport.Occlusion<T> occlusion)
    Compute the parts of a given object that are visible past more-recent objects
    Type Parameters:
      `T` - the type of the object
    Parameters:
      `set` - the addresses comprising the object
      `lifespan` - the lifespan of the object
      `object` - the object to examine
      `occlusion` - a mechanism for query other like objects and removing occluded parts
    Returns:
      the set of visible addresses

  - ### getOrderedSpans

    List<Lifespan> getOrderedSpans()
    Get the spans involved in the view in most-recent-first order
    Returns:
      the list of spans

  - ### getReversedSpans

    List<Lifespan> getReversedSpans()
    Get the spans involved in the view in least-recent-first order
    Returns:
      the list of spans

  - ### getOrderedSnaps

    List<Long> getOrderedSnaps()
    Get the snaps involved in the view in most-recent-first order

    The first is always this view's snap. Following are the source snaps of each previous snapshot's schedule where applicable.

    Returns:
      the list of snaps

  - ### getReversedSnaps

    List<Long> getReversedSnaps()
    Get the snaps involved in the view in least-recent-first order
    Returns:
      the list of snaps

  - ### getTop

    <T> T getTop(Function<Long,T> func)
    Get the first non-null result of the function, applied to the most-recent snaps first

    Typically, func both retrieves an object and tests for its suitability.

    Type Parameters:
      `T` - the type of object to retrieve
    Parameters:
      `func` - the function on a snap to retrieve an object
    Returns:
      the first non-null result

  - ### mergedIterator

    <T> Iterator<T> mergedIterator(Function<Long,Iterator<T>> iterFunc, Comparator<? super T> comparator)
    Merge iterators from each involved snap into a single iterator

    Typically, the resulting iterator is passed through a filter to test each objects suitability.

    Type Parameters:
      `T` - the type of objects in each iterator
    Parameters:
      `iterFunc` - a function on a snap to retrieve each iterator
      `comparator` - the comparator for merging, which must yield the same order as each iterator
    Returns:
      the merged iterator

  - ### unionedAddresses

    AddressSetView unionedAddresses(Function<Long,AddressSetView> setFunc)
    Union address sets from each involved snap

    The returned union is computed lazily.

    Parameters:
      `setFunc` - a function on a snap to retrieve the address set
    Returns:
      the union