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


Java Int2IntArrayMap类代码示例

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


Int2IntArrayMap类属于it.unimi.dsi.fastutil.ints包,在下文中一共展示了Int2IntArrayMap类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderLine

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的package包/类
private static void renderLine(int regen, boolean low, int yTexture, int maxHealth, int maxExtraHearts, int current, int absorption, Gui gui, boolean highlight) {
    GlStateManager.pushMatrix();
    Int2IntMap map = new Int2IntArrayMap();
    if (low) {
        for (int i = 0; i < (maxHealth + maxExtraHearts); i++)
            map.put(i, EventHandler.rand.nextInt(2));
    }

    renderMax(regen, map, maxHealth, yTexture, gui, highlight);
    if (maxExtraHearts > 0) { //for absorption
        if (maxHealth != 0) {
            GlStateManager.translate(2 + 9 * maxHealth, 0, 0);
        }
        renderMax(regen - maxHealth, map, maxExtraHearts, yTexture, gui, false); //Do not highlight absorption
    }
    GlStateManager.popMatrix();
    GlStateManager.translate(0, 0, 1);

    renderCurrentHealth(regen, map, current, yTexture, gui);

    if (absorption > 0) {
        int offset = maxHealth * 9 + (maxHealth == 0 ? 0 : 2);
        GlStateManager.translate(offset, 0, 0);
        renderAbsorption(regen - maxHealth, map, absorption, yTexture, gui);
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:27,代码来源:GuiUtils.java

示例2: create

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的package包/类
@Override
public Kryo create() {
  Kryo kryo = new Kryo();
  kryo.setRegistrationRequired(true);

  // model class(es)
  kryo.register(LookupUsage.class);

  // fastutils
  kryo.register(Int2IntArrayMap.class);
  kryo.register(Int2IntOpenHashMap.class);

  // java & commons
  kryo.register(Date.class);
  kryo.register(HashMap.class);
  kryo.register(HashSet.class);
  kryo.register(ArrayList.class);
  ImmutableListSerializer.registerSerializers(kryo);

  // enums
  kryo.register(Rank.class);
  kryo.register(Kingdom.class);

  return kryo;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:26,代码来源:LookupKryoFactory.java

示例3: SubsettedLikelihoodMatrix

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的package包/类
public SubsettedLikelihoodMatrix(final LikelihoodMatrix<A> matrix, final List<A> alleles) {
    this.matrix = Utils.nonNull(matrix);
    this.alleles = Utils.nonNull(alleles);
    final int[] newIndices = new IndexRange(0, alleles.size()).mapToInteger(n -> n);
    final int[] oldIndices = alleles.stream().mapToInt(matrix::indexOfAllele).toArray();
    Utils.validateArg(Arrays.stream(oldIndices).noneMatch(n -> n < 0), "All alleles must be found in likelihoods matrix");
    newToOldIndexMap = new Int2IntArrayMap(newIndices, oldIndices);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:9,代码来源:SubsettedLikelihoodMatrix.java

示例4: map

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的package包/类
/**
 * key, value, key, value, ...
 * pro parte maps have the parent usageKey as key, the pro parte usage key as value
 */
private static Int2IntMap map(int ... kvs) {
  Int2IntMap m = new Int2IntArrayMap(kvs.length / 2);
  int idx = 0;
  while (idx < kvs.length) {
    m.put(kvs[idx], kvs[idx+1]);
    idx = idx + 2;
  }
  return m;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:IdGeneratorTest.java

示例5: generateInitialOrdering

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的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;
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:58,代码来源:FindCoversGenerator.java

示例6: generateNextOrdering

import it.unimi.dsi.fastutil.ints.Int2IntArrayMap; //导入依赖的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;
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:65,代码来源:FindCoversGenerator.java


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