public class MatcherPath
extends java.lang.Object
Matcher
stack at a certain point during the parsing process.
Implemented as a specialized, immutable single-linked list of Element objects with the deepest stack Element
in the first position and the root at the end.Modifier and Type | Class and Description |
---|---|
static class |
MatcherPath.Element |
Modifier and Type | Field and Description |
---|---|
MatcherPath.Element |
element |
MatcherPath |
parent |
Constructor and Description |
---|
MatcherPath(MatcherPath.Element element,
MatcherPath parent)
Constructs a new MatcherPath wrapping the given elements.
|
Modifier and Type | Method and Description |
---|---|
MatcherPath |
commonPrefix(MatcherPath that)
Returns the common prefix of this MatcherPath and the given other one.
|
boolean |
contains(Matcher matcher)
Determines whether the given matcher is contained in this path.
|
MatcherPath.Element |
getElementAtLevel(int level)
Returns the Element at the given level.
|
boolean |
isPrefixOf(MatcherPath that)
Determines whether this path is a prefix of the given other path.
|
int |
length() |
private java.lang.StringBuilder |
print(java.lang.StringBuilder sb,
MatcherPath skipPrefix) |
java.lang.String |
toString() |
java.lang.String |
toString(MatcherPath skipPrefix) |
public final MatcherPath.Element element
public final MatcherPath parent
public MatcherPath(MatcherPath.Element element, MatcherPath parent)
Context.getPath()
to
get one.element
- the last element of this pathparent
- the parent pathpublic int length()
public boolean isPrefixOf(MatcherPath that)
that
- the other pathpublic MatcherPath.Element getElementAtLevel(int level)
level
- the level to get the element frompublic MatcherPath commonPrefix(MatcherPath that)
that
- the other pathpublic boolean contains(Matcher matcher)
matcher
- the matcherpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(MatcherPath skipPrefix)
private java.lang.StringBuilder print(java.lang.StringBuilder sb, MatcherPath skipPrefix)