当前位置: 首页>>代码示例>>Java>>正文


Java SwitchCase.isDefault方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.SwitchCase.isDefault方法的典型用法代码示例。如果您正苦于以下问题:Java SwitchCase.isDefault方法的具体用法?Java SwitchCase.isDefault怎么用?Java SwitchCase.isDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.SwitchCase的用法示例。


在下文中一共展示了SwitchCase.isDefault方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
@Override
public boolean visit(SwitchCase node) {
  // switch on enum allows to use enum constants without qualification
  if (hasFlag(VARIABLES, fFlags) && !node.isDefault() && isInside(node.getExpression())) {
    SwitchStatement switchStatement = (SwitchStatement) node.getParent();
    ITypeBinding binding = switchStatement.getExpression().resolveTypeBinding();
    if (binding != null && binding.isEnum()) {
      IVariableBinding[] declaredFields = binding.getDeclaredFields();
      for (int i = 0; i < declaredFields.length; i++) {
        IVariableBinding curr = declaredFields[i];
        if (curr.isEnumConstant()) {
          fBreak = fRequestor.acceptBinding(curr);
          if (fBreak) return false;
        }
      }
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:ScopeAnalyzer.java

示例2: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
@Override
public boolean visit(SwitchCase node) {
	// switch on enum allows to use enum constants without qualification
	if (hasFlag(VARIABLES, fFlags) && !node.isDefault() && isInside(node.getExpression())) {
		SwitchStatement switchStatement= (SwitchStatement) node.getParent();
		ITypeBinding binding= switchStatement.getExpression().resolveTypeBinding();
		if (binding != null && binding.isEnum()) {
			IVariableBinding[] declaredFields= binding.getDeclaredFields();
			for (int i= 0; i < declaredFields.length; i++) {
				IVariableBinding curr= declaredFields[i];
				if (curr.isEnumConstant()) {
					fBreak= fRequestor.acceptBinding(curr);
					if (fBreak)
						return false;
				}
			}
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ScopeAnalyzer.java

示例3: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
@Override
public boolean visit(SwitchCase node) {
	//System.out.println("Found: " + node.getClass());
	if (node.isDefault()) {
		println("default:");
	} else {
		print("case ");
		node.getExpression().accept(this);
		println(":");
	}
	// Case fallthrough
	SwitchStatement ss = (SwitchStatement)node.getParent();
	List statements = ss.statements();
	if (statements.indexOf(node) < statements.size() - 1) {
		Object nextSibling = statements.get(statements.indexOf(node) + 1);
		if (nextSibling instanceof SwitchCase) {
			//indent++;
			println("goto " + (((SwitchCase)nextSibling).isDefault() ? "default;" : "case;" ));
			//indent--;
			return false;
		}
	}
	// TODO Get indentation right
	//indent++;
	return false;
}
 
开发者ID:mrmonday,项目名称:j2d,代码行数:27,代码来源:J2dVisitor.java

示例4: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
/**
 * @see ASTVisitor#visit(SwitchCase)
 */
@Override
public boolean visit(SwitchCase node) {
	if (!node.isDefault()){
		cyclomaticComplexityIndex++;
		sumCyclomaticComplexity++;
	}
	return true;
}
 
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:12,代码来源:CyclomaticComplexityVisitor.java

示例5: createSwitchData

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
protected SwitchData createSwitchData(SwitchStatement node) {
	SwitchData result = new SwitchData();
	List<Statement> statements = node.statements();
	if (statements.isEmpty()) {
		return result;
	}

	int start = -1, end = -1;
	GenericSequentialFlowInfo info = null;

	for (Iterator<Statement> iter = statements.iterator(); iter.hasNext();) {
		Statement statement = iter.next();
		if (statement instanceof SwitchCase) {
			SwitchCase switchCase = (SwitchCase) statement;
			if (switchCase.isDefault()) {
				result.setHasDefaultCase();
			}
			if (info == null) {
				info = createSequential();
				start = statement.getStartPosition();
			} else {
				if (info.isReturn() || info.isPartialReturn() || info.branches()) {
					result.add(new Region(start, end - start + 1), info);
					info = createSequential();
					start = statement.getStartPosition();
				}
			}
		} else {
			info.merge(getFlowInfo(statement), fFlowContext);
		}
		end = statement.getStartPosition() + statement.getLength() - 1;
	}
	result.add(new Region(start, end - start + 1), info);
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:36,代码来源:FlowAnalyzer.java

示例6: createSwitchData

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
protected SwitchData createSwitchData(SwitchStatement node) {
	SwitchData result= new SwitchData();
	List<Statement> statements= node.statements();
	if (statements.isEmpty())
		return result;

	int start= -1, end= -1;
	GenericSequentialFlowInfo info= null;

	for (Iterator<Statement> iter= statements.iterator(); iter.hasNext(); ) {
		Statement statement= iter.next();
		if (statement instanceof SwitchCase) {
			SwitchCase switchCase= (SwitchCase)statement;
			if (switchCase.isDefault()) {
				result.setHasDefaultCase();
			}
			if (info == null) {
				info= createSequential();
				start= statement.getStartPosition();
			} else {
				if (info.isReturn() || info.isPartialReturn() || info.branches()) {
					result.add(new Region(start, end - start + 1), info);
					info= createSequential();
					start= statement.getStartPosition();
				}
			}
		} else {
			info.merge(getFlowInfo(statement), fFlowContext);
		}
		end= statement.getStartPosition() + statement.getLength() - 1;
	}
	result.add(new Region(start, end - start + 1), info);
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:FlowAnalyzer.java

示例7: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
@Override
public boolean visit(SwitchCase node) {
	if (node.isDefault()) {
		this.fBuffer.append("default :");//$NON-NLS-1$
	} else {
		this.fBuffer.append("case ");//$NON-NLS-1$
		node.getExpression().accept(this);
		this.fBuffer.append(":");//$NON-NLS-1$
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:12,代码来源:ASTFlattener.java

示例8: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
public boolean visit(SwitchCase node) {
	if (node.isDefault()) {
		this.buffer.append("default :\n");//$NON-NLS-1$
	} else {
		this.buffer.append("case ");//$NON-NLS-1$
		node.getExpression().accept(this);
		this.buffer.append(":\n");//$NON-NLS-1$
	}
	this.indent++; //decremented in visit(SwitchStatement)
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:12,代码来源:NaiveASTFlattener.java

示例9: visit

import org.eclipse.jdt.core.dom.SwitchCase; //导入方法依赖的package包/类
@Override
public boolean visit(SwitchCase node) {
	if (node.isDefault()) {
		statements.add(new AbstractStatement(NodeType.SWITCH_DEFAULT, null));
	} else {
		statements.add(new AbstractStatement(NodeType.SWITCH_CASE, node.getExpression().toString()));
	}
	return true;
}
 
开发者ID:visminer,项目名称:repositoryminer,代码行数:10,代码来源:MethodVisitor.java


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