本文整理汇总了Java中org.eclipse.jdt.core.dom.DoStatement类的典型用法代码示例。如果您正苦于以下问题:Java DoStatement类的具体用法?Java DoStatement怎么用?Java DoStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoStatement类属于org.eclipse.jdt.core.dom包,在下文中一共展示了DoStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: locationNeedsParentheses
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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: getStatementType
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
/**
* Method that check statement type.
* @author Mariana Azevedo
* @since 13/07/2014
* @param itStatement
*/
private void getStatementType(Object itStatement) {
if (itStatement instanceof CatchClause){
this.visitor.visit((CatchClause)itStatement);
}else if (itStatement instanceof ForStatement){
this.visitor.visit((ForStatement)itStatement);
}else if (itStatement instanceof IfStatement){
this.visitor.visit((IfStatement)itStatement);
}else if (itStatement instanceof WhileStatement){
this.visitor.visit((WhileStatement)itStatement);
}else if (itStatement instanceof TryStatement){
this.visitor.visit((TryStatement)itStatement);
}else if (itStatement instanceof ConditionalExpression){
this.visitor.visit((ConditionalExpression)itStatement);
}else if (itStatement instanceof SwitchCase){
this.visitor.visit((SwitchCase)itStatement);
}else if (itStatement instanceof DoStatement){
this.visitor.visit((DoStatement)itStatement);
}else if (itStatement instanceof ExpressionStatement){
this.visitor.visit((ExpressionStatement)itStatement);
}
}
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:28,代码来源:WeightMethodsPerClassVisitor.java
示例3: getParentLoopBody
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例4: visit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public boolean visit(DoStatement node) {
boolean result = super.visit(node);
try {
int actionStart = getTokenScanner().getTokenEndOffset(ITerminalSymbols.TokenNamedo, node.getStartPosition());
if (getSelection().getOffset() == actionStart) {
invalidSelection(RefactoringCoreMessages.ExtractMethodAnalyzer_after_do_keyword, JavaStatusContext.create(fCUnit, getSelection()));
return false;
}
} catch (CoreException e) {
// ignore
}
return result;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:ExtractMethodAnalyzer.java
示例5: locationNeedsParentheses
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例6: getParentLoopBody
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例7: visit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public boolean visit(DoStatement node) {
boolean result = super.visit(node);
try {
int actionStart =
getTokenScanner()
.getTokenEndOffset(ITerminalSymbols.TokenNamedo, node.getStartPosition());
if (getSelection().getOffset() == actionStart) {
invalidSelection(
RefactoringCoreMessages.ExtractMethodAnalyzer_after_do_keyword,
JavaStatusContext.create(fCUnit, getSelection()));
return false;
}
} catch (CoreException e) {
// ignore
}
return result;
}
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:ExtractMethodAnalyzer.java
示例8: preNext
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例9: getParentLoopBody
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例10: visit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public boolean visit(DoStatement node) {
boolean result= super.visit(node);
try {
int actionStart= getTokenScanner().getTokenEndOffset(ITerminalSymbols.TokenNamedo, node.getStartPosition());
if (getSelection().getOffset() == actionStart) {
invalidSelection(RefactoringCoreMessages.ExtractMethodAnalyzer_after_do_keyword, JavaStatusContext.create(fCUnit, getSelection()));
return false;
}
} catch (CoreException e) {
// ignore
}
return result;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ExtractMethodAnalyzer.java
示例11: isLastStatementInEnclosingMethodOrLambda
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例12: isLoopStatement
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例13: visit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
/**
* @see ASTVisitor#visit(DoStatement)
*/
@Override
public boolean visit(DoStatement node) {
cyclomaticComplexityIndex++;
sumCyclomaticComplexity++;
inspectExpression(node.getExpression());
return true;
}
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:11,代码来源:CyclomaticComplexityVisitor.java
示例14: isControlStatementBody
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的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
示例15: endVisit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public void endVisit(DoStatement node) {
if (skipNode(node)) {
return;
}
DoWhileFlowInfo info = createDoWhile();
setFlowInfo(node, info);
info.mergeAction(getFlowInfo(node.getBody()), fFlowContext);
// No need to merge the condition. It was already considered by the InputFlowAnalyzer.
info.removeLabel(null);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:InputFlowAnalyzer.java
示例16: endVisit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public void endVisit(DoStatement node) {
if (skipNode(node)) {
return;
}
DoWhileFlowInfo info = createDoWhile();
setFlowInfo(node, info);
info.mergeAction(getFlowInfo(node.getBody()), fFlowContext);
info.mergeCondition(getFlowInfo(node.getExpression()), fFlowContext);
info.removeLabel(null);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:FlowAnalyzer.java
示例17: endVisit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public void endVisit(DoStatement node) {
ASTNode[] selectedNodes = getSelectedNodes();
if (doAfterValidation(node, selectedNodes)) {
if (contains(selectedNodes, node.getBody()) && contains(selectedNodes, node.getExpression())) {
invalidSelection(RefactoringCoreMessages.StatementAnalyzer_do_body_expression);
}
}
super.endVisit(node);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:StatementAnalyzer.java
示例18: collectIfStatements
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
private List<IfStatement> collectIfStatements(Statement st) {
List<IfStatement> ifStatements = new ArrayList<IfStatement>();
if (st == null) {
return ifStatements;
}
if (st.getNodeType() == ASTNode.IF_STATEMENT) {
IfStatement ifSt = (IfStatement) st;
ifStatements.add(ifSt);
ifStatements.addAll(collectIfStatements(ifSt.getThenStatement()));
ifStatements.addAll(collectIfStatements(ifSt.getElseStatement()));
} else if (st.getNodeType() == ASTNode.BLOCK) {
Block block = (Block) st;
for (Object blockSt : block.statements()) {
if (blockSt instanceof Statement) {
ifStatements
.addAll(collectIfStatements((Statement) blockSt));
}
}
} else if (st.getNodeType() == ASTNode.DO_STATEMENT) {
DoStatement doSt = (DoStatement) st;
ifStatements.addAll(collectIfStatements(doSt.getBody()));
} else if (st.getNodeType() == ASTNode.WHILE_STATEMENT) {
WhileStatement whileSt = (WhileStatement) st;
ifStatements.addAll(collectIfStatements(whileSt.getBody()));
}
return ifStatements;
}
开发者ID:junit-tools-team,项目名称:junit-tools,代码行数:33,代码来源:MethodAnalyzer.java
示例19: isDangligIf
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
public boolean isDangligIf() {
List<Statement> statements = fDeclaration.getBody().statements();
if (statements.size() != 1) return false;
ASTNode p = statements.get(0);
while (true) {
if (p instanceof IfStatement) {
return ((IfStatement) p).getElseStatement() == null;
} else {
ChildPropertyDescriptor childD;
if (p instanceof WhileStatement) {
childD = WhileStatement.BODY_PROPERTY;
} else if (p instanceof ForStatement) {
childD = ForStatement.BODY_PROPERTY;
} else if (p instanceof EnhancedForStatement) {
childD = EnhancedForStatement.BODY_PROPERTY;
} else if (p instanceof DoStatement) {
childD = DoStatement.BODY_PROPERTY;
} else if (p instanceof LabeledStatement) {
childD = LabeledStatement.BODY_PROPERTY;
} else {
return false;
}
Statement body = (Statement) p.getStructuralProperty(childD);
if (body instanceof Block) {
return false;
} else {
p = body;
}
}
}
}
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:SourceProvider.java
示例20: endVisit
import org.eclipse.jdt.core.dom.DoStatement; //导入依赖的package包/类
@Override
public void endVisit(DoStatement node) {
if (skipNode(node)) return;
DoWhileFlowInfo info = createDoWhile();
setFlowInfo(node, info);
info.mergeAction(getFlowInfo(node.getBody()), fFlowContext);
// No need to merge the condition. It was already considered by the InputFlowAnalyzer.
info.removeLabel(null);
}
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:InputFlowAnalyzer.java
注:本文中的org.eclipse.jdt.core.dom.DoStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论