Search in sources :

Example 6 with IntArrayList

use of com.carrotsearch.hppc.IntArrayList in project elasticsearch by elastic.

the class MultiTermVectorsShardResponse method readFrom.

@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    responses = new ArrayList<>(size);
    failures = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        if (in.readBoolean()) {
            TermVectorsResponse response = new TermVectorsResponse();
            response.readFrom(in);
            responses.add(response);
        } else {
            responses.add(null);
        }
        if (in.readBoolean()) {
            failures.add(MultiTermVectorsResponse.Failure.readFailure(in));
        } else {
            failures.add(null);
        }
    }
}
Also used : IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 7 with IntArrayList

use of com.carrotsearch.hppc.IntArrayList in project elasticsearch by elastic.

the class PortsRange method ports.

public int[] ports() throws NumberFormatException {
    final IntArrayList ports = new IntArrayList();
    iterate(new PortCallback() {

        @Override
        public boolean onPortNumber(int portNumber) {
            ports.add(portNumber);
            return false;
        }
    });
    return ports.toArray();
}
Also used : IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 8 with IntArrayList

use of com.carrotsearch.hppc.IntArrayList in project elasticsearch by elastic.

the class MultiGetShardRequest method readFrom.

@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        items.add(MultiGetRequest.Item.readItem(in));
    }
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    realtime = in.readBoolean();
}
Also used : IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 9 with IntArrayList

use of com.carrotsearch.hppc.IntArrayList in project graphhopper by graphhopper.

the class QueryGraph method fillVirtualEdges.

void fillVirtualEdges(IntObjectMap<VirtualEdgeIterator> node2Edge, int towerNode, EdgeExplorer mainExpl) {
    if (isVirtualNode(towerNode))
        throw new IllegalStateException("Node should not be virtual:" + towerNode + ", " + node2Edge);
    VirtualEdgeIterator vIter = node2Edge.get(towerNode);
    IntArrayList ignoreEdges = new IntArrayList(vIter.count() * 2);
    while (vIter.next()) {
        EdgeIteratorState edge = queryResults.get(vIter.getAdjNode() - mainNodes).getClosestEdge();
        ignoreEdges.add(edge.getEdge());
    }
    vIter.reset();
    EdgeIterator iter = mainExpl.setBaseNode(towerNode);
    while (iter.next()) {
        if (!ignoreEdges.contains(iter.getEdge()))
            vIter.add(iter.detach(false));
    }
}
Also used : IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 10 with IntArrayList

use of com.carrotsearch.hppc.IntArrayList in project graphhopper by graphhopper.

the class PrepareRoutingSubnetworks method keepLargeNetworks.

/**
     * Deletes all but the largest subnetworks.
     */
int keepLargeNetworks(PrepEdgeFilter filter, List<IntArrayList> components) {
    if (components.size() <= 1)
        return 0;
    int maxCount = -1;
    IntIndexedContainer oldComponent = null;
    int allRemoved = 0;
    FlagEncoder encoder = filter.getEncoder();
    EdgeExplorer explorer = ghStorage.createEdgeExplorer(filter);
    for (IntArrayList component : components) {
        if (maxCount < 0) {
            maxCount = component.size();
            oldComponent = component;
            continue;
        }
        int removedEdges;
        if (maxCount < component.size()) {
            // new biggest area found. remove old
            removedEdges = removeEdges(explorer, encoder, oldComponent, minNetworkSize);
            maxCount = component.size();
            oldComponent = component;
        } else {
            removedEdges = removeEdges(explorer, encoder, component, minNetworkSize);
        }
        allRemoved += removedEdges;
    }
    if (allRemoved > ghStorage.getAllEdges().getMaxId() / 2)
        throw new IllegalStateException("Too many total edges were removed: " + allRemoved + ", all edges:" + ghStorage.getAllEdges().getMaxId());
    return allRemoved;
}
Also used : FlagEncoder(com.graphhopper.routing.util.FlagEncoder) IntIndexedContainer(com.carrotsearch.hppc.IntIndexedContainer) GHIntArrayList(com.graphhopper.coll.GHIntArrayList) IntArrayList(com.carrotsearch.hppc.IntArrayList)

Aggregations

IntArrayList (com.carrotsearch.hppc.IntArrayList)27 GHIntArrayList (com.graphhopper.coll.GHIntArrayList)6 PrepEdgeFilter (com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.PrepEdgeFilter)4 FlagEncoder (com.graphhopper.routing.util.FlagEncoder)4 GraphHopperStorage (com.graphhopper.storage.GraphHopperStorage)4 Test (org.junit.Test)4 ScoreDoc (org.apache.lucene.search.ScoreDoc)3 BBox (com.graphhopper.util.shapes.BBox)2 GHPoint (com.graphhopper.util.shapes.GHPoint)2 IOException (java.io.IOException)2 UUID (java.util.UUID)2 FetchSearchResult (org.elasticsearch.search.fetch.FetchSearchResult)2 ShardFetchRequest (org.elasticsearch.search.fetch.ShardFetchRequest)2 QuerySearchResult (org.elasticsearch.search.query.QuerySearchResult)2 QuerySearchResultProvider (org.elasticsearch.search.query.QuerySearchResultProvider)2 IntHashSet (com.carrotsearch.hppc.IntHashSet)1 IntIndexedContainer (com.carrotsearch.hppc.IntIndexedContainer)1 IntObjectHashMap (com.carrotsearch.hppc.IntObjectHashMap)1 GHBitSet (com.graphhopper.coll.GHBitSet)1 GHBitSetImpl (com.graphhopper.coll.GHBitSetImpl)1