Examples of TLongIntHashMap


Examples of gnu.trove.map.hash.TLongIntHashMap

    /**
     * Creates an empty {@code Counter}.
     */
    public PairCounter() {
        counts = new TLongIntHashMap();
        elementIndices = new HashIndexer<T>();
        sum = 0;
    }
View Full Code Here

Examples of gnu.trove.map.hash.TLongIntHashMap

*/
public class TIntPairIntHashMap {
  private TLongIntHashMap map;

  public TIntPairIntHashMap() {
    map = new TLongIntHashMap(100);
  }
View Full Code Here

Examples of gnu.trove.map.hash.TLongIntHashMap

  public TIntPairIntHashMap() {
    map = new TLongIntHashMap(100);
  }

  public TIntPairIntHashMap(int capacity) {
    map = new TLongIntHashMap(capacity);
  }
View Full Code Here

Examples of gnu.trove.map.hash.TLongIntHashMap

*/
public class TIntPairIntHashMap {
  private TLongIntHashMap map;

  public TIntPairIntHashMap() {
    map = new TLongIntHashMap(100);
  }
View Full Code Here

Examples of gnu.trove.map.hash.TLongIntHashMap

  public TIntPairIntHashMap() {
    map = new TLongIntHashMap(100);
  }

  public TIntPairIntHashMap(int capacity) {
    map = new TLongIntHashMap(capacity);
  }
View Full Code Here

Examples of org.elasticsearch.common.trove.map.hash.TLongIntHashMap

    @Override protected void doCollect(int doc) throws IOException {
        fieldData.forEachValueInDoc(doc, aggregator);
    }

    @Override public Facet facet() {
        TLongIntHashMap facets = aggregator.facets();
        if (facets.isEmpty()) {
            CacheRecycler.pushLongIntMap(facets);
            return new InternalIpTermsFacet(facetName, comparatorType, size, ImmutableList.<InternalIpTermsFacet.LongEntry>of(), aggregator.missing(), aggregator.total());
        } else {
            if (size < EntryPriorityQueue.LIMIT) {
                EntryPriorityQueue ordered = new EntryPriorityQueue(size, comparatorType.comparator());
                for (TLongIntIterator it = facets.iterator(); it.hasNext(); ) {
                    it.advance();
                    ordered.insertWithOverflow(new InternalIpTermsFacet.LongEntry(it.key(), it.value()));
                }
                InternalIpTermsFacet.LongEntry[] list = new InternalIpTermsFacet.LongEntry[ordered.size()];
                for (int i = ordered.size() - 1; i >= 0; i--) {
                    list[i] = (InternalIpTermsFacet.LongEntry) ordered.pop();
                }
                CacheRecycler.pushLongIntMap(facets);
                return new InternalIpTermsFacet(facetName, comparatorType, size, Arrays.asList(list), aggregator.missing(), aggregator.total());
            } else {
                BoundedTreeSet<InternalIpTermsFacet.LongEntry> ordered = new BoundedTreeSet<InternalIpTermsFacet.LongEntry>(comparatorType.comparator(), size);
                for (TLongIntIterator it = facets.iterator(); it.hasNext(); ) {
                    it.advance();
                    ordered.add(new InternalIpTermsFacet.LongEntry(it.key(), it.value()));
                }
                CacheRecycler.pushLongIntMap(facets);
                return new InternalIpTermsFacet(facetName, comparatorType, size, ordered, aggregator.missing(), aggregator.total());
View Full Code Here

Examples of org.elasticsearch.common.trove.map.hash.TLongIntHashMap

    @Override protected void doCollect(int doc) throws IOException {
        fieldData.forEachValueInDoc(doc, aggregator);
    }

    @Override public Facet facet() {
        TLongIntHashMap facets = aggregator.facets();
        if (facets.isEmpty()) {
            CacheRecycler.pushLongIntMap(facets);
            return new InternalLongTermsFacet(facetName, comparatorType, size, ImmutableList.<InternalLongTermsFacet.LongEntry>of(), aggregator.missing(), aggregator.total());
        } else {
            if (size < EntryPriorityQueue.LIMIT) {
                EntryPriorityQueue ordered = new EntryPriorityQueue(size, comparatorType.comparator());
                for (TLongIntIterator it = facets.iterator(); it.hasNext(); ) {
                    it.advance();
                    ordered.insertWithOverflow(new InternalLongTermsFacet.LongEntry(it.key(), it.value()));
                }
                InternalLongTermsFacet.LongEntry[] list = new InternalLongTermsFacet.LongEntry[ordered.size()];
                for (int i = ordered.size() - 1; i >= 0; i--) {
                    list[i] = (InternalLongTermsFacet.LongEntry) ordered.pop();
                }
                CacheRecycler.pushLongIntMap(facets);
                return new InternalLongTermsFacet(facetName, comparatorType, size, Arrays.asList(list), aggregator.missing(), aggregator.total());
            } else {
                BoundedTreeSet<InternalLongTermsFacet.LongEntry> ordered = new BoundedTreeSet<InternalLongTermsFacet.LongEntry>(comparatorType.comparator(), size);
                for (TLongIntIterator it = facets.iterator(); it.hasNext(); ) {
                    it.advance();
                    ordered.add(new InternalLongTermsFacet.LongEntry(it.key(), it.value()));
                }
                CacheRecycler.pushLongIntMap(facets);
                return new InternalLongTermsFacet(facetName, comparatorType, size, ordered, aggregator.missing(), aggregator.total());
View Full Code Here

Examples of org.elasticsearch.common.trove.map.hash.TLongIntHashMap

    @Override public Facet reduce(String name, List<Facet> facets) {
        if (facets.size() == 1) {
            return facets.get(0);
        }
        InternalIpTermsFacet first = (InternalIpTermsFacet) facets.get(0);
        TLongIntHashMap aggregated = CacheRecycler.popLongIntMap();
        long missing = 0;
        long total = 0;
        for (Facet facet : facets) {
            InternalIpTermsFacet mFacet = (InternalIpTermsFacet) facet;
            missing += mFacet.missingCount();
            total += mFacet.totalCount();
            for (LongEntry entry : mFacet.entries) {
                aggregated.adjustOrPutValue(entry.term, entry.count(), entry.count());
            }
        }

        BoundedTreeSet<LongEntry> ordered = new BoundedTreeSet<LongEntry>(first.comparatorType.comparator(), first.requiredSize);
        for (TLongIntIterator it = aggregated.iterator(); it.hasNext(); ) {
            it.advance();
            ordered.add(new LongEntry(it.key(), it.value()));
        }
        first.entries = ordered;
        first.missing = missing;
View Full Code Here

Examples of org.elasticsearch.common.trove.map.hash.TLongIntHashMap

    @Override public Facet reduce(String name, List<Facet> facets) {
        if (facets.size() == 1) {
            return facets.get(0);
        }
        InternalLongTermsFacet first = (InternalLongTermsFacet) facets.get(0);
        TLongIntHashMap aggregated = CacheRecycler.popLongIntMap();
        long missing = 0;
        long total = 0;
        for (Facet facet : facets) {
            InternalLongTermsFacet mFacet = (InternalLongTermsFacet) facet;
            missing += mFacet.missingCount();
            total += mFacet.totalCount();
            for (LongEntry entry : mFacet.entries) {
                aggregated.adjustOrPutValue(entry.term, entry.count(), entry.count());
            }
        }

        BoundedTreeSet<LongEntry> ordered = new BoundedTreeSet<LongEntry>(first.comparatorType.comparator(), first.requiredSize);
        for (TLongIntIterator it = aggregated.iterator(); it.hasNext(); ) {
            it.advance();
            ordered.add(new LongEntry(it.key(), it.value()));
        }
        first.entries = ordered;
        first.missing = missing;
View Full Code Here

Examples of org.elasticsearch.common.trove.map.hash.TLongIntHashMap

public class SerializationTest {

    @Test
    public void testSerializingEmptyCountingFacet() throws Exception {
        final TLongIntHashMap counts = CacheRecycler.popLongIntMap();
        testSerializingCountingFacet(counts);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.