本文整理汇总了Java中gnu.trove.TObjectIntHashMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java TObjectIntHashMap.get方法的具体用法?Java TObjectIntHashMap.get怎么用?Java TObjectIntHashMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TObjectIntHashMap
的用法示例。
在下文中一共展示了TObjectIntHashMap.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}
示例5: findWordPOS
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public static int findWordPOS(TObjectIntHashMap<String> dAdjectives,
TObjectIntHashMap<String> dAdverbs,
String word) {
int adjCount = dAdjectives.get(word);
int advCount = dAdverbs.get(word);
if (adjCount == 0 && advCount == 0) {
if (word.endsWith("ly"))
return 2;
else {
return 3;
}
}
int total = adjCount + advCount;
double adjProb = (double)adjCount / (double) total;
double advProb = (double)advCount / (double) total;
if (Math.abs(adjProb - advProb) < 0.2) {
return 3;
} else {
if (adjProb > advProb) {
return 1;
} else {
return 2;
}
}
}
示例6: isAlreadyAddedOrdered
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static boolean isAlreadyAddedOrdered(final TObjectIntHashMap<String> orderMap,
final PsiNameValuePair[] addedParameters)
{
if(addedParameters.length <= 1)
{
return true;
}
int previousOrder = orderMap.get(addedParameters[0].getName());
for(int i = 1; i < addedParameters.length; i++)
{
final int currentOrder = orderMap.get(addedParameters[i].getName());
if(currentOrder < previousOrder)
{
return false;
}
previousOrder = currentOrder;
}
return true;
}
示例7: isAlreadyAddedOrdered
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
private static boolean isAlreadyAddedOrdered(final TObjectIntHashMap<String> orderMap, final PsiNameValuePair[] addedParameters) {
if (addedParameters.length <= 1) {
return true;
}
int previousOrder = orderMap.get(addedParameters[0].getName());
for (int i = 1; i < addedParameters.length; i++) {
final int currentOrder = orderMap.get(addedParameters[i].getName());
if (currentOrder < previousOrder) {
return false;
}
previousOrder = currentOrder;
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AddMissingRequiredAnnotationParametersFix.java
示例8: 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;
}
示例9: getCount
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public synchronized int getCount(@Nullable final String groupName,
@NotNull final NotificationSource notificationSource,
@Nullable final NotificationCategory notificationCategory,
@NotNull final ProjectSystemId projectSystemId) {
int count = 0;
final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap = ContainerUtil.getOrElse(
map,
projectSystemId,
Collections.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>emptyMap());
for (Map.Entry<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> entry : groupMap.entrySet()) {
if (groupName == null || groupName.equals(entry.getKey())) {
final TObjectIntHashMap<NotificationCategory> counter = entry.getValue().get(notificationSource);
if (counter == null) continue;
if (notificationCategory == null) {
for (int aCount : counter.getValues()) {
count += aCount;
}
}
else {
count += counter.get(notificationCategory);
}
}
}
return count;
}
示例10: 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);
}
}
}
示例11: comparator
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@NotNull
public Comparator<Node> comparator() {
if (myComparator == null) {
final TObjectIntHashMap<Node> map = isAcyclic() ? myNodeToNNumber : myNodeToTNumber;
myComparator = new Comparator<Node>() {
@Override
public int compare(@NotNull Node t, @NotNull Node t1) {
return map.get(t) - map.get(t1);
}
};
}
return myComparator;
}
示例12: getResourceId
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
@NotNull
public Integer getResourceId(ResourceType type, String name) {
final TObjectIntHashMap<String> map = myResourceValueMap != null ? myResourceValueMap.get(type) : null;
if (map == null || !map.containsKey(name)) {
return getDynamicId(type, name);
}
return map.get(name);
}
示例13: main
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public static void main(String[] args) {
String supmodel = args[0];
String supalphabet = args[1];
String ssalphabet = args[2];
String outmodel = args[3];
TIntObjectHashMap<String> supAlphabet =
readAlphabet(supalphabet);
TObjectIntHashMap<String> rSupAlphabet = getReverseMap(supAlphabet);
TIntObjectHashMap<String> ssAlphabet =
readAlphabet(ssalphabet);
int supsize = supAlphabet.size();
int sssize = ssAlphabet.size();
double[] supmodelarr = readDoubleArray(supmodel, supsize+1);
double[] ssmodelarr = new double[sssize+1];
ssmodelarr[0] = supmodelarr[0];
for (int i = 1; i < sssize+1; i++) {
String feat = ssAlphabet.get(i);
if (rSupAlphabet.contains(feat)) {
int index = rSupAlphabet.get(feat);
ssmodelarr[i] = supmodelarr[index];
} else {
ssmodelarr[i] = 1.0;
}
}
writeArray(ssmodelarr, outmodel);
}
示例14: indexString
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public static int indexString(String string, TObjectIntHashMap<String> map, ArrayList<String> list) {
if (map.contains(string)) {
return map.get(string);
} else {
int size = map.size();
map.put(string, size);
list.add(string);
return size;
}
}
示例15: exitMode
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public static boolean exitMode(PsiBuilder builder_, @SuppressWarnings("UnusedParameters") int level, String mode) {
TObjectIntHashMap<String> flags = getParsingModes(builder_);
int count = flags.get(mode);
if (count == 1) flags.remove(mode);
else if (count > 1) flags.put(mode, count -1);
else builder_.error("Could not exit inactive '" + mode + "' mode at offset " + builder_.getCurrentOffset());
return true;
}