it.unimi.dsi.fastutil.ints.IntArraySet Java Examples

The following examples show how to use it.unimi.dsi.fastutil.ints.IntArraySet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AgreeSetGenerator.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
private boolean isSubset(IntList actuelList, Map<Integer, IntSet> index) {

        boolean first = true;
        IntSet positions = new IntArraySet();
        for (int e : actuelList) {
            if (!index.containsKey(Integer.valueOf(e))) {
                return false;
            }
            if (first) {
                positions.addAll(index.get(Integer.valueOf(e)));
                first = false;
            } else {

                this.intersect(positions, index.get(Integer.valueOf(e)));
                // FIXME: Throws UnsupportedOperationExeption within fastUtil
                // positions.retainAll(index.get(e));
            }
            if (positions.size() == 0) {
                return false;
            }
        }
        return true;
    }
 
Example #2
Source File: TestDictionaryAwarePageFilter.java    From presto with Apache License 2.0 5 votes vote down vote up
private static void testFilter(DictionaryAwarePageFilter filter, Block block, boolean filterRange)
{
    IntSet actualSelectedPositions = toSet(filter.filter(null, new Page(block)));

    block = block.getLoadedBlock();

    IntSet expectedSelectedPositions = new IntArraySet(block.getPositionCount());
    for (int position = 0; position < block.getPositionCount(); position++) {
        if (isSelected(filterRange, block.getLong(position, 0))) {
            expectedSelectedPositions.add(position);
        }
    }
    assertEquals(actualSelectedPositions, expectedSelectedPositions);
}
 
Example #3
Source File: TestDictionaryAwarePageFilter.java    From presto with Apache License 2.0 5 votes vote down vote up
private static IntSet toSet(SelectedPositions selectedPositions)
{
    int start = selectedPositions.getOffset();
    int end = start + selectedPositions.size();
    if (selectedPositions.isList()) {
        return new IntArraySet(Arrays.copyOfRange(selectedPositions.getPositions(), start, end));
    }
    return new IntArraySet(IntStream.range(start, end).toArray());
}
 
Example #4
Source File: AgreeSetGenerator.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private void handlePartitionConcurrent(IntList actuelList, int position, Map<Integer, IntSet> index, Map<IntList, Object> max) {

        if (!this.isSubset(actuelList, index)) {
            max.put(actuelList, new Object());
            for (int e : actuelList) {
                if (!index.containsKey(Integer.valueOf(e))) {
                    index.put(Integer.valueOf(e), new IntArraySet());
                }
                index.get(Integer.valueOf(e)).add(position);
            }
        }
    }
 
Example #5
Source File: AgreeSetGenerator.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private void handlePartition(IntList actuelList, int position, Int2ObjectMap<IntSet> index, Set<IntList> max) {

        if (!this.isSubset(actuelList, index)) {
            max.add(actuelList);
            for (int e : actuelList) {
                if (!index.containsKey(e)) {
                    index.put(e, new IntArraySet());
                }
                index.get(e).add(position);
            }
        }
    }
 
Example #6
Source File: AgreeSetGenerator.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private void intersect(IntSet positions, IntSet indexSet) {

        IntSet toRemove = new IntArraySet();
        for (int l : positions) {
            if (!indexSet.contains(l)) {
                toRemove.add(l);
            }
        }
        positions.removeAll(toRemove);
    }
 
Example #7
Source File: AnchorTernaryTrie.java    From tagme with Apache License 2.0 4 votes vote down vote up
public static Anchor fake(String w){
	Int2IntMap links = new Int2IntArrayMap();
	links.put(0, w.length());
	return Anchor.build(0, links, w.length(), new IntArraySet());
}
 
Example #8
Source File: SparseVectorStorage.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** */
public IntSet indexes() {
    return new IntArraySet(sto.keySet());
}