Interface ParseFilter
-
- All Implemented Interfaces:
-
ai.platon.pulsar.common.config.Parameterized,java.lang.AutoCloseable
public interface ParseFilter implements Parameterized, AutoCloseable
Extension point for DOM-based parsers. A parse filter can have children, so all parse filters form a tree. All parse filters at the same level are run sequentially.
-
-
Method Summary
Modifier and Type Method Description abstract UnitaddFirst(ParseFilter child)Add the filter to the head of the child filter list. abstract UnitaddLast(ParseFilter child)Add the filter to the tail of the child filter list. abstract Unitinitialize()Initialize the filter. abstract CheckStateisRelevant(ParseContext parseContext)Check if this parse filter is relevant to this page. abstract UnitonBeforeFilter(ParseContext parseContext)Invoke before the filtering. abstract FilterResultfilter(ParseContext parseContext)Do the filtering. abstract UnitonAfterFilter(ParseContext parseContext)Invoke after the filtering. Unitclose()Close the filter. abstract IntegergetId()abstract ParseFiltergetParent()The parent filter abstract UnitsetParent(ParseFilter parent)The parent filter abstract List<ParseFilter>getChildren()The child filters IntegergetParentId()BooleanisRoot()BooleanisLeaf()-
-
Method Detail
-
addFirst
abstract Unit addFirst(ParseFilter child)
Add the filter to the head of the child filter list.
-
addLast
abstract Unit addLast(ParseFilter child)
Add the filter to the tail of the child filter list.
-
initialize
abstract Unit initialize()
Initialize the filter.
-
isRelevant
abstract CheckState isRelevant(ParseContext parseContext)
Check if this parse filter is relevant to this page. Sometimes we may want to write a separate ParseFilter for a category.
-
onBeforeFilter
abstract Unit onBeforeFilter(ParseContext parseContext)
Invoke before the filtering.
-
filter
abstract FilterResult filter(ParseContext parseContext)
Do the filtering.
-
onAfterFilter
abstract Unit onAfterFilter(ParseContext parseContext)
Invoke after the filtering.
-
getParent
abstract ParseFilter getParent()
The parent filter
-
setParent
abstract Unit setParent(ParseFilter parent)
The parent filter
-
getChildren
abstract List<ParseFilter> getChildren()
The child filters
-
getParentId
Integer getParentId()
-
-
-
-