public final class ParseSelection extends Object
Class used for reporting the current selectors matching the different levels of selection specified at
the handler chain by means of instances of BlockSelectorMarkupHandler
and
NodeSelectorMarkupHandler
instances.
Each selection level represents a selection handler (block or node), in the order that they have been setup for execution in the handler chain.
The toString()
method of this class provides a visual representation of all the selection levels
currently being used, as well as the selectors that are matching at each level.
Constructor and Description |
---|
ParseSelection()
Create a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getCurrentSelection(int level)
Returns the matching selectors for a specific selection level, or null if no selector is currently matching
at that level.
|
int |
getSelectionLevels()
Get the amount of levels that have been registered at the handler chain.
|
String[] |
getSelectors(int level)
Returns all the selectors (not only the matching ones) active for a specific selection level, ie
for a specific instance of
BlockSelectorMarkupHandler or
NodeSelectorMarkupHandler at the handler chain. |
boolean |
isMatchingAny()
Returns whether any selectors are currently matching, at any level.
|
boolean |
isMatchingAny(int level)
Returns whether any selectors are currently matching at the specified selection level.
|
String |
toString() |
public ParseSelection()
Create a new instance of this class. Instances of this class are normally created by the parser
implementation objects (e.g. MarkupParser
), so there is no need to ever call this
constructor from the user's code.
public int getSelectionLevels()
Get the amount of levels that have been registered at the handler chain. This will be the amount of
BlockSelectorMarkupHandler
and
NodeSelectorMarkupHandler
handler instances registered at the current
handler chain being executed by the parser.
public String[] getSelectors(int level)
Returns all the selectors (not only the matching ones) active for a specific selection level, ie
for a specific instance of BlockSelectorMarkupHandler
or
NodeSelectorMarkupHandler
at the handler chain.
level
- the selection level.public String[] getCurrentSelection(int level)
Returns the matching selectors for a specific selection level, or null if no selector is currently matching at that level.
This method should only be called from event handlers or other code called from these, given the information about matching selectors will only be updated before (and after) calling the events relevant for that selection.
level
- the selection level.public boolean isMatchingAny(int level)
Returns whether any selectors are currently matching at the specified selection level.
level
- the selection level.public boolean isMatchingAny()
Returns whether any selectors are currently matching, at any level.
Copyright © 2023 The ATTOPARSER team. All rights reserved.