• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EnhancedForStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.core.dom.EnhancedForStatement的典型用法代码示例。如果您正苦于以下问题:Java EnhancedForStatement类的具体用法?Java EnhancedForStatement怎么用?Java EnhancedForStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnhancedForStatement类属于org.eclipse.jdt.core.dom包,在下文中一共展示了EnhancedForStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: locationNeedsParentheses

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static boolean locationNeedsParentheses(StructuralPropertyDescriptor locationInParent) {
	if (locationInParent instanceof ChildListPropertyDescriptor && locationInParent != InfixExpression.EXTENDED_OPERANDS_PROPERTY) {
		// e.g. argument lists of MethodInvocation, ClassInstanceCreation, dimensions of ArrayCreation ...
		return false;
	}
	if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY
			|| locationInParent == SingleVariableDeclaration.INITIALIZER_PROPERTY
			|| locationInParent == ReturnStatement.EXPRESSION_PROPERTY
			|| locationInParent == EnhancedForStatement.EXPRESSION_PROPERTY
			|| locationInParent == ForStatement.EXPRESSION_PROPERTY
			|| locationInParent == WhileStatement.EXPRESSION_PROPERTY
			|| locationInParent == DoStatement.EXPRESSION_PROPERTY
			|| locationInParent == AssertStatement.EXPRESSION_PROPERTY
			|| locationInParent == AssertStatement.MESSAGE_PROPERTY
			|| locationInParent == IfStatement.EXPRESSION_PROPERTY
			|| locationInParent == SwitchStatement.EXPRESSION_PROPERTY
			|| locationInParent == SwitchCase.EXPRESSION_PROPERTY
			|| locationInParent == ArrayAccess.INDEX_PROPERTY
			|| locationInParent == ThrowStatement.EXPRESSION_PROPERTY
			|| locationInParent == SynchronizedStatement.EXPRESSION_PROPERTY
			|| locationInParent == ParenthesizedExpression.EXPRESSION_PROPERTY) {
		return false;
	}
	return true;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:26,代码来源:NecessaryParenthesesChecker.java


示例2: getEnhancedForStatements

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static Set<EnhancedForStatement> getEnhancedForStatements(IMethod method, IProgressMonitor pm)
		throws JavaModelException {
	ICompilationUnit iCompilationUnit = method.getCompilationUnit();

	// get the ASTParser of the method
	CompilationUnit compilationUnit = RefactoringASTParser.parseWithASTProvider(iCompilationUnit, true,
			new SubProgressMonitor(pm, 1));

	// get the method declaration ASTNode.
	MethodDeclaration methodDeclarationNode = ASTNodeSearchUtil.getMethodDeclarationNode(method, compilationUnit);

	final Set<EnhancedForStatement> statements = new LinkedHashSet<EnhancedForStatement>();
	// extract all enhanced for loop statements in the method.
	methodDeclarationNode.accept(new ASTVisitor() {

		@Override
		public boolean visit(EnhancedForStatement node) {
			statements.add(node);
			return super.visit(node);
		}
	});

	return statements;
}
 
开发者ID:mdarefin,项目名称:Convert-For-Each-Loop-to-Lambda-Expression-Eclipse-Plugin,代码行数:25,代码来源:ForeachLoopToLambdaRefactoring.java


示例3: endVisit

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public void endVisit(EnhancedForStatement node) {
	if (skipNode(node)) {
		return;
	}
	FlowInfo paramInfo = getFlowInfo(node.getParameter());
	FlowInfo expressionInfo = getFlowInfo(node.getExpression());
	FlowInfo actionInfo = getFlowInfo(node.getBody());
	EnhancedForFlowInfo forInfo = createEnhancedFor();
	setFlowInfo(node, forInfo);
	// If the for statement is the outermost loop then we only have to consider
	// the action. The parameter and expression are only evaluated once.
	if (node == fLoopNode) {
		forInfo.mergeAction(actionInfo, fFlowContext);
	} else {
		// Inner for loops are evaluated in the sequence expression, parameter,
		// action.
		forInfo.mergeExpression(expressionInfo, fFlowContext);
		forInfo.mergeParameter(paramInfo, fFlowContext);
		forInfo.mergeAction(actionInfo, fFlowContext);
	}
	forInfo.removeLabel(null);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:24,代码来源:InputFlowAnalyzer.java


示例4: getParentLoopBody

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private Statement getParentLoopBody(ASTNode node) {
	Statement stmt = null;
	ASTNode start = node;
	while (start != null && !(start instanceof ForStatement) && !(start instanceof DoStatement) && !(start instanceof WhileStatement) && !(start instanceof EnhancedForStatement) && !(start instanceof SwitchStatement)) {
		start = start.getParent();
	}
	if (start instanceof ForStatement) {
		stmt = ((ForStatement) start).getBody();
	} else if (start instanceof DoStatement) {
		stmt = ((DoStatement) start).getBody();
	} else if (start instanceof WhileStatement) {
		stmt = ((WhileStatement) start).getBody();
	} else if (start instanceof EnhancedForStatement) {
		stmt = ((EnhancedForStatement) start).getBody();
	}
	if (start != null && start.getParent() instanceof LabeledStatement) {
		LabeledStatement labeledStatement = (LabeledStatement) start.getParent();
		fEnclosingLoopLabel = labeledStatement.getLabel();
	}
	return stmt;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:ExtractMethodAnalyzer.java


示例5: addEnhancedForWithoutTypeProposals

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static void addEnhancedForWithoutTypeProposals(ICompilationUnit cu, ASTNode selectedNode,
		Collection<CUCorrectionProposal> proposals) {
	if (selectedNode instanceof SimpleName && (selectedNode.getLocationInParent() == SimpleType.NAME_PROPERTY || selectedNode.getLocationInParent() == NameQualifiedType.NAME_PROPERTY)) {
		ASTNode type= selectedNode.getParent();
		if (type.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY) {
			SingleVariableDeclaration svd= (SingleVariableDeclaration) type.getParent();
			if (svd.getLocationInParent() == EnhancedForStatement.PARAMETER_PROPERTY) {
				if (svd.getName().getLength() == 0) {
					SimpleName simpleName= (SimpleName) selectedNode;
					String name= simpleName.getIdentifier();
					int relevance= StubUtility.hasLocalVariableName(cu.getJavaProject(), name) ? 10 : 7;
					String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_create_loop_variable_description, BasicElementLabels.getJavaElementName(name));

					proposals.add(new NewVariableCorrectionProposal(label, cu, NewVariableCorrectionProposal.LOCAL,
							simpleName, null, relevance));
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:21,代码来源:UnresolvedElementsSubProcessor.java


示例6: locationNeedsParentheses

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static boolean locationNeedsParentheses(StructuralPropertyDescriptor locationInParent) {
  if (locationInParent instanceof ChildListPropertyDescriptor
      && locationInParent != InfixExpression.EXTENDED_OPERANDS_PROPERTY) {
    // e.g. argument lists of MethodInvocation, ClassInstanceCreation, dimensions of ArrayCreation
    // ...
    return false;
  }
  if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY
      || locationInParent == SingleVariableDeclaration.INITIALIZER_PROPERTY
      || locationInParent == ReturnStatement.EXPRESSION_PROPERTY
      || locationInParent == EnhancedForStatement.EXPRESSION_PROPERTY
      || locationInParent == ForStatement.EXPRESSION_PROPERTY
      || locationInParent == WhileStatement.EXPRESSION_PROPERTY
      || locationInParent == DoStatement.EXPRESSION_PROPERTY
      || locationInParent == AssertStatement.EXPRESSION_PROPERTY
      || locationInParent == AssertStatement.MESSAGE_PROPERTY
      || locationInParent == IfStatement.EXPRESSION_PROPERTY
      || locationInParent == SwitchStatement.EXPRESSION_PROPERTY
      || locationInParent == SwitchCase.EXPRESSION_PROPERTY
      || locationInParent == ArrayAccess.INDEX_PROPERTY
      || locationInParent == ThrowStatement.EXPRESSION_PROPERTY
      || locationInParent == SynchronizedStatement.EXPRESSION_PROPERTY
      || locationInParent == ParenthesizedExpression.EXPRESSION_PROPERTY) {
    return false;
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:NecessaryParenthesesChecker.java


示例7: endVisit

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public void endVisit(EnhancedForStatement node) {
  if (skipNode(node)) return;
  FlowInfo paramInfo = getFlowInfo(node.getParameter());
  FlowInfo expressionInfo = getFlowInfo(node.getExpression());
  FlowInfo actionInfo = getFlowInfo(node.getBody());
  EnhancedForFlowInfo forInfo = createEnhancedFor();
  setFlowInfo(node, forInfo);
  // If the for statement is the outermost loop then we only have to consider
  // the action. The parameter and expression are only evaluated once.
  if (node == fLoopNode) {
    forInfo.mergeAction(actionInfo, fFlowContext);
  } else {
    // Inner for loops are evaluated in the sequence expression, parameter,
    // action.
    forInfo.mergeExpression(expressionInfo, fFlowContext);
    forInfo.mergeParameter(paramInfo, fFlowContext);
    forInfo.mergeAction(actionInfo, fFlowContext);
  }
  forInfo.removeLabel(null);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:InputFlowAnalyzer.java


示例8: getParentLoopBody

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private Statement getParentLoopBody(ASTNode node) {
  Statement stmt = null;
  ASTNode start = node;
  while (start != null
      && !(start instanceof ForStatement)
      && !(start instanceof DoStatement)
      && !(start instanceof WhileStatement)
      && !(start instanceof EnhancedForStatement)
      && !(start instanceof SwitchStatement)) {
    start = start.getParent();
  }
  if (start instanceof ForStatement) {
    stmt = ((ForStatement) start).getBody();
  } else if (start instanceof DoStatement) {
    stmt = ((DoStatement) start).getBody();
  } else if (start instanceof WhileStatement) {
    stmt = ((WhileStatement) start).getBody();
  } else if (start instanceof EnhancedForStatement) {
    stmt = ((EnhancedForStatement) start).getBody();
  }
  if (start != null && start.getParent() instanceof LabeledStatement) {
    LabeledStatement labeledStatement = (LabeledStatement) start.getParent();
    fEnclosingLoopLabel = labeledStatement.getLabel();
  }
  return stmt;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ExtractMethodAnalyzer.java


示例9: checkFinalConditions

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm)
		throws CoreException, OperationCanceledException {
	try {
		final RefactoringStatus status = new RefactoringStatus();
		for (IMethod method : methods) {
			Set<EnhancedForStatement> statements = getEnhancedForStatements(method, new SubProgressMonitor(pm, 1));

			IProgressMonitor subMonitor = new SubProgressMonitor(pm, statements.size());

			// check preconditions on each.
			statements.stream().forEach(s -> status.merge(checkEnhancedForStatement(s, method, subMonitor)));
			pm.worked(1);
		}
		return status;
	} finally {
		pm.done();
	}
}
 
开发者ID:mdarefin,项目名称:Convert-For-Each-Loop-to-Lambda-Expression-Eclipse-Plugin,代码行数:20,代码来源:ForeachLoopToLambdaRefactoring.java


示例10: preNext

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public boolean preNext(Statement curElement) {
	switch (curElement.getNodeType()) {
	case ASTNode.WHILE_STATEMENT:
		exportWhile((WhileStatement) curElement);
		break;
	case ASTNode.FOR_STATEMENT:
		exportFor((ForStatement) curElement);
		break;
	case ASTNode.ENHANCED_FOR_STATEMENT:
		exportForEach((EnhancedForStatement) curElement);
		break;
	case ASTNode.DO_STATEMENT:
		exportDoWhileStatement((DoStatement) curElement);
		break;
	}

	return true;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:20,代码来源:LoopFragment.java


示例11: endVisit

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public void endVisit(EnhancedForStatement node) {
	if (skipNode(node))
		return;
	FlowInfo paramInfo= getFlowInfo(node.getParameter());
	FlowInfo expressionInfo= getFlowInfo(node.getExpression());
	FlowInfo actionInfo= getFlowInfo(node.getBody());
	EnhancedForFlowInfo forInfo= createEnhancedFor();
	setFlowInfo(node, forInfo);
	// If the for statement is the outermost loop then we only have to consider
	// the action. The parameter and expression are only evaluated once.
	if (node == fLoopNode) {
		forInfo.mergeAction(actionInfo, fFlowContext);
	} else {
		// Inner for loops are evaluated in the sequence expression, parameter,
		// action.
		forInfo.mergeExpression(expressionInfo, fFlowContext);
		forInfo.mergeParameter(paramInfo, fFlowContext);
		forInfo.mergeAction(actionInfo, fFlowContext);
	}
	forInfo.removeLabel(null);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:InputFlowAnalyzer.java


示例12: getParentLoopBody

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private Statement getParentLoopBody(ASTNode node) {
	Statement stmt= null;
	ASTNode start= node;
	while (start != null
			&& !(start instanceof ForStatement)
			&& !(start instanceof DoStatement)
			&& !(start instanceof WhileStatement)
			&& !(start instanceof EnhancedForStatement)
			&& !(start instanceof SwitchStatement)) {
		start= start.getParent();
	}
	if (start instanceof ForStatement) {
		stmt= ((ForStatement)start).getBody();
	} else if (start instanceof DoStatement) {
		stmt= ((DoStatement)start).getBody();
	} else if (start instanceof WhileStatement) {
		stmt= ((WhileStatement)start).getBody();
	} else if (start instanceof EnhancedForStatement) {
		stmt= ((EnhancedForStatement)start).getBody();
	}
	if (start != null && start.getParent() instanceof LabeledStatement) {
		LabeledStatement labeledStatement= (LabeledStatement)start.getParent();
		fEnclosingLoopLabel= labeledStatement.getLabel();
	}
	return stmt;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:ExtractMethodAnalyzer.java


示例13: addEnhancedForWithoutTypeProposals

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static void addEnhancedForWithoutTypeProposals(ICompilationUnit cu, ASTNode selectedNode, Collection<ICommandAccess> proposals) {
	if (selectedNode instanceof SimpleName && (selectedNode.getLocationInParent() == SimpleType.NAME_PROPERTY || selectedNode.getLocationInParent() == NameQualifiedType.NAME_PROPERTY)) {
		ASTNode type= selectedNode.getParent();
		if (type.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY) {
			SingleVariableDeclaration svd= (SingleVariableDeclaration) type.getParent();
			if (svd.getLocationInParent() == EnhancedForStatement.PARAMETER_PROPERTY) {
				if (svd.getName().getLength() == 0) {
					SimpleName simpleName= (SimpleName) selectedNode;
					String name= simpleName.getIdentifier();
					int relevance= StubUtility.hasLocalVariableName(cu.getJavaProject(), name) ? 10 : 7;
					String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_create_loop_variable_description, BasicElementLabels.getJavaElementName(name));
					Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL);
					
					proposals.add(new NewVariableCorrectionProposal(label, cu, NewVariableCorrectionProposal.LOCAL, simpleName, null, relevance, image));
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:UnresolvedElementsSubProcessor.java


示例14: isLastStatementInEnclosingMethodOrLambda

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private static boolean isLastStatementInEnclosingMethodOrLambda(Statement statement) {
	ASTNode currentStructure= statement;
	ASTNode currentParent= statement.getParent();
	while (!(currentParent instanceof MethodDeclaration || currentParent instanceof LambdaExpression)) {
		// should not be in a loop
		if (currentParent instanceof ForStatement || currentParent instanceof EnhancedForStatement
				|| currentParent instanceof WhileStatement || currentParent instanceof DoStatement) {
			return false;
		}
		if (currentParent instanceof Block) {
			Block parentBlock= (Block) currentParent;
			if (parentBlock.statements().indexOf(currentStructure) != parentBlock.statements().size() - 1) { // not last statement in the block
				return false;
			}
		}
		currentStructure= currentParent;
		currentParent= currentParent.getParent();
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:AdvancedQuickAssistProcessor.java


示例15: visit

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
/**
 * 'for(' parameter ':' expression ') {' body '}'
 */
@Override
public boolean visit(final EnhancedForStatement node)
{
  final int lineNo = lineStart(node);
  // new dependence
  final IResolvedLine rd = createDependence(LK_ENHANCED_FOR, lineNo, mdg.parent());
  // add this definition
  rd.definitions().add(
      factory.resolveExpression(node.getParameter().getName(), node, null, false, true));
  // collect uses for this control predicate
  appendDependences(rd, node.getExpression(), null, false);
  // recursively append dependences
  appendRecursive(lineNo, rd, node.getBody());
  // do not visit children
  return false;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:20,代码来源:StatementVisitor.java


示例16: repairBug

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
    ASTNode node = getASTNode(workingUnit, bug.getPrimarySourceLineAnnotation());
    this.typeSource = ImportRewrite.create(workingUnit, true); // these imports won't get added automatically
    this.rewrite = rewrite;
    this.ast = rewrite.getAST();
    EntrySetResolutionVisitor visitor = new EntrySetResolutionVisitor();
    node.accept(visitor);

    EnhancedForStatement replacement = makeReplacementForLoop(visitor);

    rewrite.replace(visitor.ancestorForLoop, replacement, null);

    addImports(rewrite, workingUnit, ImportUtil.filterOutJavaLangImports(typeSource.getAddedImports()));
    addImports(rewrite, workingUnit, "java.util.Map"); // shouldn't be necessary. Allows us to use Map.entry
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:17,代码来源:EntrySetResolution.java


示例17: makeReplacementForLoop

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private EnhancedForStatement makeReplacementForLoop(EntrySetResolutionVisitor visitor) {
    // this would be map.keySet().
    // We need this to get the type of map and get the variable name of map
    MethodInvocation oldLoopExpression = (MethodInvocation) visitor.ancestorForLoop.getExpression();

    // for(Parameter : Expression)
    EnhancedForStatement replacement = ast.newEnhancedForStatement();
    replacement.setParameter(makeEntrySetParameter(oldLoopExpression));
    replacement.setExpression(makeCallToEntrySet(oldLoopExpression));

    List<Statement> replacementBlockStatements = ((Block) replacement.getBody()).statements();
    // create new statement to replace the key object (e.g. the String s that used to be in the for each)
    replacementBlockStatements.add(makeNewKeyStatement(visitor));
    // replace the call to map.get() with a call to entry.getValue()
    replacementBlockStatements.add(makeNewValueStatement(visitor));
    // transfer the rest of the statements in the old block
    copyRestOfBlock(replacementBlockStatements, visitor);
    return replacement;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:21,代码来源:EntrySetResolution.java


示例18: visit

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
@Override
public boolean visit(MethodInvocation node) {
    if (ancestorForLoop != null) {
        return false;
    }
    if (!"get".equals(node.getName().getIdentifier())) {
        return true; // there may be a nested method invocation
    }
    valueTypeName = node.resolveTypeBinding().getName(); // for description message
    this.ancestorForLoop = TraversalUtil.findClosestAncestor(node, EnhancedForStatement.class);
    this.badMapGetStatement = TraversalUtil.findClosestAncestor(node, Statement.class);
    // if this is null, it was an anonymous use
    this.badMapGetVariableFragment = TraversalUtil.findClosestAncestor(node, VariableDeclarationFragment.class);

    if (badMapGetVariableFragment == null) {
        this.badMapGetMethodInvocation = node; // this is an anonymous usage, and will need to be replaced
    }
    return false;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:20,代码来源:EntrySetResolution.java


示例19: isLoopStatement

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
private boolean isLoopStatement(Block block) {
	ASTNode parent = block.getParent();
	return
			parent instanceof WhileStatement ||
			parent instanceof ForStatement ||
			parent instanceof DoStatement ||
			parent instanceof EnhancedForStatement ||
			parent instanceof IfStatement;
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:10,代码来源:VarParser.java


示例20: isControlStatementBody

import org.eclipse.jdt.core.dom.EnhancedForStatement; //导入依赖的package包/类
/**
 * Returns true if a node at a given location is a body of a control statement. Such body nodes are
 * interesting as when replacing them, it has to be evaluates if a Block is needed instead.
 * E.g. <code> if (x) do(); -> if (x) { do1(); do2() } </code>
 *
 * @param locationInParent Location of the body node
 * @return Returns true if the location is a body node location of a control statement.
 */
public static boolean isControlStatementBody(StructuralPropertyDescriptor locationInParent) {
	return locationInParent == IfStatement.THEN_STATEMENT_PROPERTY
			|| locationInParent == IfStatement.ELSE_STATEMENT_PROPERTY
			|| locationInParent == ForStatement.BODY_PROPERTY
			|| locationInParent == EnhancedForStatement.BODY_PROPERTY
			|| locationInParent == WhileStatement.BODY_PROPERTY
			|| locationInParent == DoStatement.BODY_PROPERTY;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:ASTNodes.java



注:本文中的org.eclipse.jdt.core.dom.EnhancedForStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractQueryCreator类代码示例发布时间:2022-05-21
下一篇:
Java OWLObjectPropertyExpression类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap