Interface PathFilter
- All Known Implementing Classes:
PathMatcher,PathPattern
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
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 booleananyMatches(Set<String> pats, String key) default PathFilterapplyIntKeys(int... keys) default PathFilterapplyIntKeys(int radix, PathFilter.Align align, int... keys) default PathFilterapplyIntKeys(int radix, PathFilter.Align align, List<Integer> keys) default PathFilterapplyKeys(PathFilter.Align align, String... keys) applyKeys(PathFilter.Align align, List<String> keys) Substitute wildcards from left to right for the given list of keysdefault PathFiltergetNextIndices(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 herestatic booleankeyMatches(String pat, String key) booleanCheck if the entire path passesor(PathFilter that) static PathPatternstatic PathFilterstatic PathFilterremoveRight(int count) Remove count elements from the rightbooleansuccessorCouldMatch(KeyPath path, boolean strict) Check if the given path could have a matching successor
-
Field Details
-
NONE
-
-
Method Details
-
keyMatches
-
anyMatches
-
pattern
-
pattern
-
parse
-
or
-
matches
Check if the entire path passes- Parameters:
path- the path to check- Returns:
- true if it matches, false otherwise
-
successorCouldMatch
Check if the given path could have a matching successorThis essentially checks if the given path is a viable prefix to the matcher.
- Parameters:
path- the path (prefix) to checkstrict- true to exclude the case wherematches(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 /}*.cin file system path matchers. Anything starting with "src" could have a successor that matches.
-
ancestorMatches
Check if the given path has an ancestor that matches- Parameters:
path- the path to checkstrict- true to exclude the case wherematches(KeyPath)would return true- Returns:
- true if an ancestor matches, false otherwise
-
ancestorCouldMatchRight
Check 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.
- Parameters:
path- the path (postfix) to checkstrict- true to exclude the case wherematches(KeyPath)would return true- Returns:
- true if an ancestor could match, false otherwise
-
getNextKeys
Get the patterns for the next possible keyIf 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
Get 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
- Parameters:
path- the ancestor path- Returns:
- a set of patterns
-
getNextIndices
Assuming 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
- Parameters:
path- the ancestor path- Returns:
- a set of patterns, without brackets
[]
-
getPrevKeys
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
Remove count elements from the right- Parameters:
count- the number of elements to remove- Returns:
- the resulting filter
-
applyKeys
Substitute 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.
- Parameters:
align- the end to alignkeys- the keys to substitute- Returns:
- the pattern or matcher with the applied substitutions
-
applyKeys
-
applyKeys
-
applyIntKeys
-
applyIntKeys
-
applyIntKeys
-
isNone
boolean isNone()Test 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.
- Returns:
- true if equivalent to
NONE
-