當前位置: 首頁>>代碼示例>>Java>>正文


Java ASTNode.BREAK_STATEMENT屬性代碼示例

本文整理匯總了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 };
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:26,代碼來源:LinkedNodeFinder.java

示例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;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:5,代碼來源:ASTNodes.java


注:本文中的org.eclipse.jdt.core.dom.ASTNode.BREAK_STATEMENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。