本文整理汇总了Java中gnu.trove.TObjectIntHashMap.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java TObjectIntHashMap.containsKey方法的具体用法?Java TObjectIntHashMap.containsKey怎么用?Java TObjectIntHashMap.containsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TObjectIntHashMap
的用法示例。
在下文中一共展示了TObjectIntHashMap.containsKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
}
}
示例3: 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);
}
示例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;
}
示例5: getTargetId
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
public static Integer getTargetId(String targetTitle, TObjectIntHashMap<String> pagesByTitle, TIntIntHashMap redirectTargetsBySource) {
String nTitle = normaliseTitle(targetTitle) ;
if (!pagesByTitle.containsKey(nTitle))
return null ;
Integer target = pagesByTitle.get(nTitle) ;
HashSet<Integer> targetsSeen = new HashSet<Integer>() ;
while (target != null && redirectTargetsBySource != null && redirectTargetsBySource.containsKey(target)){
if (targetsSeen.contains(target)) {
// seen this redirect before, and can't resolve a loop
return null ;
} else {
targetsSeen.add(target) ;
if (redirectTargetsBySource.containsKey(target))
target = redirectTargetsBySource.get(target) ;
else
target = null ;
}
}
return target ;
}
示例6: hashCode
import gnu.trove.TObjectIntHashMap; //导入方法依赖的package包/类
/**
* Returns a hash code using the given map from vars to ints.
*/
public int hashCode(TObjectIntHashMap varMap) {
// see if this already in map
if (varMap.containsKey(this))
return varMap.get(this);
// otherwise add it
int next = varMap.size() + 1;
varMap.put(this, next);
return next;
}