本文整理汇总了Java中org.eclipse.jdt.core.dom.LabeledStatement类的典型用法代码示例。如果您正苦于以下问题:Java LabeledStatement类的具体用法?Java LabeledStatement怎么用?Java LabeledStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LabeledStatement类属于org.eclipse.jdt.core.dom包,在下文中一共展示了LabeledStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParentLoopBody
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的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;
}
示例2: getParentLoopBody
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的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;
}
示例3: getParentLoopBody
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的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;
}
示例4: keepWalkingUp
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
private boolean keepWalkingUp(ASTNode node) {
if (node == null)
return false;
if (isAnyInstanceOf(STOPPERS, node))
return false;
if (fLabel != null && LabeledStatement.class.isInstance(node)){
LabeledStatement ls= (LabeledStatement)node;
return ! areEqualLabels(ls.getLabel(), fLabel);
}
if (fLabel == null) {
if (isAnyInstanceOf(fIsBreak ? BREAKTARGETS : CONTINUETARGETS, node))
return node.getParent() instanceof LabeledStatement; // for behavior consistency of break targets: see bug 339176
if (node instanceof LabeledStatement)
return false;
}
return true;
}
示例5: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public boolean visit(LabeledStatement node) {
if (fDefiningLabel == null) {
SimpleName label= node.getLabel();
if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
fDefiningLabel= node;
fResult.add(label);
}
}
node.getBody().accept(this);
return false;
}
示例6: endVisit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public void endVisit(LabeledStatement node) {
if (skipNode(node)) {
return;
}
FlowInfo info = assignFlowInfo(node, node.getBody());
if (info != null) {
info.removeLabel(node.getLabel());
}
}
示例7: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public boolean visit(LabeledStatement node) {
if (fDefiningLabel == null) {
SimpleName label = node.getLabel();
if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
fDefiningLabel = node;
fResult.add(label);
}
}
node.getBody().accept(this);
return false;
}
示例8: isDangligIf
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的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;
}
}
}
}
示例9: isDangligIf
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的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;
}
}
}
}
示例10: endVisit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public void endVisit(LabeledStatement node) {
if (skipNode(node))
return;
FlowInfo info= assignFlowInfo(node, node.getBody());
if (info != null)
info.removeLabel(node.getLabel());
}
示例11: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public boolean visit(LabeledStatement node) {
node.getLabel().accept(this);
this.fBuffer.append(": ");//$NON-NLS-1$
node.getBody().accept(this);
return false;
}
示例12: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
public boolean visit(LabeledStatement node) {
printIndent();
node.getLabel().accept(this);
this.buffer.append(": ");//$NON-NLS-1$
node.getBody().accept(this);
return false;
}
示例13: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
/**
* Labeled statement.
*
* identifier ':' statement
*/
@Override
public boolean visit(final LabeledStatement node)
{
// visit children
return true;
}
示例14: visit
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
@Override
public boolean visit(LabeledStatement node) {
//System.out.println("Found: " + node.getClass());
int oldIndent = indent;
indent = 0;
node.getLabel().accept(this);
println(":");
indent = oldIndent;
node.getBody().accept(this);
return false;
}
示例15: DOMLabeledStatement
import org.eclipse.jdt.core.dom.LabeledStatement; //导入依赖的package包/类
public DOMLabeledStatement(LabeledStatement statement) {
this.statement = statement;
}