本文整理汇总了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;
}
示例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;
}
示例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;
}