Package ghidra.trace.model.target.path

# Interface PathFilter

All Known Implementing Classes:
  `PathMatcher`, `PathPattern`

public interface PathFilter

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `PathFilter.Align`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final PathFilter`
  `NONE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `ancestorCouldMatchRight(KeyPath path, boolean strict)`
  Check if the given path could have a matching ancestor, right to left
  `boolean`
  `ancestorMatches(KeyPath path, boolean strict)`
  Check if the given path has an ancestor that matches
  `static boolean`
  `anyMatches(Set<String> pats, String key)`
  `default PathFilter`
  `applyIntKeys(int... keys)`
  `default PathFilter`
  `applyIntKeys(int radix, PathFilter.Align align, int... keys)`
  `default PathFilter`
  `applyIntKeys(int radix, PathFilter.Align align, List<Integer> keys)`
  `default PathFilter`
  `applyKeys(PathFilter.Align align, String... keys)`
  `PathFilter`
  `applyKeys(PathFilter.Align align, List<String> keys)`
  Substitute wildcards from left to right for the given list of keys
  `default PathFilter`
  `applyKeys(String... keys)`
  `Set<String>`
  `getNextIndices(KeyPath path)`
  Assuming a successor of path could match, get the patterns for the next possible index
  `Set<String>`
  `getNextKeys(KeyPath path)`
  Get the patterns for the next possible key
  `Set<String>`
  `getNextNames(KeyPath path)`
  Get the patterns for the next possible name
  `Set<PathPattern>`
  `getPatterns()`
  Get the patterns of this predicate
  `Set<String>`
  `getPrevKeys(KeyPath path)`
  Get the patterns for the previous possible key (right-to-left matching)
  `KeyPath`
  `getSingletonPath()`
  If this predicate is known to match only one path, i.e., no wildcards, get that path
  `PathPattern`
  `getSingletonPattern()`
  If this predicate consists of a single pattern, get that pattern
  `boolean`
  `isNone()`
  Test if any patterns are contained here
  `static boolean`
  `keyMatches(String pat, String key)`
  `boolean`
  `matches(KeyPath path)`
  Check if the entire path passes
  `PathFilter`
  `or(PathFilter that)`
  `static PathPattern`
  `parse(String pattern)`
  `static PathFilter`
  `pattern(KeyPath keyPatterns)`
  `static PathFilter`
  `pattern(String... keyPatterns)`
  `PathFilter`
  `removeRight(int count)`
  Remove count elements from the right
  `boolean`
  `successorCouldMatch(KeyPath path, boolean strict)`
  Check if the given path could have a matching successor

- ## Field Details

  - ### NONE

    static final PathFilter NONE

- ## Method Details

  - ### keyMatches

    static boolean keyMatches(String pat, String key)

  - ### anyMatches

    static boolean anyMatches(Set<String> pats, String key)

  - ### pattern

    static PathFilter pattern(String... keyPatterns)

  - ### pattern

    static PathFilter pattern(KeyPath keyPatterns)

  - ### parse

    static PathPattern parse(String pattern)

  - ### or

    PathFilter or(PathFilter that)

  - ### matches

    boolean matches(KeyPath path)
    Check if the entire path passes
    Parameters:
      `path` - the path to check
    Returns:
      true if it matches, false otherwise

  - ### successorCouldMatch

    boolean successorCouldMatch(KeyPath path, boolean strict)
    Check if the given path could have a matching successor

    This essentially checks if the given path is a viable prefix to the matcher.

    Parameters:
      `path` - the path (prefix) to check
      `strict` - true to exclude the case where `matches(KeyPath)` would return true
    Returns:
      true if a successor could match, false otherwise
    Implementation Notes:
      this method could become impractical for culling queries if we allow too sophisticated of patterns. Notably, to allow an "any number of keys" pattern, e.g., akin to `/src/**{@literal /}*.c` in file system path matchers. Anything starting with "src" could have a successor that matches.

  - ### ancestorMatches

    boolean ancestorMatches(KeyPath path, boolean strict)
    Check if the given path has an ancestor that matches
    Parameters:
      `path` - the path to check
      `strict` - true to exclude the case where `matches(KeyPath)` would return true
    Returns:
      true if an ancestor matches, false otherwise

  - ### ancestorCouldMatchRight

    boolean ancestorCouldMatchRight(KeyPath path, boolean strict)
    Check if the given path could have a matching ancestor, right to left

    This essentially checks if the given path is a viable postfix to the matcher.

    Parameters:
      `path` - the path (postfix) to check
      `strict` - true to exclude the case where `matches(KeyPath)` would return true
    Returns:
      true if an ancestor could match, false otherwise

  - ### getNextKeys

    Set<String> getNextKeys(KeyPath path)
    Get the patterns for the next possible key

    If a successor of the given path cannot match this pattern, the empty set is returned.

    Parameters:
      `path` - the ancestor path
    Returns:
      a set of patterns where indices are enclosed in brackets `[]`

  - ### getNextNames

    Set<String> getNextNames(KeyPath path)
    Get the patterns for the next possible name

    If a successor of the given path cannot match this pattern, the empty set is returned. If the pattern could accept a name next, get all patterns describing those names

    Parameters:
      `path` - the ancestor path
    Returns:
      a set of patterns

  - ### getNextIndices

    Set<String> getNextIndices(KeyPath path)
    Assuming a successor of path could match, get the patterns for the next possible index

    If a successor of the given path cannot match this pattern, the empty set is returned. If the pattern could accept an index next, get all patterns describing those indices

    Parameters:
      `path` - the ancestor path
    Returns:
      a set of patterns, without brackets `[]`

  - ### getPrevKeys

    Set<String> getPrevKeys(KeyPath path)
    Get the patterns for the previous possible key (right-to-left matching)

    If an ancestor of the given path cannot match this pattern, the empty set is returned.

    Parameters:
      `path` - the successor path
    Returns:
      a set of patterns where indices are enclosed in brackets `[]`

  - ### getSingletonPath

    KeyPath getSingletonPath()
    If this predicate is known to match only one path, i.e., no wildcards, get that path
    Returns:
      the singleton path, or `null`

  - ### getSingletonPattern

    PathPattern getSingletonPattern()
    If this predicate consists of a single pattern, get that pattern
    Returns:
      the singleton pattern, or `null`

  - ### getPatterns

    Set<PathPattern> getPatterns()
    Get the patterns of this predicate
    Returns:
      the patterns

  - ### removeRight

    PathFilter removeRight(int count)
    Remove count elements from the right
    Parameters:
      `count` - the number of elements to remove
    Returns:
      the resulting filter

  - ### applyKeys

    PathFilter applyKeys(PathFilter.Align align, List<String> keys)
    Substitute wildcards from left to right for the given list of keys

    Takes each pattern and substitutes its wildcards for the given indices, according to the given alignment. This object is unmodified, and the result is returned.

    If there are fewer wildcards in a pattern than given, only the first keys are taken. If there are fewer keys than wildcards in a pattern, then the remaining wildcards are left in the resulting pattern. In this manner, the left-most wildcards are substituted for the left-most indices, or the right-most wildcards are substituted for the right-most indices, depending on the alignment.

    Parameters:
      `align` - the end to align
      `keys` - the keys to substitute
    Returns:
      the pattern or matcher with the applied substitutions

  - ### applyKeys

    default PathFilter applyKeys(PathFilter.Align align, String... keys)

  - ### applyKeys

    default PathFilter applyKeys(String... keys)

  - ### applyIntKeys

    default PathFilter applyIntKeys(int radix, PathFilter.Align align, List<Integer> keys)

  - ### applyIntKeys

    default PathFilter applyIntKeys(int radix, PathFilter.Align align, int... keys)

  - ### applyIntKeys

    default PathFilter applyIntKeys(int... keys)

  - ### isNone

    boolean isNone()
    Test if any patterns are contained here

    Note that the presence of a pattern does not guarantee the presence of a matching object. However, the absence of any pattern does guarantee no object can match.

    Returns:
      true if equivalent to `NONE`