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


Java TObjectIntHashMap类代码示例

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


TObjectIntHashMap类属于gnu.trove包,在下文中一共展示了TObjectIntHashMap类的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: getNonQualifiedClassIdx

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
private static int getNonQualifiedClassIdx(@NotNull final PsiClass psiClass, @NotNull final PsiClass containingClass) {
  TObjectIntHashMap<PsiClass> indices =
    CachedValuesManager.getCachedValue(containingClass, new CachedValueProvider<TObjectIntHashMap<PsiClass>>() {
      @Nullable
      @Override
      public Result<TObjectIntHashMap<PsiClass>> compute() {
        final TObjectIntHashMap<PsiClass> map = new TObjectIntHashMap<PsiClass>();
        int index = 0;
        for (PsiClass aClass : SyntaxTraverser.psiTraverser().withRoot(containingClass).postOrderDfsTraversal().filter(PsiClass.class)) {
          if (aClass.getQualifiedName() == null) {
            map.put(aClass, ++index);
          }
        }
        return Result.create(map, containingClass);
      }
    });

  return indices.get(psiClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ClassUtil.java

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

示例4: remove

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
public synchronized void remove(@Nullable final String groupName,
                                @NotNull final NotificationSource notificationSource,
                                @NotNull final ProjectSystemId projectSystemId) {
  final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap =
    ContainerUtil.getOrCreate(
      map,
      projectSystemId,
      ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap());
  if (groupName != null) {
    final TObjectIntHashMap<NotificationCategory> counter = ContainerUtil.getOrCreate(
      ContainerUtil.getOrCreate(
        groupMap,
        groupName,
        ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap()
      ),
      notificationSource,
      new MyTObjectIntHashMap<NotificationCategory>()
    );
    counter.clear();
  }
  else {
    for (Map<NotificationSource, TObjectIntHashMap<NotificationCategory>> sourceMap : groupMap.values()) {
      sourceMap.remove(notificationSource);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MessageCounter.java

示例5: getChangedElements

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
@Override
@NotNull
public ASTNode[] getChangedElements() {
  if (myChangedInOrder == null) {
    myChangedInOrder = new ArrayList<ASTNode>(myChangedElements.keySet());

    Collections.sort(myChangedInOrder, new Comparator<ASTNode>() {
      final Map<ASTNode, int[]> routeMap = new THashMap<ASTNode, int[]>(myChangedElements.size());
      final TObjectIntHashMap<ASTNode> nodeIndex = new TObjectIntHashMap<ASTNode>(myChangedElements.size());

      @Override
      public int compare(ASTNode o1, ASTNode o2) {
        int[] route = routeMap.get(o1);
        if (route == null) routeMap.put(o1, route = getRoute(o1, nodeIndex));
        int[] route2 = routeMap.get(o2);
        if (route2 == null) routeMap.put(o2, route2 = getRoute(o2, nodeIndex));
        return compareRoutes(route, route2);
      }
    });
  }
  return myChangedInOrder.toArray(new ASTNode[myChangedInOrder.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TreeChangeEventImpl.java

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

示例7: loadAndParseRClass

import gnu.trove.TObjectIntHashMap; //导入依赖的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

示例8: generateListModelProperty

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
private void generateListModelProperty(final LwIntrospectedProperty property, final TObjectIntHashMap<String> class2variableIndex,
                                       final PsiClass aClass, final Object value, final String variable) {
  String valueClassName;
  if (property.getPropertyClassName().equals(ComboBoxModel.class.getName())) {
    valueClassName = DefaultComboBoxModel.class.getName();
  }
  else {
    valueClassName = DefaultListModel.class.getName();
  }
  String modelVarName = generateUniqueVariableName(valueClassName, class2variableIndex, aClass);
  myBuffer.append("final ");
  myBuffer.append(valueClassName);
  myBuffer.append(" ");
  myBuffer.append(modelVarName);
  myBuffer.append("= new ").append(valueClassName).append("();");
  String[] items = (String[]) value;
  for(String item: items) {
    startMethodCall(modelVarName, "addElement");
    push(item);
    endMethod();
  }

  startMethodCall(variable, property.getWriteMethodName());
  pushVar(modelVarName);
  endMethod();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FormSourceCodeGenerator.java

示例9: getVariable

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
/**
 * @return variable idx
 */
private static String getVariable(final LwComponent component,
                                  final HashMap<LwComponent, String> component2variable,
                                  final TObjectIntHashMap<String> class2variableIndex,
                                  final PsiClass aClass) {
  if (component2variable.containsKey(component)) {
    return component2variable.get(component);
  }

  if (component.getBinding() != null) {
    return component.getBinding();
  }

  @NonNls final String className = component instanceof LwNestedForm ? "nestedForm" : component.getComponentClassName();

  String result = generateUniqueVariableName(className, class2variableIndex, aClass);
  component2variable.put(component, result);

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

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

示例11: check

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
@Override
public void check(@NotNull final GrControlFlowOwner owner, @NotNull final ProblemsHolder problemsHolder) {
  final Instruction[] flow = owner.getControlFlow();
  final DFAEngine<TObjectIntHashMap<GrVariable>> engine = new DFAEngine<TObjectIntHashMap<GrVariable>>(
    flow,
    new WritesCounterDFAInstance(),
    new WritesCounterSemilattice<GrVariable>()
  );
  final List<TObjectIntHashMap<GrVariable>> dfaResult = engine.performDFAWithTimeout();
  if (dfaResult == null || dfaResult.isEmpty()) return;

  dfaResult.get(dfaResult.size() - 1).forEachEntry(new TObjectIntProcedure<GrVariable>() {
    @Override
    public boolean execute(GrVariable variable, int writesCount) {
      if (writesCount == 1) {
        process(owner, variable, problemsHolder);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GroovyVariableCanBeFinalInspection.java

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

示例13: GrIntroduceParameterDialog

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
public GrIntroduceParameterDialog(IntroduceParameterInfo info) {
  super(info.getProject(), true);
  myInfo = info;
  myProject = info.getProject();
  myCanIntroduceSimpleParameter = GroovyIntroduceParameterUtil.findExpr(myInfo) != null ||
                                  GroovyIntroduceParameterUtil.findVar(myInfo) != null ||
                                  findStringPart() != null;

  TObjectIntHashMap<GrParameter> parametersToRemove = GroovyIntroduceParameterUtil.findParametersToRemove(info);
  toRemoveCBs = new TObjectIntHashMap<JCheckBox>(parametersToRemove.size());
  for (Object p : parametersToRemove.keys()) {
    JCheckBox cb = new JCheckBox(GroovyRefactoringBundle.message("remove.parameter.0.no.longer.used", ((GrParameter)p).getName()));
    toRemoveCBs.put(cb, parametersToRemove.get((GrParameter)p));
    cb.setSelected(true);
  }

  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GrIntroduceParameterDialog.java

示例14: initializeParameters

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
public void initializeParameters()
{
	localA = new TObjectIntHashMap<String>();
	String[] keys = new String[mParamList.size()];
	mParamList.keys(keys);
	int count = 0;
	for(String param:keys)		
	{
		double val = mParamList.get(param);
		LDouble lDoubleVal = LDouble.convertToLogDomain(val);
		int paramIndex = count;
		localA.put(param, paramIndex);
		setValue(paramIndex, lDoubleVal);
		setGradient(paramIndex, new LDouble(LDouble.IdentityElement.PLUS_IDENTITY));
		count++;
	}
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:18,代码来源:LRIdentificationModelSingleNode.java

示例15: main

import gnu.trove.TObjectIntHashMap; //导入依赖的package包/类
public static void main(String[] args) {
	Pair<TObjectIntHashMap<String>, TObjectIntHashMap<String>> p = 
		readAdjectivesAndAdverbs();
	TObjectIntHashMap<String> adjectives = p.getFirst();
	TObjectIntHashMap<String> adverbs = p.getSecond();
	System.out.println("Number of adjectives:" + adjectives.size());
	System.out.println("Number of adverbs:" + adverbs.size());
	try {
		//createNeighborsForAdverbsAndAdjectives(p);
		//createNeighborsForNouns();
		createNeighborsForVerbs();
	} catch (IOException e) {
		e.printStackTrace();
		System.exit(-1);
	}
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:17,代码来源:LinDekNeighbors.java


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