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


Java Stack.add方法代码示例

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


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

示例1: allOperandsAreLiterals

import com.intellij.util.containers.Stack; //导入方法依赖的package包/类
public static boolean allOperandsAreLiterals(@Nullable final PsiExpression expression) {
  if (expression == null) return false;
  if (expression instanceof PsiLiteralExpression) return true;
  if (expression instanceof PsiPolyadicExpression) {
    Stack<PsiExpression> stack = new Stack<PsiExpression>();
    stack.add(expression);
    while (!stack.isEmpty()) {
      PsiExpression psiExpression = stack.pop();
      if (psiExpression instanceof PsiPolyadicExpression) {
        PsiPolyadicExpression binaryExpression = (PsiPolyadicExpression)psiExpression;
        for (PsiExpression op : binaryExpression.getOperands()) {
          stack.push(op);
        }
      }
      else if (!(psiExpression instanceof PsiLiteralExpression)) {
        return false;
      }
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DfaPsiUtil.java

示例2: calculateSiblingMethods

import com.intellij.util.containers.Stack; //导入方法依赖的package包/类
public static Set<PsiMethod> calculateSiblingMethods(PsiMethod method) {
    final Set<PsiMethod> siblingMethods = new HashSet<PsiMethod>();
    final Stack<PsiMethod> pendingMethods = new Stack<PsiMethod>();
    pendingMethods.add(method);
    while(!pendingMethods.isEmpty())
    {
        final PsiMethod methodToAnalyze = pendingMethods.pop();
        siblingMethods.add(methodToAnalyze);
      final Iterable<PsiMethod> overridingMethods = OverridingMethodsSearch.search(methodToAnalyze, false);
        for (PsiMethod overridingMethod : overridingMethods) {
            if (!siblingMethods.contains(overridingMethod) &&
                    !pendingMethods.contains(overridingMethod)) {
                pendingMethods.add(overridingMethod);
            }
        }
        final PsiMethod[] superMethods = methodToAnalyze.findSuperMethods();
        for (PsiMethod superMethod : superMethods) {
            if (!siblingMethods.contains(superMethod) &&
                    !pendingMethods.contains(superMethod)) {
                pendingMethods.add(superMethod);
            }
        }
    }
    return siblingMethods;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MethodInheritanceUtils.java

示例3: allOperandsAreLiterals

import com.intellij.util.containers.Stack; //导入方法依赖的package包/类
private static boolean allOperandsAreLiterals(@Nullable final PsiExpression expression)
{
	if(expression == null)
	{
		return false;
	}
	if(expression instanceof PsiLiteralExpression)
	{
		return true;
	}
	if(expression instanceof PsiPolyadicExpression)
	{
		Stack<PsiExpression> stack = new Stack<>();
		stack.add(expression);
		while(!stack.isEmpty())
		{
			PsiExpression psiExpression = stack.pop();
			if(psiExpression instanceof PsiPolyadicExpression)
			{
				PsiPolyadicExpression binaryExpression = (PsiPolyadicExpression) psiExpression;
				for(PsiExpression op : binaryExpression.getOperands())
				{
					stack.push(op);
				}
			}
			else if(!(psiExpression instanceof PsiLiteralExpression))
			{
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:35,代码来源:DfaPsiUtil.java


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