Package org.parboiled.support
Class MatcherPath
- java.lang.Object
-
- org.parboiled.support.MatcherPath
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MatcherPath.Element
-
Field Summary
Fields Modifier and Type Field Description MatcherPath.Element
element
MatcherPath
parent
-
Constructor Summary
Constructors Constructor Description MatcherPath(MatcherPath.Element element, MatcherPath parent)
Constructs a new MatcherPath wrapping the given elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
String
toString()
String
toString(MatcherPath skipPrefix)
-
-
-
Field Detail
-
element
public final MatcherPath.Element element
-
parent
public final MatcherPath parent
-
-
Constructor Detail
-
MatcherPath
public MatcherPath(MatcherPath.Element element, MatcherPath parent)
Constructs a new MatcherPath wrapping the given elements. Normally you don't construct a MatcherPath directly but rather callContext.getPath()
to get one.- Parameters:
element
- the last element of this pathparent
- the parent path
-
-
Method Detail
-
length
public int length()
- Returns:
- the length of this path, i.e. the number of matchers contained in it
-
isPrefixOf
public boolean isPrefixOf(MatcherPath that)
Determines whether this path is a prefix of the given other path.- Parameters:
that
- the other path- Returns:
- true if this path is a prefix of the given other path
-
getElementAtLevel
public MatcherPath.Element getElementAtLevel(int level)
Returns the Element at the given level.- Parameters:
level
- the level to get the element from- Returns:
- the element
-
commonPrefix
public MatcherPath commonPrefix(MatcherPath that)
Returns the common prefix of this MatcherPath and the given other one.- Parameters:
that
- the other path- Returns:
- the common prefix or null
-
contains
public boolean contains(Matcher matcher)
Determines whether the given matcher is contained in this path.- Parameters:
matcher
- the matcher- Returns:
- true if contained
-
toString
public String toString(MatcherPath skipPrefix)
-
-