本文整理汇总了Java中gnu.trove.TIntObjectHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectHashMap类的具体用法?Java TIntObjectHashMap怎么用?Java TIntObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TIntObjectHashMap类属于gnu.trove包,在下文中一共展示了TIntObjectHashMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getReachable
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private static LinkedHashSet<Integer> getReachable(final LinkedHashSet<Integer> fragmentInsns, final Instruction[] flow, TIntObjectHashMap<TIntHashSet> dfaResult, final int[] postorder) {
final LinkedHashSet<Integer> result = new LinkedHashSet<Integer>();
for (Instruction insn : flow) {
if (insn instanceof ReadWriteVariableInstruction &&
!((ReadWriteVariableInstruction) insn).isWrite()) {
final int ref = insn.num();
TIntHashSet defs = dfaResult.get(ref);
defs.forEach(new TIntProcedure() {
public boolean execute(int def) {
if (fragmentInsns.contains(def)) {
if (!fragmentInsns.contains(ref) || postorder[ref] < postorder[def]) {
result.add(ref);
return false;
}
}
return true;
}
});
}
}
return result;
}
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:24,代码来源:ReachingDefinitionsCollector.java
示例2: fun
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public void fun(TIntObjectHashMap<TIntHashSet> m, Instruction instruction) {
if (instruction instanceof ReadWriteVariableInstruction) {
final ReadWriteVariableInstruction varInsn = (ReadWriteVariableInstruction) instruction;
final String name = varInsn.getVariableName();
if (name == null) return;
assert myVarToIndexMap.containsKey(name);
final int num = myVarToIndexMap.get(name);
if (varInsn.isWrite()) {
TIntHashSet defs = m.get(num);
if (defs == null) {
defs = new TIntHashSet();
m.put(num, defs);
} else defs.clear();
defs.add(varInsn.num());
}
}
}
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:18,代码来源:ReachingDefinitionsDfaInstance.java
示例3: initForGraph
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
protected void initForGraph (FactorGraph m)
{
super.initForGraph (m);
int numNodes = m.numVariables ();
factorTouched = new TIntObjectHashMap (numNodes);
hasConverged = false;
if (factory == null) {
factory = new AlmostRandomTreeFactory ();
}
if (terminator == null) {
terminator = new DefaultConvergenceTerminator ();
} else {
terminator.reset ();
}
}
开发者ID:mimno,项目名称:GRMM,代码行数:19,代码来源:TRP.java
示例4: readObject
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.readInt (); // version =
int N1 = in.readInt ();
backing = new TIntObjectHashMap (N1);
for (int i = 0; i < N1; i++) {
int k1 = in.readInt ();
int N2 = in.readInt ();
for (int j = 0; j < N2; j++) {
int k2 = in.readInt ();
Object value = in.readObject ();
put (k1, k2, value);
}
}
}
开发者ID:mimno,项目名称:GRMM,代码行数:18,代码来源:MIntInt2ObjectMap.java
示例5: patchIcon
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public Icon patchIcon(Icon baseIcon, VirtualFile file, int flags, Project project) {
if (project == null) return baseIcon;
final TIntObjectHashMap<Icon> icons = file.getUserData(ICON_KEY);
if (icons != null) {
final Icon icon = icons.get(flags);
if (icon != null) {
return icon;
}
}
final PsiFile element = PsiManager.getInstance(project).findFile(file);
if (element != null) {
if (XsltSupport.isXsltFile(element)) {
return cacheIcon(file, flags, icons, XsltSupport.createXsltIcon(baseIcon));
}
}
return baseIcon;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XsltIconProvider.java
示例6: save
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public void save(@NotNull final DataOutput dataOutput, TIntObjectHashMap<TIntArrayList> classAndMethodsMap)
throws IOException {
DataInputOutputUtil.writeINT(dataOutput, classAndMethodsMap.size());
final int[] classNameIds = classAndMethodsMap.keys();
Arrays.sort(classNameIds);
int prevClassNameId = 0;
for(int classNameId:classNameIds) {
DataInputOutputUtil.writeINT(dataOutput, classNameId - prevClassNameId);
TIntArrayList value = classAndMethodsMap.get(classNameId);
DataInputOutputUtil.writeINT(dataOutput, value.size());
final int[] methodNameIds = value.toNativeArray();
Arrays.sort(methodNameIds);
int prevMethodNameId = 0;
for (int methodNameId : methodNameIds) {
DataInputOutputUtil.writeINT(dataOutput, methodNameId - prevMethodNameId);
prevMethodNameId = methodNameId;
}
prevClassNameId = classNameId;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TestDiscoveryIndex.java
示例7: read
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public TIntObjectHashMap<TIntArrayList> read(@NotNull DataInput dataInput) throws IOException {
int numberOfClasses = DataInputOutputUtil.readINT(dataInput);
TIntObjectHashMap<TIntArrayList> result = new TIntObjectHashMap<TIntArrayList>();
int prevClassNameId = 0;
while (numberOfClasses-- > 0) {
int classNameId = DataInputOutputUtil.readINT(dataInput) + prevClassNameId;
int numberOfMethods = DataInputOutputUtil.readINT(dataInput);
TIntArrayList methodNameIds = new TIntArrayList(numberOfMethods);
int prevMethodNameId = 0;
while (numberOfMethods-- > 0) {
final int methodNameId = DataInputOutputUtil.readINT(dataInput) + prevMethodNameId;
methodNameIds.add(methodNameId);
prevMethodNameId = methodNameId;
}
result.put(classNameId, methodNameIds);
prevClassNameId = classNameId;
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TestDiscoveryIndex.java
示例8: checkFileHeader
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
static ProblemDescriptor checkFileHeader(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean onTheFly) {
TIntObjectHashMap<String> offsetToProperty = new TIntObjectHashMap<String>();
FileTemplate defaultTemplate = FileTemplateManager.getInstance(file.getProject()).getDefaultTemplate(FileTemplateManager.FILE_HEADER_TEMPLATE_NAME);
Pattern pattern = getTemplatePattern(defaultTemplate, file.getProject(), offsetToProperty);
Matcher matcher = pattern.matcher(file.getViewProvider().getContents());
if (!matcher.matches()) {
return null;
}
PsiComment element = PsiTreeUtil.findElementOfClassAtRange(file, matcher.start(1), matcher.end(1), PsiComment.class);
if (element == null) {
return null;
}
LocalQuickFix[] fixes = createQuickFix(matcher, offsetToProperty, file.getProject());
String description = InspectionsBundle.message("default.file.template.description");
return manager.createProblemDescriptor(element, description, onTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FileHeaderChecker.java
示例9: BindingImpl
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
BindingImpl(final int index, final PsiType type) {
myBindings = new TIntObjectHashMap<PsiType>();
myCyclic = type instanceof PsiTypeVariable;
myBindings.put(index, type);
if (type instanceof Bottom) {
final Set<PsiTypeVariable> cluster = myFactory.getClusterOf(index);
if (cluster != null) {
for (PsiTypeVariable var : cluster) {
myBindings.put(var.getIndex(), type);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BindingFactory.java
示例10: fillMethodParameters
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public static String fillMethodParameters(final PsiMethod method, @Nullable final TIntObjectHashMap<SubLookupElement> replaceElements) {
final TIntObjectHashMap<SubLookupElement> notNullReplaceElements = replaceElements == null ?
new TIntObjectHashMap<SubLookupElement>(0) :
replaceElements;
final PsiParameter[] parameters = method.getParameterList().getParameters();
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < parameters.length; i++) {
if (i != 0) {
sb.append(", ");
}
final PsiParameter parameter = parameters[i];
final SubLookupElement replaceElement = notNullReplaceElements.get(i);
if (replaceElement != null) {
sb.append(replaceElement.getInsertString());
} else {
sb.append(parameter.getName());
}
}
return sb.toString();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ChainCompletionLookupElementUtil.java
示例11: ContextRelevantStaticMethod
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public ContextRelevantStaticMethod(final PsiMethod psiMethod, @Nullable final TIntObjectHashMap<PsiVariable> parameters) {
this.psiMethod = psiMethod;
if (parameters == null) {
this.parameters = null;
} else {
this.parameters = new TIntObjectHashMap<SubLookupElement>(parameters.size());
parameters.forEachEntry(new TIntObjectProcedure<PsiVariable>() {
@SuppressWarnings("ConstantConditions")
@Override
public boolean execute(final int pos, final PsiVariable var) {
ContextRelevantStaticMethod.this.parameters.put(pos, new VariableSubLookupElement(var));
return true;
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ContextRelevantStaticMethod.java
示例12: runTest
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private static void runTest(int nameCount, String name) throws InterruptedException, ExecutionException {
System.out.println("----- " + name + " ------ name count: "+nameCount);
TIntObjectHashMap<CharSequence> map = generateNames(nameCount);
final int[] ids = map.keys();
checkNames(map, ids);
warmUp(ids);
measureAverageTime(ids, 1, LONG_RANDOM_ACCESS);
measureAverageTime(ids, 4, LONG_RANDOM_ACCESS);
measureAverageTime(ids, 1, LONG_RANDOM_ACCESS_WITH_GET_PATH);
measureAverageTime(ids, 4, LONG_RANDOM_ACCESS_WITH_GET_PATH);
measureAverageTime(ids, 1, LINEAR_SCAN_AND_RANDOM_ACCESS_WITH_GET_PATH);
measureAverageTime(ids, 4, LINEAR_SCAN_AND_RANDOM_ACCESS_WITH_GET_PATH);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileNameCacheMicroBenchmark.java
示例13: testKObjectMapCloneDoesNotDependOnTheSource
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public void testKObjectMapCloneDoesNotDependOnTheSource() {
TIntObjectHashMap<int[]> map = new TIntObjectHashMap<int[]>();
map.put(0, new int[2]);
map.put(1, new int[2]);
TIntObjectHashMap<int[]> clone = map.clone();
assertEquals(clone.size(), 2);
int[] keys = clone.keys();
assertEquals(keys.length, 2);
assertEquals(ContainerUtil.newHashSet(0,1), ContainerUtil.newHashSet(keys[0],keys[1]));
map.clear();
assertEquals(clone.size(), 2);
keys = clone.keys();
assertEquals(keys.length, 2);
assertEquals(ContainerUtil.newHashSet(0,1), ContainerUtil.newHashSet(keys[0],keys[1]));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TroveTest.java
示例14: checkConsistency
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private void checkConsistency(ScheduledPass pass, TIntObjectHashMap<Pair<ScheduledPass, Integer>> id2Visits) {
for (ScheduledPass succ : ContainerUtil.concat(pass.mySuccessorsOnCompletion, pass.mySuccessorsOnSubmit)) {
int succId = succ.myPass.getId();
Pair<ScheduledPass, Integer> succPair = id2Visits.get(succId);
if (succPair == null) {
succPair = Pair.create(succ, succ.myRunningPredecessorsCount.get());
id2Visits.put(succId, succPair);
}
int newPred = succPair.second - 1;
id2Visits.put(succId, Pair.create(succ, newPred));
assert newPred >= 0;
if (newPred == 0) {
checkConsistency(succ, id2Visits);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PassExecutorService.java
示例15: DetectedFrameworksData
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public DetectedFrameworksData(Project project) {
myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>();
File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() +
File.separator + "files");
myNewFiles = new TIntObjectHashMap<TIntHashSet>();
try {
myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
}
catch (IOException e) {
LOG.info(e);
PersistentHashMap.deleteFilesStartingWith(file);
try {
myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
}
catch (IOException e1) {
LOG.error(e1);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DetectedFrameworksData.java
示例16: getProfile
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
@Nullable
public static DuplicatesProfile getProfile(@NotNull DupInfo dupInfo, int index) {
TIntObjectHashMap<DuplicatesProfile> patternCache = ourProfileCache.get(dupInfo);
if (patternCache == null) {
patternCache = new TIntObjectHashMap<DuplicatesProfile>();
ourProfileCache.put(dupInfo, patternCache);
}
DuplicatesProfile result = patternCache.get(index);
if (result == null) {
DuplicatesProfile[] profiles = Extensions.getExtensions(DuplicatesProfile.EP_NAME);
DuplicatesProfile theProfile = null;
for (DuplicatesProfile profile : profiles) {
if (profile.isMyDuplicate(dupInfo, index)) {
theProfile = profile;
break;
}
}
result = theProfile == null ? NULL_PROFILE : theProfile;
patternCache.put(index, result);
}
return result == NULL_PROFILE ? null : result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DuplicatesProfileCache.java
示例17: loadAndParseRClass
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
public void loadAndParseRClass(@NotNull String className) throws ClassNotFoundException, InconvertibleClassError {
Class<?> aClass = myLoadedClasses.get(className);
if (aClass == null) {
aClass = getModuleClassLoader().loadClass(className);
if (aClass != null) {
myLoadedClasses.put(className, aClass);
myLogger.setHasLoadedClasses(true);
}
}
if (aClass != null) {
final Map<ResourceType, TObjectIntHashMap<String>> res2id =
new EnumMap<ResourceType, TObjectIntHashMap<String>>(ResourceType.class);
final TIntObjectHashMap<Pair<ResourceType, String>> id2res = new TIntObjectHashMap<Pair<ResourceType, String>>();
final Map<IntArrayWrapper, String> styleableId2res = new HashMap<IntArrayWrapper, String>();
if (parseClass(aClass, id2res, styleableId2res, res2id)) {
AppResourceRepository appResources = AppResourceRepository.getAppResources(myModule, true);
if (appResources != null) {
appResources.setCompiledResources(id2res, styleableId2res, res2id);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ViewLoader.java
示例18: getIdMap
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private TIntObjectHashMap<String> getIdMap() {
AndroidFacet facet = null;
for (Module m : ModuleManager.getInstance(myProject).getModules()) {
facet = AndroidFacet.getInstance(m);
if (facet != null) {
break;
}
}
AndroidSdkData sdkData = facet == null ? null : facet.getSdkData();
if (sdkData == null) {
return null;
}
IAndroidTarget[] targets = sdkData.getTargets();
if (targets.length == 0) {
return null;
}
return sdkData.getTargetData(targets[targets.length - 1]).getPublicIdMap();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectResourceIdResolver.java
示例19: fillMap
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
private static TIntObjectHashMap<String> fillMap(final Class<GridConstraints> aClass, @NonNls final String prefix) {
final TIntObjectHashMap<String> map = new TIntObjectHashMap<String>();
final Field[] fields = aClass.getFields();
for (final Field field : fields) {
if ((field.getModifiers() & Modifier.STATIC) != 0 && field.getName().startsWith(prefix)) {
field.setAccessible(true);
try {
final int value = field.getInt(aClass);
map.put(value, aClass.getName() + '.' + field.getName());
}
catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GridLayoutSourceGenerator.java
示例20: setUp
import gnu.trove.TIntObjectHashMap; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myNestedFormLoader = new MyNestedFormLoader();
final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);
java.util.List<URL> cp = new ArrayList<URL>();
appendPath(cp, JBTabbedPane.class);
appendPath(cp, TIntObjectHashMap.class);
appendPath(cp, UIUtil.class);
appendPath(cp, SystemInfoRt.class);
appendPath(cp, ApplicationManager.class);
appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
appendPath(cp, GridLayoutManager.class); // forms_rt
appendPath(cp, DataProvider.class);
myClassFinder = new MyClassFinder(
new URL[] {new File(swingPath).toURI().toURL()},
cp.toArray(new URL[cp.size()])
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AsmCodeGeneratorTest.java
注:本文中的gnu.trove.TIntObjectHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论