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


Java TObjectIntHashMap.put方法代码示例

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


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

示例1: readObject

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException
  {
//    in.defaultReadObject ();
    int version = in.readInt ();  // version

    int numVariables = in.readInt ();
    var2idx = new TObjectIntHashMap (numVariables);
    for (int vi = 0; vi < numVariables; vi++) {
      Variable var = (Variable) in.readObject ();
      var2idx.put (var, vi);
    }

    int numRows = in.readInt ();
    values = new ArrayList (numRows);
    for (int ri = 0; ri < numRows; ri++) {
      Object[] row = (Object[]) in.readObject ();
      values.add (row);
    }

    scale = (version >= 2) ? in.readDouble () : 1.0;
  }
 
开发者ID:mimno,项目名称:GRMM,代码行数:22,代码来源:Assignment.java

示例2: increment

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public synchronized void increment(@NotNull String groupName,
                                   @NotNull NotificationSource source,
                                   @NotNull NotificationCategory category,
                                   @NotNull ProjectSystemId projectSystemId) {

  final TObjectIntHashMap<NotificationCategory> counter =
    ContainerUtil.getOrCreate(
      ContainerUtil.getOrCreate(
        ContainerUtil.getOrCreate(
          map,
          projectSystemId,
          ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap()),
        groupName,
        ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap()
      ),
      source,
      new MyTObjectIntHashMap<NotificationCategory>()
    );
  if (!counter.increment(category)) counter.put(category, 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MessageCounter.java

示例3: getRoute

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static int[] getRoute(ASTNode node, TObjectIntHashMap<ASTNode> index){
  final List<ASTNode> parents = new ArrayList<ASTNode>(20);
  while(node != null){
    ASTNode nodeTreeParent = node.getTreeParent();
    if (nodeTreeParent == null) break;
    if (!index.contains(node)) {
      ASTNode current = nodeTreeParent.getFirstChildNode();
      int rootIndex = 0;

      while(current != null){
        index.put(current, rootIndex);
        current = current.getTreeNext();
        rootIndex++;
      }
    }
    parents.add(node);
    node = nodeTreeParent;
  }
  final int[] root = new int[parents.size()];
  for(int i = 0; i < root.length; i++){
    final ASTNode parent = parents.get(root.length - i - 1);
    root[i] = index.get(parent);
  }
  return root;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TreeChangeEventImpl.java

示例4: generateUniqueVariableName

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static String generateUniqueVariableName(@NonNls final String className, final TObjectIntHashMap<String> class2variableIndex,
                                                 final PsiClass aClass) {
  final String shortName;
  if (className.startsWith("javax.swing.J")) {
    shortName = className.substring("javax.swing.J".length());
  }
  else {
    final int idx = className.lastIndexOf('.');
    if (idx != -1) {
      shortName = className.substring(idx + 1);
    }
    else {
      shortName = className;
    }
  }

  if (!class2variableIndex.containsKey(className)) class2variableIndex.put(className, 0);
  String result;
  do {
    class2variableIndex.increment(className);
    int newIndex = class2variableIndex.get(className);

    result = Character.toLowerCase(shortName.charAt(0)) + shortName.substring(1) + newIndex;
  } while(aClass.findFieldByName(result, true) != null);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FormSourceCodeGenerator.java

示例5: fun

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@Override
public void fun(TObjectIntHashMap<GrVariable> map, Instruction instruction) {
  if (!(instruction instanceof ReadWriteVariableInstruction)) return;

  final ReadWriteVariableInstruction rwInstruction = (ReadWriteVariableInstruction)instruction;
  if (!rwInstruction.isWrite()) return;

  final GrVariable variable = getVariable(instruction.getElement());
  if (variable == null) return;

  int currentVal = map.get(variable);
  if (currentVal == 2) return;

  if (currentVal == 0 || currentVal == 1 && !(variable.getParent() instanceof GrForInClause)) currentVal++;
  map.put(variable, currentVal);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:WritesCounterDFAInstance.java

示例6: increment

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public synchronized void increment(@Nonnull String groupName,
                                   @Nonnull NotificationSource source,
                                   @Nonnull NotificationCategory category,
                                   @Nonnull ProjectSystemId projectSystemId) {

  final TObjectIntHashMap<NotificationCategory> counter =
          ContainerUtil.getOrCreate(
                  ContainerUtil.getOrCreate(
                          ContainerUtil.getOrCreate(
                                  map,
                                  projectSystemId,
                                  ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap()),
                          groupName,
                          ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap()
                  ),
                  source,
                  new TObjectIntHashMap<NotificationCategory>()
          );
  if (!counter.increment(category)) counter.put(category, 1);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:MessageCounter.java

示例7: buildNamesIndex

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static TObjectIntHashMap<String> buildNamesIndex(Instruction[] flow) {
    TObjectIntHashMap<String> namesIndex = new TObjectIntHashMap<String>();
    int idx = 0;
    for (Instruction instruction : flow) {
        if (instruction instanceof ReadWriteVariableInstruction) {
            String name = ((ReadWriteVariableInstruction) instruction).getVariableName();
            if (!namesIndex.contains(name)) {
                namesIndex.put(name, idx++);
            }
        }
    }
    return namesIndex;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:14,代码来源:ControlFlowUtil.java

示例8: visitPostOrderIterative

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private TObjectIntHashMap<Instruction> visitPostOrderIterative(Instruction start, ArrayList<Instruction> instructionsInPostOrderTraversalOfReverseControlFlowGraph) {
	
	TObjectIntHashMap<Instruction>postOrderNumbers = new TObjectIntHashMap<Instruction>();
	
	ArrayList<Instruction> stack = new ArrayList<Instruction>();
	TIntHashSet visitedIndices = new TIntHashSet(code.getNumberOfInstructions());
	TIntHashSet processedIndices = new TIntHashSet(code.getNumberOfInstructions());
	
	stack.add(start);
	while(stack.size() > 0) {
		Instruction top = stack.get(stack.size() - 1);
		if(visitedIndices.contains(top.getIndex())) {
			stack.remove(stack.size() - 1);
			if(!processedIndices.contains(top.getIndex())) {
				processedIndices.add(top.getIndex());
				
				instructionsInPostOrderTraversalOfReverseControlFlowGraph.add(0, top);
				postOrderNumbers.put(top, instructionsInPostOrderTraversalOfReverseControlFlowGraph.size());

			}
		}
		// Remember that we were here, then add the predecessors in reverse order to the stack.
		else {
			visitedIndices.add(top.getIndex());
			int insertionIndex = 0;
			for(Instruction predecessor : top.getOrderedPredecessors()) {
				if(!visitedIndices.contains(predecessor.getIndex())) {
					stack.add(stack.size() - insertionIndex, predecessor);
					insertionIndex++;
				}
			}
		}

	}

	return postOrderNumbers;
	
}
 
开发者ID:andyjko,项目名称:whyline,代码行数:39,代码来源:ControlDependencies.java

示例9: read

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@Override
public TObjectIntHashMap<K> read(@NotNull final DataInput in) throws IOException {
  final int size = in.readInt();
  final TObjectIntHashMap<K> map = new TObjectIntHashMap<K>(size);
  for (int i = 0; i < size; i++) {
    map.put(myKeyDataExternalizer.read(in), in.readInt());
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TObjectIntHashMapExternalizer.java

示例10: getAnnotationsOrderMap

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private TObjectIntHashMap<String> getAnnotationsOrderMap() {
  final TObjectIntHashMap<String> map = new TObjectIntHashMap<String>();
  for (int i = 0; i < myAnnotationMethods.length; i++) {
    map.put(myAnnotationMethods[i].getName(), i);
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AddMissingRequiredAnnotationParametersFix.java

示例11: getOverriddenMethods

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@NotNull
public List<JavaArrangementOverriddenMethodsInfo> getOverriddenMethods() {
  List<JavaArrangementOverriddenMethodsInfo> result = new ArrayList<JavaArrangementOverriddenMethodsInfo>();
  final TObjectIntHashMap<PsiMethod> weights = new TObjectIntHashMap<PsiMethod>();
  Comparator<Pair<PsiMethod, PsiMethod>> comparator = new Comparator<Pair<PsiMethod, PsiMethod>>() {
    @Override
    public int compare(Pair<PsiMethod, PsiMethod> o1, Pair<PsiMethod, PsiMethod> o2) {
      return weights.get(o1.first) - weights.get(o2.first);
    }
  };
  for (Map.Entry<PsiClass, List<Pair<PsiMethod, PsiMethod>>> entry : myOverriddenMethods.entrySet()) {
    JavaArrangementOverriddenMethodsInfo info = new JavaArrangementOverriddenMethodsInfo(entry.getKey().getName());
    weights.clear();
    int i = 0;
    for (PsiMethod method : entry.getKey().getMethods()) {
      weights.put(method, i++);
    }
    ContainerUtil.sort(entry.getValue(), comparator);
    for (Pair<PsiMethod, PsiMethod> pair : entry.getValue()) {
      JavaElementArrangementEntry overridingMethodEntry = myMethodEntriesMap.get(pair.second);
      if (overridingMethodEntry != null) {
        info.addMethodEntry(overridingMethodEntry);
      }
    }
    if (!info.getMethodEntries().isEmpty()) {
      result.add(info);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:JavaArrangementParseInfo.java

示例12: fromList

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@NotNull
private static OrderMap fromList(@NotNull List<HighlightSeverity> orderList) {
  TObjectIntHashMap<HighlightSeverity> map = new TObjectIntHashMap<HighlightSeverity>();
  for (int i = 0; i < orderList.size(); i++) {
    HighlightSeverity severity = orderList.get(i);
    map.put(severity, i);
  }
  return new OrderMap(map);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SeverityRegistrar.java

示例13: ensureSubProjectsStructure

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public void ensureSubProjectsStructure(@NotNull ExternalProjectPojo topLevelProject,
                                       @NotNull Collection<ExternalProjectPojo> subProjects) {
  ExternalSystemNode<ExternalProjectPojo> topLevelProjectNode = ensureProjectNodeExists(topLevelProject);
  Map<String/*config path*/, ExternalProjectPojo> toAdd = ContainerUtilRt.newHashMap();
  for (ExternalProjectPojo subProject : subProjects) {
    toAdd.put(subProject.getPath(), subProject);
  }
  toAdd.remove(topLevelProject.getPath());

  final TObjectIntHashMap<Object> taskWeights = new TObjectIntHashMap<Object>();
  for (int i = 0; i < topLevelProjectNode.getChildCount(); i++) {
    ExternalSystemNode<?> child = topLevelProjectNode.getChildAt(i);
    Object childElement = child.getDescriptor().getElement();
    if (childElement instanceof ExternalTaskExecutionInfo) {
      taskWeights.put(childElement, subProjects.size() + i);
      continue;
    }
    if (toAdd.remove(((ExternalProjectPojo)childElement).getPath()) == null) {
      removeNodeFromParent(child);
      //noinspection AssignmentToForLoopParameter
      i--;
    }
  }
  if (!toAdd.isEmpty()) {
    for (Map.Entry<String, ExternalProjectPojo> entry : toAdd.entrySet()) {
      ExternalProjectPojo
        element = new ExternalProjectPojo(entry.getValue().getName(), entry.getValue().getPath());
      insertNodeInto(new ExternalSystemNode<ExternalProjectPojo>(descriptor(element, myUiAware.getProjectIcon())),
                     topLevelProjectNode);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ExternalSystemTasksTreeModel.java

示例14: computeDistancesToTarget

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private void computeDistancesToTarget() {
  myNonTreeEdges = new MultiMap<Node, GraphEdge<Node>>();
  mySortedNodes = new ArrayList<Node>();
  myNextNodes = new HashMap<Node, Node>();
  TObjectIntHashMap<Node> distances = new TObjectIntHashMap<Node>();
  Deque<Node> nodes = new ArrayDeque<Node>();
  nodes.addLast(myFinish);
  distances.put(myFinish, 0);
  while (!nodes.isEmpty()) {
    myProgressIndicator.checkCanceled();
    Node node = nodes.removeFirst();
    mySortedNodes.add(node);
    int d = distances.get(node) + 1;
    Iterator<Node> iterator = myGraph.getIn(node);
    while (iterator.hasNext()) {
      Node prev = iterator.next();
      if (distances.containsKey(prev)) {
        int dPrev = distances.get(prev);
        myNonTreeEdges.putValue(prev, new GraphEdge<Node>(prev, node, d - dPrev));
        continue;
      }
      distances.put(prev, d);
      myNextNodes.put(prev, node);
      nodes.addLast(prev);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:KShortestPathsFinder.java

示例15: sortByName

import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static <E extends ArrangementEntry> void sortByName(@NotNull List<E> entries) {
  if (entries.size() < 2) {
    return;
  }
  final TObjectIntHashMap<E> weights = new TObjectIntHashMap<E>();
  int i = 0;
  for (E e : entries) {
    weights.put(e, ++i);
  }
  ContainerUtil.sort(entries, new Comparator<E>() {
    @Override
    public int compare(E e1, E e2) {
      String name1 = e1 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e1).getName() : null;
      String name2 = e2 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e2).getName() : null;
      if (name1 != null && name2 != null) {
        return name1.compareTo(name2);
      }
      else if (name1 == null && name2 == null) {
        return weights.get(e1) - weights.get(e2);
      }
      else if (name2 == null) {
        return -1;
      }
      else {
        return 1;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ArrangementEngine.java


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