コード例 #1
0
  @Test
  public void incrementCountersSmall() {
    int[] counters = new int[da.length()];

    ImmutableOrdinalSet.of(a1).incrementCounters(counters);
    ImmutableOrdinalSet.of(a0).incrementCounters(counters);
    ImmutableOrdinalSet.of(a1).incrementCounters(counters);
    ImmutableOrdinalSet.of().incrementCounters(counters);

    check(counters).isOf(1, 2);
  }
コード例 #2
0
  @Test
  public void incrementCountersLarge() {
    Domain dc = new Domain();
    Ord[] cs = new Ord[120];
    for (int i = 0; i < cs.length; i++) {
      cs[i] = dc.get(i);
    }

    int[] counters = new int[dc.length()];
    ImmutableOrdinalSet.of(cs[62], cs[119], cs[98]).incrementCounters(counters);
    ImmutableOrdinalSet.of(cs[119], cs[1]).incrementCounters(counters);

    check(new int[] {counters[0], counters[1], counters[62], counters[98], counters[119]})
        .isOf(0, 1, 1, 1, 2);
  }