Package org.jsoup.select
Class Evaluator
java.lang.Object
org.jsoup.select.Evaluator
- Direct Known Subclasses:
-
CombiningEvaluator
,Evaluator.AllElements
,Evaluator.Attribute
,Evaluator.AttributeKeyPair
,Evaluator.AttributeStarting
,Evaluator.AttributeWithValueMatching
,Evaluator.Class
,Evaluator.ContainsData
,Evaluator.ContainsOwnText
,Evaluator.ContainsText
,Evaluator.ContainsWholeOwnText
,Evaluator.ContainsWholeText
,Evaluator.CssNthEvaluator
,Evaluator.Id
,Evaluator.IndexEvaluator
,Evaluator.IsEmpty
,Evaluator.IsFirstChild
,Evaluator.IsLastChild
,Evaluator.IsOnlyChild
,Evaluator.IsOnlyOfType
,Evaluator.IsRoot
,Evaluator.Matches
,Evaluator.MatchesOwn
,Evaluator.MatchesWholeOwnText
,Evaluator.MatchesWholeText
,Evaluator.MatchText
,Evaluator.Tag
,Evaluator.TagEndsWith
,Evaluator.TagStartsWith
public abstract class Evaluator extends Object
Evaluates that an element matches the selector.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Evaluator for any / all element matchingstatic final class
Evaluator for attribute name matchingstatic class
Abstract evaluator for attribute name/value matchingstatic final class
Evaluator for attribute name prefix matchingstatic final class
Evaluator for attribute name/value matchingstatic final class
Evaluator for attribute name/value matching (value containing)static final class
Evaluator for attribute name/value matching (value ending)static final class
Evaluator for attribute name/value matching (value regex matching)static final class
Evaluator for attribute name !static final class
Evaluator for attribute name/value matching (value prefix)static final class
Evaluator for element classstatic final class
Evaluator for matching Element (and its descendants) datastatic final class
Evaluator for matching Element's own textstatic final class
Evaluator for matching Element (and its descendants) textstatic final class
Evaluator for matching Element (but not its descendants) wholeText.static final class
Evaluator for matching Element (and its descendants) wholeText.static class
static final class
Evaluator for element idstatic final class
Evaluator for matching by sibling index number (e = idx)static class
Abstract evaluator for sibling index matchingstatic final class
Evaluator for matching by sibling index number (e > idx)static final class
Evaluator for matching by sibling index number (e < idx)static final class
static final class
Evaluator for matching the first sibling (css :first-child)static final class
static final class
Evaluator for matching the last sibling (css :last-child)static final class
static final class
css-compatible Evaluator for :eq (css :nth-child)static final class
css pseudo class :nth-last-child)static class
static class
css pseudo class nth-of-typestatic final class
static final class
static final class
css3 pseudo-class :rootstatic final class
Evaluator for matching Element (and its descendants) text with regexstatic final class
Evaluator for matching Element's own text with regexstatic final class
Evaluator for matching Element's own whole text with regex.static final class
Evaluator for matching Element (and its descendants) whole text with regex.static final class
static final class
Evaluator for tag namestatic final class
Evaluator for tag name that ends with suffix; used for *|elstatic final class
Evaluator for tag name that starts with prefix; used for ns|* -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionPredicate
<Element> asPredicate
(Element root) Provides a Predicate for this Evaluator, matching the test Element.protected int
cost()
A relative evaluator cost function.abstract boolean
Test if the element meets the evaluator's requirements.protected void
reset()
Reset any internal state in this Evaluator before executing a new Collector evaluation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Method Details
-
asPredicate
Provides a Predicate for this Evaluator, matching the test Element.- Parameters:
-
root
- the root Element, for match evaluation - Returns:
- a predicate that accepts an Element to test for matches with this Evaluator
- Since:
- 1.17.1
-
matches
Test if the element meets the evaluator's requirements.- Parameters:
-
root
- Root of the matching subtree -
element
- tested element - Returns:
- Returns true if the requirements are met or false otherwise
-
reset
protected void reset()Reset any internal state in this Evaluator before executing a new Collector evaluation. -
cost
protected int cost()A relative evaluator cost function. During evaluation, Evaluators are sorted by ascending cost as an optimization.- Returns:
- the relative cost of this Evaluator
-