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


Java HashSet.add方法代码示例

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


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

示例1: clearCurrent

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
public void clearCurrent(Set<String> paths) {
  final HashSet<String> converted = new HashSet<String>();
  for (String path : paths) {
    converted.add(FilePathsHelper.convertPath(path));
  }
  synchronized (myLock) {
    final Set<CurrentKey> toRemove = new HashSet<CurrentKey>();
    myCurrentRevisionsCache.iterateKeys(new Consumer<CurrentKey>() {
      @Override
      public void consume(CurrentKey currentKey) {
        if (converted.contains(FilePathsHelper.convertPath(currentKey.getPath().getPath()))) {
          toRemove.add(currentKey);
        }
      }
    });
    for (CurrentKey key : toRemove) {
      myCurrentRevisionsCache.remove(key);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ContentRevisionCache.java

示例2: findLineBreakpoints

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
@NotNull
private static Set<XLineBreakpoint> findLineBreakpoints(AnActionEvent e) {
  Project project = e.getProject();
  Editor editor = e.getData(CommonDataKeys.EDITOR);
  if (project == null || editor == null) return Collections.emptySet();
  XBreakpointManagerImpl breakpointManager = (XBreakpointManagerImpl)XDebuggerManager.getInstance(project).getBreakpointManager();
  XLineBreakpointManager lineBreakpointManager = breakpointManager.getLineBreakpointManager();
  Document document = editor.getDocument();
  Collection<Range<Integer>> lineRanges = new ArrayList<Range<Integer>>();
  for (Caret caret : editor.getCaretModel().getAllCarets()) {
    lineRanges.add(new Range<Integer>(document.getLineNumber(caret.getSelectionStart()), document.getLineNumber(caret.getSelectionEnd())));
  }

  Collection<XLineBreakpointImpl> breakpoints = lineBreakpointManager.getDocumentBreakpoints(document);
  HashSet<XLineBreakpoint> res = new HashSet<XLineBreakpoint>();
  for (XLineBreakpointImpl breakpoint : breakpoints) {
    int line = breakpoint.getLine();
    for (Range<Integer> range : lineRanges) {
      if (range.isWithin(line)) {
        res.add(breakpoint);
      }
    }
  }
  return res;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ToggleBreakpointEnabledAction.java

示例3: customizeLayoutAttributeLookupElement

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private static CompletionResult customizeLayoutAttributeLookupElement(String localName,
                                                                      LookupElement lookupElement,
                                                                      CompletionResult result) {
  final String layoutPrefix = "layout_";

  if (!localName.startsWith(layoutPrefix)) {
    return result;
  }
  final String localSuffix = localName.substring(layoutPrefix.length());

  if (localSuffix.length() > 0) {
    final HashSet<String> lookupStrings = new HashSet<String>(lookupElement.getAllLookupStrings());
    lookupStrings.add(localSuffix);

    lookupElement = new LookupElementDecorator<LookupElement>(lookupElement) {
      @Override
      public Set<String> getAllLookupStrings() {
        return lookupStrings;
      }
    };
  }
  return result.withLookupElement(PrioritizedLookupElement.withPriority(lookupElement, 100.0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidCompletionContributor.java

示例4: getDepLibsPackages

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
@NotNull
public static Set<String> getDepLibsPackages(Module module) {
  final Set<String> result = new HashSet<String>();
  final HashSet<Module> visited = new HashSet<Module>();

  if (visited.add(module)) {
    for (AndroidFacet depFacet : getAllAndroidDependencies(module, true)) {
      final Manifest manifest = depFacet.getManifest();

      if (manifest != null) {
        String aPackage = manifest.getPackage().getValue();
        if (aPackage != null) {
          result.add(aPackage);
        }
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidUtils.java

示例5: isComponentUI

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private static boolean isComponentUI(PsiClass aClass, HashSet<PsiClass> classes) {
  while (aClass != null) {
    if (!classes.add(aClass)) return false;
    if ("javax.swing.plaf.ComponentUI".equals(aClass.getQualifiedName())) {
      return true;
    }
    aClass = aClass.getSuperClass();
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GenerateCreateUIAction.java

示例6: addRoot

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private void addRoot(TypeMigrationUsageInfo info, PsiType migrationType) {
  final HashSet<TypeMigrationUsageInfo> parents = new HashSet<TypeMigrationUsageInfo>();
  parents.add(info);
  final MigrationNode migrationNode =
      new MigrationNode(getProject(), info, migrationType, myLabeler, myBuilder, parents, new HashMap<TypeMigrationUsageInfo, Set<MigrationNode>>());

  myCachedChildren.add(migrationNode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MigrationRootNode.java

示例7: isOK

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
public boolean isOK(IntroduceVariableSettings settings) {
  String name = settings.getEnteredName();
  final PsiElement anchor;
  final boolean replaceAllOccurrences = settings.isReplaceAllOccurrences();
  if (replaceAllOccurrences) {
    anchor = myAnchorStatementIfAll;
  } else {
    anchor = myAnchorStatement;
  }
  final PsiElement scope = anchor.getParent();
  if(scope == null) return true;
  final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  final HashSet<PsiVariable> reportedVariables = new HashSet<PsiVariable>();
  JavaUnresolvableLocalCollisionDetector.CollidingVariableVisitor visitor = new JavaUnresolvableLocalCollisionDetector.CollidingVariableVisitor() {
    public void visitCollidingElement(PsiVariable collidingVariable) {
      if (!reportedVariables.contains(collidingVariable)) {
        reportedVariables.add(collidingVariable);
        String message = RefactoringBundle.message("introduced.variable.will.conflict.with.0", RefactoringUIUtil.getDescription(collidingVariable, true));
        conflicts.putValue(collidingVariable, message);
      }
    }
  };
  JavaUnresolvableLocalCollisionDetector.visitLocalsCollisions(anchor, name, scope, anchor, visitor);
  if (replaceAllOccurrences) {
    final PsiExpression[] occurences = myOccurenceManager.getOccurrences();
    for (PsiExpression occurence : occurences) {
      IntroduceVariableBase.checkInLoopCondition(occurence, conflicts);
    }
  } else {
    IntroduceVariableBase.checkInLoopCondition(myOccurenceManager.getMainOccurence(), conflicts);
  }

  if (conflicts.size() > 0) {
    return myIntroduceVariableBase.reportConflicts(conflicts, myProject, settings);
  } else {
    return true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:InputValidator.java

示例8: testRefactorTestMethod

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
public void testRefactorTestMethod() throws IOException {
  PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
  assertNotNull(psiClass);
  PsiMethod testMethod = psiClass.findMethodsByName("test", false)[0];
  JUnitConfiguration configuration = createConfiguration(testMethod);
  rename(testMethod, "test1");
  checkMethodName("test1", configuration);
  checkClassName("ATest", configuration);
  assertEquals("ATest.test1", configuration.getName());
  move(psiClass, "pkg");
  checkClassName("pkg.ATest", configuration);
  psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
  rename(psiClass, "TestClassName");
  assertEquals("TestClassName.test1", configuration.getName());
  psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());

  PsiClass otherTest = mySource.createClass("ATest", TEST_CODE);
  HashSet<PsiMember> members = new HashSet<PsiMember>();
  assertNotNull(psiClass);
  members.add(psiClass.findMethodsByName("test1", false)[0]);
  moveMembers(otherTest, members);
  psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
  checkMethodName("test1", configuration);
  checkClassName("ATest", configuration);
  assertEquals("ATest.test1", configuration.getName());

  assertNotNull(psiClass);
  PsiMethod otherMethod = psiClass.findMethodsByName("otherMethod", false)[0];
  rename(otherMethod, "newName");
  checkMethodName("test1", configuration);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ConfigurationRefactoringsTest.java

示例9: testParamTypeSubst

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
public void testParamTypeSubst() throws Exception {
  final PsiMethod method = getPrimaryMethod();
  final HashSet<PsiMethod> methods = new HashSet<>();
  for (PsiReference reference : ReferencesSearch.search(method)) {
    final PsiMethod psiMethod = PsiTreeUtil.getParentOfType(reference.getElement(), PsiMethod.class);
    if (psiMethod != null) {
      methods.add(psiMethod);
    }
  }
  parameterPropagationTest(method, methods, JavaPsiFacade.getElementFactory(getProject()).createTypeByFQClassName("T"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChangeSignaturePropagationTest.java

示例10: collectNonPhysicalMethodsToPropagate

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private static HashSet<PsiMethod> collectNonPhysicalMethodsToPropagate(PsiMethod method) {
  final HashSet<PsiMethod> methodsToPropagate = new HashSet<>();
  final PsiReference[] references =
    MethodReferencesSearch.search(method, GlobalSearchScope.allScope(getProject()), true).toArray(PsiReference.EMPTY_ARRAY);
  for (PsiReference reference : references) {
    final PsiElement element = reference.getElement();
    Assert.assertTrue(element instanceof PsiClass);
    PsiClass containingClass = (PsiClass)element;
    methodsToPropagate.add(JavaPsiFacade.getElementFactory(getProject()).createMethodFromText(containingClass.getName() + "(){}", containingClass));
  }
  return methodsToPropagate;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ChangeSignaturePropagationTest.java

示例11: collectDefaultConstructorsToPropagate

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private static HashSet<PsiMethod> collectDefaultConstructorsToPropagate(PsiMethod method) {
  final HashSet<PsiMethod> methodsToPropagate = new HashSet<>();
  for (PsiClass inheritor : ClassInheritorsSearch.search(method.getContainingClass())) {
    methodsToPropagate.add(inheritor.getConstructors()[0]);
  }
  return methodsToPropagate;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ChangeSignaturePropagationTest.java

示例12: getRootContextFile

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
@NotNull
public
BaseJspFile getRootContextFile(@NotNull BaseJspFile file) {
  BaseJspFile rootContext = file;
  HashSet<BaseJspFile> recursionPreventer = new HashSet<BaseJspFile>();
  do {
    recursionPreventer.add(rootContext);
    BaseJspFile context = getContextFile(rootContext);
    if (context == null || recursionPreventer.contains(context)) break;
    rootContext = context;
  }
  while (true);

  return rootContext;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JspContextManager.java

示例13: getOtherPositions

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
public Set<AbstractPosition> getOtherPositions() {
  HashSet<AbstractPosition> all = new HashSet<AbstractPosition>();
  all.add(BELOW);
  all.add(ABOVE);
  all.add(AT_RIGHT);
  all.add(AT_LEFT);

  all.remove(this);

  return all;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BalloonImpl.java

示例14: obtainCurrentScopes

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private void obtainCurrentScopes(final HashSet<String> scopes) {
  for (int i = 0; i < myRoot.getChildCount(); i++) {
    final MyNode node = (MyNode)myRoot.getChildAt(i);
    final NamedScope scope = (NamedScope)node.getConfigurable().getEditableObject();
    scopes.add(scope.getName());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ScopeChooserConfigurable.java

示例15: buildSubClassesMapImpl

import com.intellij.util.containers.HashSet; //导入方法依赖的package包/类
private void buildSubClassesMapImpl(PyClass aClass, HashSet<PyClass> visited) {
  visited.add(aClass);
  for (PyClass clazz : aClass.getSuperClasses()) {
    getSubclasses(clazz).add(aClass);
    if (!visited.contains(clazz)) {
      buildSubClassesMapImpl(clazz, visited);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PyMemberInfoStorage.java


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