本文整理汇总了Java中it.unimi.dsi.fastutil.ints.Int2IntMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java Int2IntMap.get方法的具体用法?Java Int2IntMap.get怎么用?Java Int2IntMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.Int2IntMap
的用法示例。
在下文中一共展示了Int2IntMap.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillSeenPositions
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
private void fillSeenPositions(Collection<DexMethod> invokes) {
for (DexMethod method : invokes) {
DexType[] parameters = method.proto.parameters.values;
int arity = parameters.length;
int positions = computePositionsFor(method.proto, target, targetProtoCache, substituions);
if (positions != 0) {
Int2IntMap positionsMap =
seenPositions.computeIfAbsent(method.name, k -> {
Int2IntMap result = new Int2IntOpenHashMap();
result.defaultReturnValue(NOT_FOUND);
return result;
});
int value = 0;
int previous = positionsMap.get(arity);
if (previous != NOT_FOUND) {
value = previous;
}
value |= positions;
positionsMap.put(arity, value);
}
}
}
示例2: generateValues
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
@Override
public int[] generateValues(final int x, final int z, final int sizeX, final int sizeZ)
{
final int gridX = x - 1;
final int gridZ = z - 1;
final int gridSizeX = sizeX + 2;
final int gridSizeZ = sizeZ + 2;
final int[] values = this.belowLayer.generateValues(gridX, gridZ, gridSizeX, gridSizeZ);
final int[] finalValues = new int[sizeX * sizeZ];
for (int i = 0; i < sizeZ; i++)
{
for (int j = 0; j < sizeX; j++)
{
// This applies biome large edges using Von Neumann neighborhood
final int centerVal = values[(j + 1 + ((i + 1) * gridSizeX))];
int val = centerVal;
for (final Entry<Int2IntMap, IntList> entry : EDGES.entrySet())
{
final Int2IntMap map = entry.getKey();
if (map.containsKey(centerVal))
{
final int upperVal = values[(j + 1 + (i * gridSizeX))];
final int lowerVal = values[(j + 1 + ((i + 2) * gridSizeX))];
final int leftVal = values[(j + ((i + 1) * gridSizeX))];
final int rightVal = values[(j + 2 + ((i + 1) * gridSizeX))];
if (((entry.getValue() == null) && (! map.containsKey(upperVal) || ! map.containsKey(lowerVal) || ! map.containsKey(leftVal) || ! map.containsKey(rightVal))) || ((entry.getValue() != null) && (entry.getValue().contains(upperVal) || entry.getValue().contains(lowerVal) || entry.getValue().contains(leftVal) || entry.getValue().contains(rightVal))))
{
val = map.get(centerVal);
break;
}
}
}
finalValues[(j + (i * sizeX))] = val;
}
}
return finalValues;
}
示例3: generateValues
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
@Override
public int[] generateValues(final int x, final int z, final int sizeX, final int sizeZ)
{
final int gridX = x - 1;
final int gridZ = z - 1;
final int gridSizeX = sizeX + 2;
final int gridSizeZ = sizeZ + 2;
final int[] values = this.belowLayer.generateValues(gridX, gridZ, gridSizeX, gridSizeZ);
final int[] finalValues = new int[sizeX * sizeZ];
for (int i = 0; i < sizeZ; i++)
{
for (int j = 0; j < sizeX; j++)
{
// This applies biome thin edges using Von Neumann neighborhood
final int centerVal = values[(j + 1 + ((i + 1) * gridSizeX))];
int val = centerVal;
for (final Entry<Int2IntMap, IntList> entry : EDGES.entrySet())
{
final Int2IntMap map = entry.getKey();
if (map.containsKey(centerVal))
{
final int upperVal = values[(j + 1 + (i * gridSizeX))];
final int lowerVal = values[(j + 1 + ((i + 2) * gridSizeX))];
final int leftVal = values[(j + ((i + 1) * gridSizeX))];
final int rightVal = values[(j + 2 + ((i + 1) * gridSizeX))];
if (((entry.getValue() == null) && ((! OCEANS.contains(upperVal) && ! map.containsKey(upperVal)) || (! OCEANS.contains(lowerVal) && ! map.containsKey(lowerVal)) || (! OCEANS.contains(leftVal) && ! map.containsKey(leftVal)) || (! OCEANS.contains(rightVal) && ! map.containsKey(rightVal)))) || ((entry.getValue() != null) && ((! OCEANS.contains(upperVal) && ! entry.getValue().contains(upperVal)) || (! OCEANS.contains(lowerVal) && ! entry.getValue().contains(lowerVal)) || (! OCEANS.contains(leftVal) && ! entry.getValue().contains(leftVal)) || (! OCEANS.contains(rightVal) && ! entry.getValue().contains(rightVal)))))
{
val = map.get(centerVal);
break;
}
}
}
finalValues[(j + (i * sizeX))] = val;
}
}
return finalValues;
}
示例4: getKeyForValue
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private int getKeyForValue(int value) {
Int2IntMap map = (Int2IntMap) _groupKeyMap;
int groupId = map.get(value);
if (groupId == INVALID_ID) {
groupId = _numGroupKeys;
map.put(value, _numGroupKeys++);
}
return groupId;
}
示例5: generateInitialOrdering
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
private IntList generateInitialOrdering(List<DifferenceSet> tempDiffSet) {
IntList result = new IntArrayList();
Int2IntMap counting = new Int2IntArrayMap();
for (DifferenceSet ds : tempDiffSet) {
int lastIndex = ds.getAttributes().nextSetBit(0);
while (lastIndex != -1) {
if (!counting.containsKey(lastIndex)) {
counting.put(lastIndex, 1);
} else {
counting.put(lastIndex, counting.get(lastIndex) + 1);
}
lastIndex = ds.getAttributes().nextSetBit(lastIndex + 1);
}
}
// TODO: Comperator und TreeMap --> Tommy
while (true) {
if (counting.size() == 0) {
break;
}
int biggestAttribute = -1;
int numberOfOcc = 0;
for (int attr : counting.keySet()) {
if (biggestAttribute < 0) {
biggestAttribute = attr;
numberOfOcc = counting.get(attr);
continue;
}
int tempOcc = counting.get(attr);
if (tempOcc > numberOfOcc) {
numberOfOcc = tempOcc;
biggestAttribute = attr;
} else if (tempOcc == numberOfOcc) {
if (biggestAttribute > attr) {
biggestAttribute = attr;
}
}
}
if (numberOfOcc == 0) {
break;
}
result.add(biggestAttribute);
counting.remove(biggestAttribute);
}
return result;
}
示例6: generateNextOrdering
import it.unimi.dsi.fastutil.ints.Int2IntMap; //导入方法依赖的package包/类
private IntList generateNextOrdering(List<DifferenceSet> next, IntList currentOrdering, int attribute) {
IntList result = new IntArrayList();
Int2IntMap counting = new Int2IntArrayMap();
boolean seen = false;
for (int i = 0; i < currentOrdering.size(); i++) {
if (!seen) {
if (currentOrdering.getInt(i) != attribute) {
continue;
} else {
seen = true;
}
} else {
counting.put(currentOrdering.getInt(i), 0);
for (DifferenceSet ds : next) {
if (ds.getAttributes().get(currentOrdering.getInt(i))) {
counting.put(currentOrdering.getInt(i), counting.get(currentOrdering.getInt(i)) + 1);
}
}
}
}
// TODO: Comperator und TreeMap --> Tommy
while (true) {
if (counting.size() == 0) {
break;
}
int biggestAttribute = -1;
int numberOfOcc = 0;
for (int attr : counting.keySet()) {
if (biggestAttribute < 0) {
biggestAttribute = attr;
numberOfOcc = counting.get(attr);
continue;
}
int tempOcc = counting.get(attr);
if (tempOcc > numberOfOcc) {
numberOfOcc = tempOcc;
biggestAttribute = attr;
} else if (tempOcc == numberOfOcc) {
if (biggestAttribute > attr) {
biggestAttribute = attr;
}
}
}
if (numberOfOcc == 0) {
break;
}
result.add(biggestAttribute);
counting.remove(biggestAttribute);
}
return result;
}