本文整理匯總了Java中org.eclipse.jdt.core.dom.ASTNode.BREAK_STATEMENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode.BREAK_STATEMENT屬性的具體用法?Java ASTNode.BREAK_STATEMENT怎麽用?Java ASTNode.BREAK_STATEMENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jdt.core.dom.ASTNode
的用法示例。
在下文中一共展示了ASTNode.BREAK_STATEMENT屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findByNode
/**
* Find all nodes connected to the given name node. If the node has a binding then all nodes connected
* to this binding are returned. If the node has no binding, then all nodes that also miss a binding and have
* the same name are returned.
* @param root The root of the AST tree to search
* @param name The node to find linked nodes for
* @return Return
*/
public static SimpleName[] findByNode(ASTNode root, SimpleName name) {
IBinding binding = name.resolveBinding();
if (binding != null) {
return findByBinding(root, binding);
}
SimpleName[] names= findByProblems(root, name);
if (names != null) {
return names;
}
int parentKind= name.getParent().getNodeType();
if (parentKind == ASTNode.LABELED_STATEMENT || parentKind == ASTNode.BREAK_STATEMENT || parentKind == ASTNode.CONTINUE_STATEMENT) {
ArrayList<SimpleName> res= new ArrayList<>();
LabelFinder nodeFinder= new LabelFinder(name, res);
root.accept(nodeFinder);
return res.toArray(new SimpleName[res.size()]);
}
return new SimpleName[] { name };
}
示例2: isLabel
public static boolean isLabel(SimpleName name) {
int parentType= name.getParent().getNodeType();
return parentType == ASTNode.LABELED_STATEMENT ||
parentType == ASTNode.BREAK_STATEMENT || parentType != ASTNode.CONTINUE_STATEMENT;
}