本文整理匯總了Java中gnu.trove.THashMap類的典型用法代碼示例。如果您正苦於以下問題:Java THashMap類的具體用法?Java THashMap怎麽用?Java THashMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
THashMap類屬於gnu.trove包,在下文中一共展示了THashMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getIndexer
import gnu.trove.THashMap; //導入依賴的package包/類
@NotNull
@Override
public DataIndexer<String, StubControllerAction, FileContent> getIndexer() {
return inputData -> {
Map<String, StubControllerAction> map = new THashMap<>();
String extensionKeyFromFile = ExtensionUtility.findExtensionKeyFromFile(inputData.getFile());
if (null != extensionKeyFromFile) {
ControllerActionRecursiveVisitor visitor = new ControllerActionRecursiveVisitor();
visitor.visitFile(inputData.getPsiFile());
Map<String, StubControllerAction> stringStubControllerActionMap = visitor.getMap();
stringStubControllerActionMap.forEach((x, y) -> y.setExtensionName(extensionKeyFromFile));
map.putAll(stringStubControllerActionMap);
}
return map;
};
}
示例2: getIndexer
import gnu.trove.THashMap; //導入依賴的package包/類
@NotNull
@Override
public DataIndexer<String, RouteStub, FileContent> getIndexer() {
return inputData -> {
Map<String, RouteStub> map = new THashMap<>();
if (inputData.getFile().getName().equals("ext_tables.php")) {
ExtTablesRouteVisitor extTablesRouteVisitor = new ExtTablesRouteVisitor();
extTablesRouteVisitor.visitFile(inputData.getPsiFile());
for (RouteStub routeStub : extTablesRouteVisitor.getRouteStubs()) {
if (routeStub != null && routeStub.getName() != null) {
map.put(routeStub.getName(), routeStub);
}
}
} else {
for (RouteStub route : RouteHelper.routesFromRoutesPhp(inputData.getPsiFile())) {
map.put(route.getName(), route);
}
}
return map;
};
}
示例3: getIconDefinitionByIdentifier
import gnu.trove.THashMap; //導入依賴的package包/類
public static Map<VirtualFile, IconStub> getIconDefinitionByIdentifier(@NotNull Project project, String iconIdentifier) {
Set<String> identifiers = new HashSet<>();
identifiers.add(iconIdentifier);
Map<VirtualFile, IconStub> icons = new THashMap<>();
FileBasedIndex.getInstance().getFilesWithKey(KEY, identifiers, virtualFile -> {
FileBasedIndex.getInstance().processValues(KEY, iconIdentifier, virtualFile, (file, value) -> {
icons.put(file, value);
return true;
}, GlobalSearchScope.allScope(project));
return true;
}, GlobalSearchScope.allScope(project));
return icons;
}
示例4: getIndexer
import gnu.trove.THashMap; //導入依賴的package包/類
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
return virtualFile -> {
final Map<String, String> items = new THashMap<>();
VirtualFile file = virtualFile.getFile();
VirtualFile parentDirectory = file.getParent();
if (parentDirectory != null) {
VirtualFile ancestorDirectory = parentDirectory.getParent();
if (ancestorDirectory != null && ancestorDirectory.isDirectory()) {
String ancestorDirectoryName = ancestorDirectory.getName();
if (ancestorDirectoryName.equals("sysext") || ancestorDirectoryName.equals("ext")) {
String path = file.getPath();
items.put(parentDirectory.getName(), path);
}
// handle the case where the extension name can *not* be inferred from the directory name
}
}
return items;
};
}
示例5: getIndexer
import gnu.trove.THashMap; //導入依賴的package包/類
@NotNull
@Override
public DataIndexer<String, Set<String>, FileContent> getIndexer() {
return inputData -> {
final Map<String, Set<String>> map = new THashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (psiFile instanceof PhpFile) {
Map<String, ArrayList<TYPO3ServiceDefinition>> serviceMap = new THashMap<>();
psiFile.accept(new CoreServiceDefinitionParserVisitor(serviceMap));
serviceMap.forEach((serviceId, definitionList) -> {
Set<String> implementations = new HashSet<>();
definitionList.forEach(typo3ServiceDefinition -> implementations.add(typo3ServiceDefinition.getClassName()));
map.put(serviceId, implementations);
});
}
return map;
};
}
示例6: factorDuplicates
import gnu.trove.THashMap; //導入依賴的package包/類
public static <D extends PsiElement> Map<D, List<D>> factorDuplicates(D[] elements, TObjectHashingStrategy<D> strategy) {
if (elements == null || elements.length == 0) return Collections.emptyMap();
THashMap<D, List<D>> map = new THashMap<D, List<D>>(strategy);
for (D element : elements) {
List<D> list = map.get(element);
if (list == null) {
list = new ArrayList<D>();
}
list.add(element);
map.put(element, list);
}
return map;
}
示例7: EdgesIterator
import gnu.trove.THashMap; //導入依賴的package包/類
public EdgesIterator (ACRF.UnrolledGraph acrf, Assignment observed)
{
this.graph = acrf;
this.observed = observed;
cliquesByEdge = new THashMap();
for (Iterator it = acrf.unrolledVarSetIterator (); it.hasNext();) {
ACRF.UnrolledVarSet clique = (ACRF.UnrolledVarSet) it.next ();
for (int v1idx = 0; v1idx < clique.size(); v1idx++) {
Variable v1 = clique.get(v1idx);
List adjlist = graph.allFactorsContaining (v1);
for (Iterator factorIt = adjlist.iterator(); factorIt.hasNext();) {
Factor factor = (Factor) factorIt.next ();
if (!cliquesByEdge.containsKey (factor)) { cliquesByEdge.put (factor, new ArrayList()); }
List l = (List) cliquesByEdge.get (factor);
if (!l.contains (clique)) { l.add (clique); }
}
}
}
cursor = cliquesByEdge.keySet().iterator ();
}
示例8: mapCopy
import gnu.trove.THashMap; //導入依賴的package包/類
private THashMap<Value, Object> mapCopy(final THashMap<Value, Object> map) {
if (map == null) {
return null;
}
final THashMap<Value, Object> cloned = map.clone();
cloned.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
@Override
public boolean execute(Value key, Object val) {
if (val instanceof ChangeBufferingList) {
cloned.put(key, ((ChangeBufferingList)val).clone());
}
return true;
}
});
return cloned;
}
示例9: BuildTargetRegistryImpl
import gnu.trove.THashMap; //導入依賴的package包/類
public BuildTargetRegistryImpl(JpsModel model) {
myTargets = new THashMap<BuildTargetType<?>, List<? extends BuildTarget<?>>>();
myModuleBasedTargets = new THashMap<JpsModule, List<ModuleBasedTarget>>();
List<List<? extends BuildTarget<?>>> targetsByType = new ArrayList<List<? extends BuildTarget<?>>>();
for (BuildTargetType<?> type : TargetTypeRegistry.getInstance().getTargetTypes()) {
List<? extends BuildTarget<?>> targets = type.computeAllTargets(model);
myTargets.put(type, targets);
targetsByType.add(targets);
for (BuildTarget<?> target : targets) {
if (target instanceof ModuleBasedTarget) {
final ModuleBasedTarget t = (ModuleBasedTarget)target;
final JpsModule module = t.getModule();
List<ModuleBasedTarget> list = myModuleBasedTargets.get(module);
if (list == null) {
list = new ArrayList<ModuleBasedTarget>();
myModuleBasedTargets.put(module, list);
}
list.add(t);
}
}
}
myAllTargets = Collections.unmodifiableList(ContainerUtil.concat(targetsByType));
}
示例10: processResults
import gnu.trove.THashMap; //導入依賴的package包/類
protected Collection<MavenArtifactSearchResult> processResults(Set<MavenArtifactInfo> infos, String pattern, int maxResult) {
Map<String, MavenArtifactSearchResult> result = new THashMap<String, MavenArtifactSearchResult>();
for (MavenArtifactInfo each : infos) {
if (!StringUtil.isEmptyOrSpaces(each.getClassifier())) {
continue; // todo skip for now
}
String key = makeKey(each);
MavenArtifactSearchResult searchResult = result.get(key);
if (searchResult == null) {
searchResult = new MavenArtifactSearchResult();
result.put(key, searchResult);
}
searchResult.versions.add(each);
}
return result.values();
}
示例11: invoke
import gnu.trove.THashMap; //導入依賴的package包/類
@Override
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
Map<XmlTag,DomElement> map = new THashMap<XmlTag, DomElement>();
for (final CollectionChildDescriptionImpl qname : myQnames) {
for (DomElement element : handler.getCollectionChildren(qname)) {
map.put(element.getXmlTag(), element);
}
}
final XmlTag tag = handler.getXmlTag();
if (tag == null) return Collections.emptyList();
final List<DomElement> list = new ArrayList<DomElement>();
for (final XmlTag subTag : tag.getSubTags()) {
ContainerUtil.addIfNotNull(map.get(subTag), list);
}
return list;
}
示例12: findScopesWithItemRef
import gnu.trove.THashMap; //導入依賴的package包/類
private static Map<String, XmlTag> findScopesWithItemRef(@Nullable PsiFile file) {
if (!(file instanceof XmlFile)) return Collections.emptyMap();
final Map<String, XmlTag> result = new THashMap<String, XmlTag>();
file.accept(new XmlRecursiveElementVisitor() {
@Override
public void visitXmlTag(final XmlTag tag) {
super.visitXmlTag(tag);
XmlAttribute refAttr = tag.getAttribute(ITEM_REF);
if (refAttr != null && tag.getAttribute(ITEM_SCOPE) != null) {
getReferencesForAttributeValue(refAttr.getValueElement(), new PairFunction<String, Integer, PsiReference>() {
@Nullable
@Override
public PsiReference fun(String t, Integer v) {
result.put(t, tag);
return null;
}
});
}
}
});
return result;
}
示例13: setupEnvironment
import gnu.trove.THashMap; //導入依賴的package包/類
protected void setupEnvironment(@NotNull Map<String, String> environment) {
environment.clear();
if (myParentEnvironmentType != ParentEnvironmentType.NONE) {
environment.putAll(getParentEnvironment());
}
if (!myEnvParams.isEmpty()) {
if (SystemInfo.isWindows) {
THashMap<String, String> envVars = new THashMap<String, String>(CaseInsensitiveStringHashingStrategy.INSTANCE);
envVars.putAll(environment);
envVars.putAll(myEnvParams);
environment.clear();
environment.putAll(envVars);
}
else {
environment.putAll(myEnvParams);
}
}
}
示例14: putUserData
import gnu.trove.THashMap; //導入依賴的package包/類
@Override
public <T> void putUserData(@NotNull Key<T> key, T value){
synchronized(this){
if (myUserMap == null){
if (value == null) return;
myUserMap = new THashMap<Key, Object>();
}
if (value != null){
//noinspection unchecked
myUserMap.put(key, value);
}
else{
myUserMap.remove(key);
if (myUserMap.isEmpty()){
myUserMap = null;
}
}
}
}
示例15: enableInspectionTool
import gnu.trove.THashMap; //導入依賴的package包/類
public static void enableInspectionTool(@NotNull final Project project, @NotNull final InspectionToolWrapper toolWrapper) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final String shortName = toolWrapper.getShortName();
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null) {
HighlightDisplayKey.register(shortName, toolWrapper.getDisplayName(), toolWrapper.getID());
}
InspectionProfileImpl.initAndDo(new Computable() {
@Override
public Object compute() {
InspectionProfileImpl impl = (InspectionProfileImpl)profile;
InspectionToolWrapper existingWrapper = impl.getInspectionTool(shortName, project);
if (existingWrapper == null || existingWrapper.isInitialized() != toolWrapper.isInitialized() || toolWrapper.isInitialized() && toolWrapper.getTool() != existingWrapper.getTool()) {
impl.addTool(project, toolWrapper, new THashMap<String, List<String>>());
}
impl.enableTool(shortName, project);
return null;
}
});
}