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


Java TIntObjectHashMap类代码示例

本文整理汇总了Java中gnu.trove.TIntObjectHashMap的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectHashMap类的具体用法?Java TIntObjectHashMap怎么用?Java TIntObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TIntObjectHashMap类属于gnu.trove包,在下文中一共展示了TIntObjectHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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