Class PathMatcher
- All Implemented Interfaces:
PathFilter
-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.trace.model.target.path.PathFilter
PathFilter.Align -
Field Summary
FieldsFields inherited from interface ghidra.trace.model.target.path.PathFilter
NONE -
Method Summary
Modifier and TypeMethodDescriptionbooleanancestorCouldMatchRight(KeyPath path, boolean strict) Check if the given path could have a matching ancestor, right to leftbooleanancestorMatches(KeyPath path, boolean strict) Check if the given path has an ancestor that matchesstatic PathMatcherany(PathFilter... filters) static PathMatcherany(Collection<PathFilter> filters) static PathMatcherany(Stream<PathPattern> patterns) protected booleananyPattern(Predicate<PathPattern> pred) TODO: We could probably do a lot better, esp.applyKeys(PathFilter.Align align, List<String> indices) Substitute wildcards from left to right for the given list of keysprotected voidcoalesceWilds(Set<String> result) booleangetNextIndices(KeyPath path) Assuming a successor of path could match, get the patterns for the next possible indexgetNextKeys(KeyPath path) Get the patterns for the next possible keygetNextNames(KeyPath path) Get the patterns for the next possible nameGet the patterns of this predicategetPrevKeys(KeyPath path) Get the patterns for the previous possible key (right-to-left matching)If this predicate is known to match only one path, i.e., no wildcards, get that pathIf this predicate consists of a single pattern, get that patternbooleanisNone()Test if any patterns are contained herebooleanCheck if the entire path passesor(PathFilter that) removeRight(int count) Remove count elements from the rightbooleansuccessorCouldMatch(KeyPath path, boolean strict) Check if the given path could have a matching successortoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.trace.model.target.path.PathFilter
applyIntKeys, applyIntKeys, applyIntKeys, applyKeys, applyKeys
-
Field Details
-
WILD_SINGLETON
-
patterns
-
-
Method Details
-
any
-
any
-
any
-
toString
-
equals
-
or
- Specified by:
orin interfacePathFilter
-
anyPattern
TODO: We could probably do a lot better, esp. for many patterns, by using a trie. -
matches
Description copied from interface:PathFilterCheck if the entire path passes- Specified by:
matchesin interfacePathFilter- Parameters:
path- the path to check- Returns:
- true if it matches, false otherwise
-
successorCouldMatch
Description copied from interface:PathFilterCheck if the given path could have a matching successorThis essentially checks if the given path is a viable prefix to the matcher.
- Specified by:
successorCouldMatchin interfacePathFilter- Parameters:
path- the path (prefix) to checkstrict- true to exclude the case wherePathFilter.matches(KeyPath)would return true- Returns:
- true if a successor could match, false otherwise
-
ancestorMatches
Description copied from interface:PathFilterCheck if the given path has an ancestor that matches- Specified by:
ancestorMatchesin interfacePathFilter- Parameters:
path- the path to checkstrict- true to exclude the case wherePathFilter.matches(KeyPath)would return true- Returns:
- true if an ancestor matches, false otherwise
-
ancestorCouldMatchRight
Description copied from interface:PathFilterCheck if the given path could have a matching ancestor, right to leftThis essentially checks if the given path is a viable postfix to the matcher.
- Specified by:
ancestorCouldMatchRightin interfacePathFilter- Parameters:
path- the path (postfix) to checkstrict- true to exclude the case wherePathFilter.matches(KeyPath)would return true- Returns:
- true if an ancestor could match, false otherwise
-
getSingletonPath
Description copied from interface:PathFilterIf this predicate is known to match only one path, i.e., no wildcards, get that path- Specified by:
getSingletonPathin interfacePathFilter- Returns:
- the singleton path, or
null
-
getSingletonPattern
Description copied from interface:PathFilterIf this predicate consists of a single pattern, get that pattern- Specified by:
getSingletonPatternin interfacePathFilter- Returns:
- the singleton pattern, or
null
-
getPatterns
Description copied from interface:PathFilterGet the patterns of this predicate- Specified by:
getPatternsin interfacePathFilter- Returns:
- the patterns
-
coalesceWilds
-
getNextKeys
Description copied from interface:PathFilterGet the patterns for the next possible keyIf a successor of the given path cannot match this pattern, the empty set is returned.
- Specified by:
getNextKeysin interfacePathFilter- Parameters:
path- the ancestor path- Returns:
- a set of patterns where indices are enclosed in brackets
[]
-
getNextNames
Description copied from interface:PathFilterGet the patterns for the next possible nameIf 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
- Specified by:
getNextNamesin interfacePathFilter- Parameters:
path- the ancestor path- Returns:
- a set of patterns
-
getNextIndices
Description copied from interface:PathFilterAssuming a successor of path could match, get the patterns for the next possible indexIf 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
- Specified by:
getNextIndicesin interfacePathFilter- Parameters:
path- the ancestor path- Returns:
- a set of patterns, without brackets
[]
-
getPrevKeys
Description copied from interface:PathFilterGet 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.
- Specified by:
getPrevKeysin interfacePathFilter- Parameters:
path- the successor path- Returns:
- a set of patterns where indices are enclosed in brackets
[]
-
isNone
public boolean isNone()Description copied from interface:PathFilterTest if any patterns are contained hereNote 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.
- Specified by:
isNonein interfacePathFilter- Returns:
- true if equivalent to
PathFilter.NONE
-
applyKeys
Description copied from interface:PathFilterSubstitute wildcards from left to right for the given list of keysTakes 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.
- Specified by:
applyKeysin interfacePathFilter- Parameters:
align- the end to alignindices- the keys to substitute- Returns:
- the pattern or matcher with the applied substitutions
-
removeRight
Description copied from interface:PathFilterRemove count elements from the right- Specified by:
removeRightin interfacePathFilter- Parameters:
count- the number of elements to remove- Returns:
- the resulting filter
-