• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Int2IntArrayMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CastContext类代码示例发布时间:2022-05-22
下一篇:
Java CompactionController类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap