public final class CheckProvidesSorted extends java.lang.Object implements NodeTraversal.Callback
Modifier and Type | Class and Description |
---|---|
static class |
CheckProvidesSorted.Mode
Operation modes.
|
Modifier and Type | Field and Description |
---|---|
static DiagnosticType |
PROVIDES_NOT_SORTED |
Constructor and Description |
---|
CheckProvidesSorted(CheckProvidesSorted.Mode mode) |
Modifier and Type | Method and Description |
---|---|
Node |
getFirstNode()
Returns the node for the first recognized provide statement.
|
Node |
getLastNode()
Returns the node for the last recognized provide statement.
|
java.lang.String |
getReplacement()
Returns a textual replacement yielding a canonical version of the provides.
|
boolean |
needsFix()
Returns whether the provides need to be fixed, i.e., whether they are *not* already canonical.
|
boolean |
shouldTraverse(NodeTraversal t,
Node n,
Node parent)
Visits a node in preorder (before its children) and decides whether its children should be
traversed.
|
void |
visit(NodeTraversal t,
Node n,
Node parent)
Visits a node in postorder (after its children).
|
public static final DiagnosticType PROVIDES_NOT_SORTED
public CheckProvidesSorted(CheckProvidesSorted.Mode mode)
public Node getFirstNode()
public Node getLastNode()
public java.lang.String getReplacement()
public boolean needsFix()
public boolean shouldTraverse(NodeTraversal t, Node n, Node parent)
NodeTraversal.Callback
NodeTraversal.Callback.shouldTraverse(NodeTraversal, Node, Node)
in preorder and by NodeTraversal.Callback.visit(NodeTraversal,
Node, Node)
in postorder.
Siblings are always visited left-to-right.
Implementations can have side-effects (e.g. modify the parse tree). Removing the current node is legal, but removing or reordering nodes above the current node may cause nodes to be visited twice or not at all.
shouldTraverse
in interface NodeTraversal.Callback
t
- The current traversal.n
- The current node.parent
- The parent of the current node.public void visit(NodeTraversal t, Node n, Node parent)
NodeTraversal.Callback
NodeTraversal.Callback.shouldTraverse(NodeTraversal, Node, Node)
returned true for its parent. In particular, the
root node is never visited in postorder.
Siblings are always visited left-to-right.
Implementations can have side-effects (e.g. modify the parse tree). Removing the current node is legal, but removing or reordering nodes above the current node may cause nodes to be visited twice or not at all.
visit
in interface NodeTraversal.Callback
t
- The current traversal.n
- The current node.parent
- The parent of the current node.Copyright © 2009-2020 Google. All Rights Reserved.