本文整理匯總了Java中gnu.trove.THashSet類的典型用法代碼示例。如果您正苦於以下問題:Java THashSet類的具體用法?Java THashSet怎麽用?Java THashSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
THashSet類屬於gnu.trove包,在下文中一共展示了THashSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findAttributeValueElements
import gnu.trove.THashSet; //導入依賴的package包/類
public static Collection<XmlAttributeValue> findAttributeValueElements(XmlFile xmlFile,
String tagName,
String attributeName) {
Collection<XmlAttributeValue> psiElements = new THashSet<>();
XmlTag rootTag = xmlFile.getRootTag();
if (rootTag == null) {
return psiElements;
}
for (XmlTag tag: rootTag.findSubTags(tagName)) {
if (tag != null) {
XmlAttribute attribute = tag.getAttribute(attributeName);
if (attribute != null && attribute.getValueElement() != null) {
psiElements.add(attribute.getValueElement());
}
}
};
return psiElements;
}
示例2: getReferencesByElement
import gnu.trove.THashSet; //導入依賴的package包/類
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String parameterName = StringUtil.unquoteString(element.getText());
if (parameterName.isEmpty() || !(element instanceof XmlElement)) {
return PsiReference.EMPTY_ARRAY;
}
DiIndex diIndex = DiIndex.getInstance(element.getProject());
PhpClass phpClass = diIndex.getPhpClassOfArgument((XmlElement) element);
if (phpClass != null) {
Method constructor = phpClass.getConstructor();
if (constructor != null) {
Collection<Parameter> parameterList = new THashSet<>(Arrays.asList(constructor.getParameters()));
parameterList.removeIf(p -> !p.getName().contains(parameterName));
if (parameterList.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, parameterList)};
}
}
}
return PsiReference.EMPTY_ARRAY;
}
開發者ID:magento,項目名稱:magento2-phpstorm-plugin,代碼行數:26,代碼來源:PhpConstructorArgumentReferenceProvider.java
示例3: getAlreadyOpenedModules
import gnu.trove.THashSet; //導入依賴的package包/類
@NotNull
protected Set<HybrisModuleDescriptor> getAlreadyOpenedModules(@NotNull final Project project) {
Validate.notNull(project);
final HybrisModuleDescriptorFactory hybrisModuleDescriptorFactory = ServiceManager.getService(
HybrisModuleDescriptorFactory.class
);
final Set<HybrisModuleDescriptor> existingModules = new THashSet<HybrisModuleDescriptor>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
try {
final VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
if (!ArrayUtils.isEmpty(contentRoots)) {
existingModules.add(hybrisModuleDescriptorFactory.createDescriptor(
VfsUtil.virtualToIoFile(contentRoots[0]), this
));
}
} catch (HybrisConfigurationException e) {
LOG.error(e);
}
}
return existingModules;
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:27,代碼來源:DefaultHybrisProjectDescriptor.java
示例4: getSelectedEditors
import gnu.trove.THashSet; //導入依賴的package包/類
@NotNull
public FileEditor[] getSelectedEditors() {
List<FileEditor> editors = new ArrayList<FileEditor>();
Set<EditorWindow> windows = new THashSet<EditorWindow>(myWindows);
final EditorWindow currentWindow = getCurrentWindow();
if (currentWindow != null) {
windows.add(currentWindow);
}
for (final EditorWindow window : windows) {
final EditorWithProviderComposite composite = window.getSelectedEditor();
if (composite != null) {
editors.add(composite.getSelectedEditor());
}
}
return editors.toArray(new FileEditor[editors.size()]);
}
示例5: describeItems
import gnu.trove.THashSet; //導入依賴的package包/類
@Override
public void describeItems(LinkedHashMap<LookupElement, StringBuilder> map, ProcessingContext context) {
final THashSet<LookupElement> lifted = newIdentityTroveSet();
liftShorterElements(new ArrayList<LookupElement>(map.keySet()), lifted, context);
if (!lifted.isEmpty()) {
for (LookupElement element : map.keySet()) {
final StringBuilder builder = map.get(element);
if (builder.length() > 0) {
builder.append(", ");
}
builder.append(myName).append("=").append(lifted.contains(element));
}
}
super.describeItems(map, context);
}
示例6: equals
import gnu.trove.THashSet; //導入依賴的package包/類
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AllowedValues a2 = (AllowedValues)o;
if (canBeOred != a2.canBeOred) {
return false;
}
Set<PsiAnnotationMemberValue> v1 = new THashSet<PsiAnnotationMemberValue>(Arrays.asList(values));
Set<PsiAnnotationMemberValue> v2 = new THashSet<PsiAnnotationMemberValue>(Arrays.asList(a2.values));
if (v1.size() != v2.size()) {
return false;
}
for (PsiAnnotationMemberValue value : v1) {
for (PsiAnnotationMemberValue value2 : v2) {
if (same(value, value2, value.getManager())) {
v2.remove(value2);
break;
}
}
}
return v2.isEmpty();
}
示例7: prohibitResultCaching
import gnu.trove.THashSet; //導入依賴的package包/類
private Set<MyKey> prohibitResultCaching(MyKey realKey) {
reentrancyCount++;
if (!checkZero()) {
throw new AssertionError("zero1");
}
Set<MyKey> loop = new THashSet<MyKey>();
boolean inLoop = false;
for (Map.Entry<MyKey, Integer> entry: progressMap.entrySet()) {
if (inLoop) {
entry.setValue(reentrancyCount);
loop.add(entry.getKey());
}
else if (entry.getKey().equals(realKey)) {
inLoop = true;
}
}
if (!checkZero()) {
throw new AssertionError("zero2");
}
return loop;
}
示例8: addSlicedPotentials
import gnu.trove.THashSet; //導入依賴的package包/類
private static void addSlicedPotentials (FactorGraph fromMdl, FactorGraph toMdl, Assignment assn, Map toSlicedMap)
{
Set inputVars = new THashSet (Arrays.asList (assn.getVars ()));
Set remainingVars = new THashSet (fromMdl.variablesSet ());
remainingVars.removeAll (inputVars);
for (Iterator it = fromMdl.factorsIterator (); it.hasNext ();) {
Factor ptl = (Factor) it.next ();
Set theseVars = new THashSet (ptl.varSet ());
theseVars.retainAll (remainingVars);
Factor slicedPtl = ptl.slice (assn);
toMdl.addFactor (slicedPtl);
if (toSlicedMap != null) {
toSlicedMap.put (ptl, slicedPtl);
}
}
}
示例9: init
import gnu.trove.THashSet; //導入依賴的package包/類
@Override
public void init(PsiElement element){
myFile = (XmlFile) element.getContainingFile();
if (element instanceof XmlTag) {
myTag = (XmlTag)element;
} else {
final XmlDocument document = myFile.getDocument();
if (document != null) {
myTag = document.getRootTag();
}
}
if (myTag != null) {
myTargetNamespace = myTag.getAttributeValue("targetNamespace");
}
final THashSet<PsiFile> dependenciesSet = new THashSet<PsiFile>();
final Set<PsiFile> redefineProcessingSet = myRedefinedDescriptorsInProcessing.get();
if (redefineProcessingSet != null) {
dependenciesSet.addAll(redefineProcessingSet);
}
collectDependencies(myTag, myFile, dependenciesSet);
dependencies = ArrayUtil.toObjectArray(dependenciesSet);
}
示例10: getAndClearDeletedPaths
import gnu.trove.THashSet; //導入依賴的package包/類
public Set<String> getAndClearDeletedPaths() {
lockData();
try {
try {
final THashSet<String> _paths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
_paths.addAll(myDeletedPaths);
return _paths;
}
finally {
myDeletedPaths.clear();
}
}
finally {
unlockData();
}
}
示例11: getSuperClassesWithCache
import gnu.trove.THashSet; //導入依賴的package包/類
public static Map<String, PsiClass> getSuperClassesWithCache(@NotNull PsiClass aClass) {
Map<String, PsiClass> superClassNames = PARENT_CACHE_KEY.getCachedValue(aClass);
if (superClassNames == null) {
Set<PsiClass> superClasses = new THashSet<PsiClass>();
superClasses.add(aClass);
InheritanceUtil.getSuperClasses(aClass, superClasses, true);
superClassNames = new LinkedHashMap<String, PsiClass>();
for (PsiClass superClass : superClasses) {
superClassNames.put(superClass.getQualifiedName(), superClass);
}
superClassNames = PARENT_CACHE_KEY.putCachedValue(aClass, superClassNames);
}
return superClassNames;
}
示例12: childGroups
import gnu.trove.THashSet; //導入依賴的package包/類
public Collection<ModuleGroup> childGroups(ModifiableModuleModel model, Project project) {
final Module[] allModules;
if ( model != null ) {
allModules = model.getModules();
} else {
allModules = ModuleManager.getInstance(project).getModules();
}
Set<ModuleGroup> result = new THashSet<ModuleGroup>();
for (Module module : allModules) {
String[] group;
if ( model != null ) {
group = model.getModuleGroupPath(module);
} else {
group = ModuleManager.getInstance(project).getModuleGroupPath(module);
}
if (group == null) continue;
final String[] directChild = directChild(myGroupPath, group);
if (directChild != null) {
result.add(new ModuleGroup(directChild));
}
}
return result;
}
示例13: getAcceptableDescriptions
import gnu.trove.THashSet; //導入依賴的package包/類
@Nullable
public synchronized Set<OptionDescription> getAcceptableDescriptions(final String prefix) {
if (prefix == null) return null;
final String stemmedPrefix = PorterStemmerUtil.stem(prefix);
if (StringUtil.isEmptyOrSpaces(stemmedPrefix)) return null;
loadHugeFilesIfNecessary();
Set<OptionDescription> result = null;
for (Map.Entry<CharSequence, long[]> entry : myStorage.entrySet()) {
final long[] descriptions = entry.getValue();
final CharSequence option = entry.getKey();
if (!StringUtil.startsWith(option, prefix) && !StringUtil.startsWith(option, stemmedPrefix)) {
final String stemmedOption = PorterStemmerUtil.stem(option.toString());
if (stemmedOption != null && !stemmedOption.startsWith(prefix) && !stemmedOption.startsWith(stemmedPrefix)) {
continue;
}
}
if (result == null) {
result = new THashSet<OptionDescription>();
}
for (long description : descriptions) {
OptionDescription desc = unpack(description);
result.add(desc);
}
}
return result;
}
示例14: applyModifiersFromRegistry
import gnu.trove.THashSet; //導入依賴的package包/類
private void applyModifiersFromRegistry() {
Application app = ApplicationManager.getApplication();
if (app != null && app.isUnitTestMode()) {
return;
}
Set<String> vksSet = new THashSet<String>();
ContainerUtil.addAll(vksSet, getModifierRegistryValue().split(" "));
myModifierVks.clear();
int mask = getModifierMask(vksSet);
myModifierVks.addAll(getModifiersVKs(mask));
reassignActionShortcut(SWITCH_UP, mask, KeyEvent.VK_UP);
reassignActionShortcut(SWITCH_DOWN, mask, KeyEvent.VK_DOWN);
reassignActionShortcut(SWITCH_LEFT, mask, KeyEvent.VK_LEFT);
reassignActionShortcut(SWITCH_RIGHT, mask, KeyEvent.VK_RIGHT);
reassignActionShortcut(SWITCH_APPLY, mask, KeyEvent.VK_ENTER);
}
示例15: weigh
import gnu.trove.THashSet; //導入依賴的package包/類
@NotNull
@Override
public Comparable weigh(@NotNull LookupElement element) {
final Object object = element.getObject();
final String name = getLookupObjectName(object);
if (name != null) {
int max = 0;
final List<String> wordsNoDigits = NameUtil.nameToWordsLowerCase(truncDigits(name));
for (ExpectedTypeInfo myExpectedInfo : myExpectedTypes) {
String expectedName = ((ExpectedTypeInfoImpl)myExpectedInfo).getExpectedName();
if (expectedName != null) {
final THashSet<String> set = new THashSet<String>(NameUtil.nameToWordsLowerCase(truncDigits(expectedName)));
set.retainAll(wordsNoDigits);
max = Math.max(max, set.size());
}
}
return -max;
}
return 0;
}