| 1 |
package com.carrotsearch.hppc.benchmarks.implementations; |
| 2 |
|
| 3 |
import com.carrotsearch.hppc.IntScatterSet; |
| 4 |
import com.carrotsearch.hppc.benchmarks.*; |
| 5 |
|
| 6 |
public class HppcIntScatterSetOps implements IntSetOps |
| 7 |
{ |
| 8 |
private final IntScatterSet delegate; |
| 9 |
|
| 10 |
public HppcIntScatterSetOps(int expectedElements, double loadFactor) { |
| 11 |
this.delegate = new IntScatterSet(expectedElements, loadFactor); |
| 12 |
} |
| 13 |
|
| 14 |
@Override |
| 15 |
public void add(int key) { |
| 16 |
delegate.add(key); |
| 17 |
} |
| 18 |
|
| 19 |
@Override |
| 20 |
public void bulkAdd(int[] keys) { |
| 21 |
for (int key : keys) { |
| 22 |
delegate.add(key); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
@Override |
| 27 |
public int bulkContains(int[] keys) { |
| 28 |
int v = 0; |
| 29 |
for (int key : keys) { |
| 30 |
if (delegate.contains(key)) { |
| 31 |
v++; |
| 32 |
} |
| 33 |
} |
| 34 |
return v; |
| 35 |
} |
| 36 |
|
| 37 |
@Override |
| 38 |
public int[] iterationOrderArray() { |
| 39 |
return delegate.toArray(); |
| 40 |
} |
| 41 |
} |