Package cdc.util.data.util
Interface TextPredicate
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface TextPredicate
Interface used to filter text nodes.- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description static TextPredicateANY_TEXTstatic TextPredicateIGNORABLE_TEXTstatic TextPredicateNON_IGNORABLE_TEXT
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanaccepts(Parent parent, Text text)Returnstruewhen a text must be kept.default TextPredicateand(TextPredicate other)Returns a predicate that is the logicalandcombination of this one and another one.static TextPredicatefromElementNames(Collection<String> names)Returns an TextPredicate that returns true when the text id defined in an element whose name belongs to a collection.static TextPredicatefromElementPaths(Collection<SPath> paths)default TextPredicatenot()default TextPredicateor(TextPredicate other)Returns a predicate that is the logicalorcombination of this one and another one.
-
-
-
Field Detail
-
ANY_TEXT
static final TextPredicate ANY_TEXT
-
IGNORABLE_TEXT
static final TextPredicate IGNORABLE_TEXT
-
NON_IGNORABLE_TEXT
static final TextPredicate NON_IGNORABLE_TEXT
-
-
Method Detail
-
accepts
boolean accepts(Parent parent, Text text)
Returnstruewhen a text must be kept.Text (and its parents) must have been created before this can be called.
- Parameters:
parent- The text parent.text- The text node.- Returns:
trueiftextmust be kept,falseotherwise.
-
not
default TextPredicate not()
- Returns:
- The negation of this predicate.
-
and
default TextPredicate and(TextPredicate other)
Returns a predicate that is the logicalandcombination of this one and another one.- Parameters:
other- The other predicate.- Returns:
- A predicate that is the logical
andcombination of this one andother. - Throws:
IllegalArgumentException- Whenotherisnull.
-
or
default TextPredicate or(TextPredicate other)
Returns a predicate that is the logicalorcombination of this one and another one.- Parameters:
other- The other predicate.- Returns:
- A predicate that is the logical
orcombination of this one andother. - Throws:
IllegalArgumentException- Whenotherisnull.
-
fromElementNames
static TextPredicate fromElementNames(Collection<String> names)
Returns an TextPredicate that returns true when the text id defined in an element whose name belongs to a collection.It is advised to use an efficient collection, typically a Set.
- Parameters:
names- The collections of names. MUST NOT be null.- Returns:
- A new instance of TextPredicate that returns
truewhen the text is in an element whose name belong tonames. - Throws:
IllegalArgumentException- Whennamesisnull.
-
fromElementPaths
static TextPredicate fromElementPaths(Collection<SPath> paths)
-
-