public final class DataUtil
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static cdc.util.function.Evaluator<Node> |
RECURSE |
| Modifier and Type | Method | Description |
|---|---|---|
static boolean |
hasAllDescendantsMatching(Node node,
java.util.function.Predicate<Node> predicate,
boolean strict) |
|
static boolean |
hasAncestorMatching(Node node,
java.util.function.Predicate<Node> predicate) |
|
static boolean |
hasDescendantMatching(Node node,
java.util.function.Predicate<Node> predicate,
boolean strict) |
|
static void |
moveAttributeFirst(Parent parent,
java.util.function.Predicate<? super Element> predicate,
java.lang.String name,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Moves the attribute that has a given name to first position, if it exists.
|
static void |
removeComments(Parent parent,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Removes comments nodes.
|
static void |
removeEmptyAttributes(Parent parent,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Recursively removes empty attributes.
|
static void |
removeIgnorableText(Parent parent,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Removes text that can be ignored.
|
static void |
removeMatchingAttributes(Parent parent,
AttributePredicate predicate,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Removes matching attributes.
|
static void |
removeMatchingChildren(Parent parent,
java.util.function.Predicate<? super Child> predicate,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Removes matching children.
|
static void |
removePureElements(Parent parent,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Removes pure elements (they have no children and no attributes).
|
static void |
setContentOfMatchingElements(Parent parent,
ElementPredicate predicate,
TextContentConverter converter,
cdc.util.function.Evaluator<? super Parent> evaluator) |
|
static void |
setContentOfMatchingTexts(Parent parent,
TextPredicate predicate,
TextContentConverter converter,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sets the content of matching texts.
|
static void |
setNameOfMatchingAttributes(Parent parent,
AttributePredicate predicate,
AttributeNameConverter converter,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sets names of matching attributes.
|
static void |
setNameOfMatchingElements(Parent parent,
java.util.function.Predicate<? super Element> predicate,
ElementNameConverter converter,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sets the name of matching elements.
|
static void |
setValueOfMatchingAttributes(Parent parent,
AttributePredicate predicate,
AttributeValueConverter converter,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sets value of matching attributes.
|
static void |
sortAttributes(Parent parent,
java.util.Comparator<Attribute> comparator,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sorts attributes of elements using a user defined sorter.
|
static void |
sortChildren(Parent parent,
java.util.function.Predicate<? super Parent> predicate,
java.util.Comparator<? super Child> comparator,
cdc.util.function.Evaluator<? super Parent> evaluator) |
Sorts children nodes using a user-defined comparator.
|
public static final cdc.util.function.Evaluator<Node> RECURSE
public static void setNameOfMatchingAttributes(Parent parent, AttributePredicate predicate, AttributeNameConverter converter, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Change is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching attributes. MUST NOT be null.converter - The attribute name converter. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void setValueOfMatchingAttributes(Parent parent, AttributePredicate predicate, AttributeValueConverter converter, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Change is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching attributes. MUST NOT be null.converter - The attribute value converter. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void removeMatchingAttributes(Parent parent, AttributePredicate predicate, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching attributes. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void removeEmptyAttributes(Parent parent, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on parent before its children.
parent - The initial node. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void sortAttributes(Parent parent, java.util.Comparator<Attribute> comparator, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Sort is applied on parent before its children.
parent - The initial node. MUST NOT be null.comparator - The attribute name comparator. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void moveAttributeFirst(Parent parent, java.util.function.Predicate<? super Element> predicate, java.lang.String name, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Move is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching elements. MUST NOT be null.name - The attribute name.evaluator - The evaluator. MUST NOT be null.public static void setNameOfMatchingElements(Parent parent, java.util.function.Predicate<? super Element> predicate, ElementNameConverter converter, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Change is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching elements. MUST NOT be null.converter - The name converter. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void setContentOfMatchingTexts(Parent parent, TextPredicate predicate, TextContentConverter converter, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
parent - The initial node. MUST NOT be null.predicate - The predicate of matching texts. MUST NOT be null.converter - The content converter.evaluator - The evaluator. MUST NOT be null.public static void setContentOfMatchingElements(Parent parent, ElementPredicate predicate, TextContentConverter converter, cdc.util.function.Evaluator<? super Parent> evaluator)
public static void removeMatchingChildren(Parent parent, java.util.function.Predicate<? super Child> predicate, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on children before parent.
parent - The initial node. MUST NOT be null.predicate - The predicate of children nodes to remove. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void removeComments(Parent parent, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on children before parent.
parent - The initial node. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void removeIgnorableText(Parent parent, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on children before parent.
parent - The initial node. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void removePureElements(Parent parent, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Removal is applied on children before parent.
parent - The initial node. MUST NOT be null.evaluator - The evaluator. MUST NOT be null.public static void sortChildren(Parent parent, java.util.function.Predicate<? super Parent> predicate, java.util.Comparator<? super Child> comparator, cdc.util.function.Evaluator<? super Parent> evaluator)
Uses a Depth First traversal for recursion.
Sort is applied on parent before its children.
parent - The initial node. MUST NOT be null.predicate - The predicate of nodes whose children must be sorted. MUST NOT be null.comparator - The children comparator.evaluator - The evaluator. MUST NOT be null.public static boolean hasAncestorMatching(Node node, java.util.function.Predicate<Node> predicate)
public static boolean hasDescendantMatching(Node node, java.util.function.Predicate<Node> predicate, boolean strict)
Copyright © 2019. All rights reserved.