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


Java TIntObjectHashMap.put方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: addFileToProcess

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private static void addFileToProcess(TIntObjectHashMap<Set<String>> filesToProcess,
                                     final int rootIndex,
                                     final String path,
                                     Collection<String> deletedFiles) {
  if (deletedFiles.contains(path)) {
    return;
  }
  Set<String> paths = filesToProcess.get(rootIndex);
  if (paths == null) {
    paths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
    filesToProcess.put(rootIndex, paths);
  }
  paths.add(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:IncArtifactBuilder.java

示例6: loadClassAndMethodsMap

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
@NotNull
private static TIntObjectHashMap<TIntArrayList> loadClassAndMethodsMap(File file, Holder holder) throws IOException {
  DataInputStream inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file), 64 * 1024));
  byte[] buffer = IOUtil.allocReadWriteUTFBuffer();

  try {
    int numberOfClasses = DataInputOutputUtil.readINT(inputStream);
    TIntObjectHashMap<TIntArrayList> classData = new TIntObjectHashMap<TIntArrayList>(numberOfClasses);
    while (numberOfClasses-- > 0) {
      String classQName = IOUtil.readUTFFast(buffer, inputStream);
      int classId = holder.myClassEnumeratorCache.enumerate(classQName);
      int numberOfMethods = DataInputOutputUtil.readINT(inputStream);
      TIntArrayList methodsList = new TIntArrayList(numberOfMethods);

      while (numberOfMethods-- > 0) {
        String methodName = IOUtil.readUTFFast(buffer, inputStream);
        methodsList.add(holder.myMethodEnumeratorCache.enumerate(methodName));
      }

      classData.put(classId, methodsList);
    }
    return classData;
  }
  finally {
    inputStream.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:TestDiscoveryIndex.java

示例7: templateToRegex

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private static String templateToRegex(String text, TIntObjectHashMap<String> offsetToProperty, Project project) {
  List<Object> properties = ContainerUtil.newArrayList(FileTemplateManager.getInstance(project).getDefaultProperties().keySet());
  properties.add("PACKAGE_NAME");

  String regex = escapeRegexChars(text);
  // first group is a whole file header
  int groupNumber = 1;
  for (Object property : properties) {
    String name = property.toString();
    String escaped = escapeRegexChars("${" + name + "}");
    boolean first = true;
    for (int i = regex.indexOf(escaped); i != -1 && i < regex.length(); i = regex.indexOf(escaped, i + 1)) {
      String replacement = first ? "([^\\n]*)" : "\\" + groupNumber;
      int delta = escaped.length() - replacement.length();
      int[] offs = offsetToProperty.keys();
      for (int off : offs) {
        if (off > i) {
          String prop = offsetToProperty.remove(off);
          offsetToProperty.put(off - delta, prop);
        }
      }
      offsetToProperty.put(i, name);
      regex = regex.substring(0, i) + replacement + regex.substring(i + escaped.length());
      if (first) {
        groupNumber++;
        first = false;
      }
    }
  }
  return regex;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:FileHeaderChecker.java

示例8: prepareRefsToIndicesMap

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
@NotNull
private TIntObjectHashMap<SmartList<VcsRef>> prepareRefsToIndicesMap(@NotNull Collection<VcsRef> refs) {
  TIntObjectHashMap<SmartList<VcsRef>> map = new TIntObjectHashMap<SmartList<VcsRef>>();
  for (VcsRef ref : refs) {
    int index = myHashMap.getCommitIndex(ref.getCommitHash());
    SmartList<VcsRef> list = map.get(index);
    if (list == null) map.put(index, list = new SmartList<VcsRef>());
    list.add(ref);
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RefsModel.java

示例9: put

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
public static void put(@NotNull UserDataHolder holder, Icon icon, int flags) {
  TIntObjectHashMap<Icon> map = holder.getUserData(LAST_COMPUTED_ICON);
  if (map == null) {
    map = ((UserDataHolderEx)holder).putUserDataIfAbsent(LAST_COMPUTED_ICON, new TIntObjectHashMap<Icon>());
  }
  map.put(flags, icon);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:Iconable.java

示例10: generateNames

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
@NotNull
private static TIntObjectHashMap<CharSequence> generateNames(int nameCount) {
  Random random = new Random();
  TIntObjectHashMap<CharSequence> map = new TIntObjectHashMap<CharSequence>();
  for (int i = 0; i < nameCount; i++) {
    String name = "some_name_" + random.nextInt() + StringUtil.repeat("a", random.nextInt(10));
    int id = FileNameCache.storeName(name);
    map.put(id, name);
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileNameCacheMicroBenchmark.java

示例11: buildTextRangeToInfoMap

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private static TIntObjectHashMap<LeafBlockWrapper> buildTextRangeToInfoMap(final LeafBlockWrapper first) {
  final TIntObjectHashMap<LeafBlockWrapper> result = new TIntObjectHashMap<LeafBlockWrapper>();
  LeafBlockWrapper current = first;
  while (current != null) {
    result.put(current.getStartOffset(), current);
    current = current.getNextBlock();
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FormatProcessor.java

示例12: cacheIcon

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private static Icon cacheIcon(VirtualFile file, int flags, TIntObjectHashMap<Icon> icons, Icon icon) {
  if (icons == null) {
    file.putUserData(ICON_KEY, icons = new TIntObjectHashMap<Icon>(3));
  }
  icons.put(flags, icon);
  return icon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:XsltIconProvider.java

示例13: getPotentialDefinitionsOfLocalIDBefore

import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
public List<SetLocal> getPotentialDefinitionsOfLocalIDBefore(Instruction instruction, int localID) {

		TIntObjectHashMap<List<SetLocal>> definitionsByInstruction = definitionsByInstructionIndexLocalID.get(localID);
		if(definitionsByInstruction == null) {
			definitionsByInstruction = new TIntObjectHashMap<List<SetLocal>>(4);
			definitionsByInstructionIndexLocalID.put(localID, definitionsByInstruction);
		}
		
		List<SetLocal> potentialDefs = definitionsByInstruction.get(instruction.getIndex());
		if(potentialDefs == null) {

			potentialDefs = new LinkedList<SetLocal>();
			definitionsByInstruction.put(instruction.getIndex(), potentialDefs);

			gnu.trove.TIntHashSet visited = new gnu.trove.TIntHashSet(64);

			Vector<Instruction> instructionsToAnalyze = new Vector<Instruction>(3);
			instructionsToAnalyze.add(instruction);

			while(!instructionsToAnalyze.isEmpty()) {

				Instruction instructionToAnalyze = instructionsToAnalyze.remove(instructionsToAnalyze.size() - 1);

				if(!visited.contains(instructionToAnalyze.getIndex())) {

					visited.add(instructionToAnalyze.getIndex());

					for(Instruction predecessor : instructionToAnalyze.getOrderedPredecessors())
						if(predecessor instanceof SetLocal && ((SetLocal)predecessor).getLocalID() == localID)
							potentialDefs.add((SetLocal)predecessor);
						else 
							instructionsToAnalyze.add(predecessor);
					
				}
				
			}
			
		}
			
		return potentialDefs;
		
	}
 
开发者ID:andyjko,项目名称:whyline,代码行数:43,代码来源:LocalDependencies.java


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