类org.eclipse.jdt.core.dom.ContinueStatement源码实例Demo

下面列出了怎么用org.eclipse.jdt.core.dom.ContinueStatement的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: JDeodorant   文件: CFG.java
private CFGNode createNonCompositeNode(StatementObject statement) {
	CFGNode currentNode;
	Statement astStatement = statement.getStatement();
	if(astStatement instanceof ReturnStatement)
		currentNode = new CFGExitNode(statement);
	else if(astStatement instanceof SwitchCase)
		currentNode = new CFGSwitchCaseNode(statement);
	else if(astStatement instanceof BreakStatement)
		currentNode = new CFGBreakNode(statement);
	else if(astStatement instanceof ContinueStatement)
		currentNode = new CFGContinueNode(statement);
	else if(astStatement instanceof ThrowStatement)
		currentNode = new CFGThrowNode(statement);
	else
		currentNode = new CFGNode(statement);
	directlyNestedNodeInBlock(currentNode);
	return currentNode;
}
 
源代码2 项目: JDeodorant   文件: SwitchControlStructure.java
private List<AbstractControlCase> createSwitchCases(SwitchStatement switchStatement)
{
	List<AbstractControlCase> returnList  = new ArrayList<AbstractControlCase>();
	List<AbstractControlCase> tempList    = new ArrayList<AbstractControlCase>();
	List<Statement> switchGroupStatements = switchStatement.statements();
	for (Statement currentStatement : switchGroupStatements)
	{
		if (currentStatement instanceof SwitchCase)
		{
			Expression caseValue = ((SwitchCase)currentStatement).getExpression();
			SwitchControlCase newCase = new SwitchControlCase(this.variable, caseValue, new ArrayList<Statement>());
			tempList.add(newCase);
			addToAll((SwitchCase)currentStatement, tempList);
		}
		else if (currentStatement instanceof BreakStatement || currentStatement instanceof ReturnStatement || currentStatement instanceof ContinueStatement)
		{
			addToAll(currentStatement, tempList);
			returnList.addAll(tempList);
			tempList = new ArrayList<AbstractControlCase>();
		}
	}
	return returnList;
}
 
源代码3 项目: SimFix   文件: CodeSearch.java
public boolean visit(ContinueStatement node) {
	int start = _unit.getLineNumber(node.getStartPosition());
	if(start == _extendedLine){
		_extendedStatement = node;
		return false;
	}
	return true;
}
 
源代码4 项目: SimFix   文件: CodeBlock.java
private ContinueStmt visit(ContinueStatement node) {
	int startLine = _cunit.getLineNumber(node.getStartPosition());
	int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength());
	ContinueStmt continueStmt = new ContinueStmt(startLine, endLine, node);
	if(node.getLabel() != null){
		continueStmt.setIdentifier(node.getLabel().getFullyQualifiedName());
	}
	return continueStmt;
}
 
源代码5 项目: eclipse.jdt.ls   文件: FlowAnalyzer.java
@Override
public void endVisit(ContinueStatement node) {
	if (skipNode(node)) {
		return;
	}
	setFlowInfo(node, createBranch(node.getLabel()));
}
 
源代码6 项目: xtext-xtend   文件: JavaASTFlattener.java
@Override
public boolean visit(final ContinueStatement node) {
  this.appendToBuffer("/* FIXME Unsupported continue statement */ continue");
  this.addProblem(node, "Continue statement is not supported");
  SimpleName _label = node.getLabel();
  boolean _tripleNotEquals = (_label != null);
  if (_tripleNotEquals) {
    this.appendSpaceToBuffer();
    node.getLabel().accept(this);
  }
  this.appendToBuffer(";");
  this.appendLineWrapToBuffer();
  return false;
}
 
@Override
public boolean visit(ContinueStatement node) {
	SimpleName label= node.getLabel();
	if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) {
		fResult.add(label);
	}
	return false;
}
 
private ASTNode getBreakOrContinueNode(ASTNode selectedNode) {
	if (selectedNode instanceof BreakStatement)
		return selectedNode;
	if (selectedNode instanceof ContinueStatement)
		return selectedNode;
	if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement)
		return selectedNode.getParent();
	if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement)
		return selectedNode.getParent();
	return null;
}
 
private SimpleName getLabel() {
	if (fIsBreak){
		BreakStatement bs= (BreakStatement) fSelected;
		return bs.getLabel();
	} else {
		ContinueStatement cs= (ContinueStatement) fSelected;
		return cs.getLabel();
	}
}
 
/**
 * Finds the target for break or continue node.
 * 
 * @param input the editor input
 * @param region the region
 * @return the break or continue target location or <code>null</code> if none
 * @since 3.7
 */
public static OccurrenceLocation findBreakOrContinueTarget(ITypeRoot input, IRegion region) {
	CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null);
	if (astRoot == null)
		return null;

	ASTNode node= NodeFinder.perform(astRoot, region.getOffset(), region.getLength());
	ASTNode breakOrContinueNode= null;
	boolean labelSelected= false;
	if (node instanceof SimpleName) {
		SimpleName simpleName= (SimpleName) node;
		StructuralPropertyDescriptor location= simpleName.getLocationInParent();
		if (location == ContinueStatement.LABEL_PROPERTY || location == BreakStatement.LABEL_PROPERTY) {
			breakOrContinueNode= simpleName.getParent();
			labelSelected= true;
		}
	} else if (node instanceof ContinueStatement || node instanceof BreakStatement)
		breakOrContinueNode= node;

	if (breakOrContinueNode == null)
		return null;

	BreakContinueTargetFinder finder= new BreakContinueTargetFinder();
	if (finder.initialize(astRoot, breakOrContinueNode) == null) {
		OccurrenceLocation[] locations= finder.getOccurrences();
		if (locations != null) {
			if (breakOrContinueNode instanceof BreakStatement && !labelSelected)
				return locations[locations.length - 1]; // points to the end of target statement
			return locations[0]; // points to the beginning of target statement
		}
	}
	return null;
}
 
源代码11 项目: JDeodorant   文件: SwitchControlCase.java
@Override
public boolean match(SwitchControlCase otherCase, ASTNodeMatcher matcher)
{
	if (this.body.size() == otherCase.body.size())
	{
		boolean caseStatementsMatch = true;
		for (int i = 0; i < this.body.size(); i++)
		{
			Statement currentThisStatement = this.body.get(i);
			Statement currentOtherStatement = otherCase.body.get(i);
			boolean switchCaseStatementMatch = false;
			if (currentThisStatement instanceof SwitchCase && currentOtherStatement instanceof SwitchCase)
			{
				SwitchCase currentThisSwitchCase = (SwitchCase)currentThisStatement;
				SwitchCase currentOtherSwitchCase = (SwitchCase)currentOtherStatement;
				if(currentThisSwitchCase.isDefault() && currentOtherSwitchCase.isDefault())
				{
					switchCaseStatementMatch = true;
				}
				else
				{
					switchCaseStatementMatch = matchCaseCondition(currentThisSwitchCase.getExpression(), currentOtherSwitchCase.getExpression());
				}
			}
			boolean endStatementMatch = ((currentThisStatement instanceof BreakStatement && currentOtherStatement instanceof BreakStatement) ||
					(currentThisStatement instanceof ContinueStatement && currentOtherStatement instanceof ContinueStatement) ||
					(currentThisStatement instanceof ReturnStatement && currentOtherStatement instanceof ReturnStatement));
			if (!switchCaseStatementMatch && !endStatementMatch)
			{
				caseStatementsMatch = false;
			}
		}
		return caseStatementsMatch;
	}
	return false;
}
 
源代码12 项目: JDeodorant   文件: StyledStringVisitor.java
public boolean visit(ContinueStatement stmnt){
	/*
	 * continue [ Identifier ] ;
	 */
	styledString.append("continue", new StyledStringStyler(keywordStyle));
	if (stmnt.getLabel() != null){
		appendSpace();
		handleExpression(stmnt.getLabel());
	}
	appendSemicolon();
	return false;
}
 
源代码13 项目: junion   文件: ReadableFlattener.java
public boolean br(ASTNode node) {
	return node instanceof ExpressionStatement || node instanceof VariableDeclarationStatement || node instanceof BreakStatement || node instanceof ContinueStatement || node instanceof PackageDeclaration || node instanceof ImportDeclaration || node instanceof Javadoc;
}
 
private Location computeBreakContinue(ITypeRoot typeRoot, int line, int column) throws CoreException {
	int offset = JsonRpcHelpers.toOffset(typeRoot.getBuffer(), line, column);
	if (offset >= 0) {
		CompilationUnit unit = SharedASTProviderCore.getAST(typeRoot, SharedASTProviderCore.WAIT_YES, null);
		if (unit == null) {
			return null;
		}
		ASTNode selectedNode = NodeFinder.perform(unit, offset, 0);
		ASTNode node = null;
		SimpleName label = null;
		if (selectedNode instanceof BreakStatement) {
			node = selectedNode;
			label = ((BreakStatement) node).getLabel();
		} else if (selectedNode instanceof ContinueStatement) {
			node = selectedNode;
			label = ((ContinueStatement) node).getLabel();
		} else if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement) {
			node = selectedNode.getParent();
			label = ((BreakStatement) node).getLabel();
		} else if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement) {
			node = selectedNode.getParent();
			label = ((ContinueStatement) node).getLabel();
		}
		if (node != null) {
			ASTNode parent = node.getParent();
			ASTNode target = null;
			while (parent != null) {
				if (parent instanceof MethodDeclaration || parent instanceof Initializer) {
					break;
				}
				if (label == null) {
					if (parent instanceof ForStatement || parent instanceof EnhancedForStatement || parent instanceof WhileStatement || parent instanceof DoStatement) {
						target = parent;
						break;
					}
					if (node instanceof BreakStatement) {
						if (parent instanceof SwitchStatement || parent instanceof SwitchExpression) {
							target = parent;
							break;
						}
					}
					if (node instanceof LabeledStatement) {
						target = parent;
						break;
					}
				} else if (LabeledStatement.class.isInstance(parent)) {
					LabeledStatement ls = (LabeledStatement) parent;
					if (ls.getLabel().getIdentifier().equals(label.getIdentifier())) {
						target = ls;
						break;
					}
				}
				parent = parent.getParent();
			}
			if (target != null) {
				int start = target.getStartPosition();
				int end = new TokenScanner(unit.getTypeRoot()).getNextEndOffset(node.getStartPosition(), true) - start;
				if (start >= 0 && end >= 0) {
					return JDTUtils.toLocation((ICompilationUnit) typeRoot, start, end);
				}
			}
		}
	}
	return null;
}
 
@Override
public void endVisit(ContinueStatement node) {
	if (skipNode(node))
		return;
	setFlowInfo(node, createBranch(node.getLabel()));
}
 
@Override
public boolean visit(ContinueStatement node) {
	if (node.subtreeMatch(fMatcher, fNodeToMatch))
		return matches(node);
	return super.visit(node);
}
 
@Override
public boolean visit(ContinueStatement node) {
	add(fCreator.create(node));
	return true;
}
 
@Override
public void endVisit(ContinueStatement node) {
	endVisitNode(node);
}
 
@Override
public boolean visit(ContinueStatement node) {
	return visitNode(node);
}
 
源代码20 项目: JDeodorant   文件: InstanceOfContinueStatement.java
public boolean instanceOf(Statement statement) {
	if(statement instanceof ContinueStatement)
		return true;
	else
		return false;
}
 
源代码21 项目: JDeodorant   文件: InstanceOfBranchingStatement.java
public boolean instanceOf(Statement statement) {
	if(statement instanceof BreakStatement || statement instanceof ContinueStatement || statement instanceof ReturnStatement)
		return true;
	else
		return false;
}
 
源代码22 项目: JDeodorant   文件: StatementCollector.java
public boolean visit(ContinueStatement node) {
	statementList.add(node);
	return false;
}
 
源代码23 项目: JDeodorant   文件: ExtractStatementsVisitor.java
public boolean visit(ContinueStatement node) {
	statementsList.add(node);
	
	return false;
}
 
源代码24 项目: JDeodorant   文件: CFGContinueNode.java
public CFGContinueNode(AbstractStatement statement) {
	super(statement);
	ContinueStatement continueStatement = (ContinueStatement)statement.getStatement();
	if(continueStatement.getLabel() != null)
		label = continueStatement.getLabel().getIdentifier();
}
 
源代码25 项目: repositoryminer   文件: MethodVisitor.java
@Override
public boolean visit(ContinueStatement node) {
	statements.add(new AbstractStatement(NodeType.CONTINUE, null));
	return true;
}
 
/**
 * @param node the AST node
 * @return array of type constraints, may be empty
 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ContinueStatement)
 */
public ITypeConstraint[] create(ContinueStatement node) {
	return EMPTY_ARRAY;
}
 
 类所在包
 类方法
 同包方法