Search in sources :

Example 16 with IntArrayList

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

the class Path method calcNodes.

/**
     * @return the uncached node indices of the tower nodes in this path.
     */
public IntIndexedContainer calcNodes() {
    final IntArrayList nodes = new IntArrayList(edgeIds.size() + 1);
    if (edgeIds.isEmpty()) {
        if (isFound()) {
            nodes.add(endNode);
        }
        return nodes;
    }
    int tmpNode = getFromNode();
    nodes.add(tmpNode);
    forEveryEdge(new EdgeVisitor() {

        @Override
        public void next(EdgeIteratorState eb, int i) {
            nodes.add(eb.getAdjNode());
        }
    });
    return nodes;
}
Also used : GHIntArrayList(com.graphhopper.coll.GHIntArrayList) IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 17 with IntArrayList

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

the class PrepareRoutingSubnetworksTest method testFindSubnetworks.

@Test
public void testFindSubnetworks() {
    GraphHopperStorage g = createSubnetworkTestStorage();
    PrepEdgeFilter filter = new PrepEdgeFilter(carFlagEncoder);
    PrepareRoutingSubnetworks instance = new PrepareRoutingSubnetworks(g, Collections.singletonList(carFlagEncoder));
    List<IntArrayList> components = instance.findSubnetworks(filter);
    assertEquals(3, components.size());
    // start is at 0 => large network
    assertEquals(Helper.createTList(0, 7, 3, 13, 5), components.get(0));
    // next smallest and unvisited node is 1 => big network
    assertEquals(Helper.createTList(1, 8, 4, 2, 11, 12, 9, 15), components.get(1));
    assertEquals(Helper.createTList(6, 14, 10), components.get(2));
}
Also used : IntArrayList(com.carrotsearch.hppc.IntArrayList) PrepEdgeFilter(com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.PrepEdgeFilter) GraphHopperStorage(com.graphhopper.storage.GraphHopperStorage) Test(org.junit.Test)

Example 18 with IntArrayList

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

the class ShardRequest method readFrom.

@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    routing = in.readOptionalString();
    jobId = new UUID(in.readLong(), in.readLong());
    int size = in.readVInt();
    locations = new IntArrayList(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
    }
}
Also used : UUID(java.util.UUID) IntArrayList(com.carrotsearch.hppc.IntArrayList)

Example 19 with IntArrayList

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

the class ShardResponse method readFrom.

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

Example 20 with IntArrayList

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

the class MultiGetShardResponse 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()) {
            GetResponse response = new GetResponse();
            response.readFrom(in);
            responses.add(response);
        } else {
            responses.add(null);
        }
        if (in.readBoolean()) {
            failures.add(MultiGetResponse.Failure.readFailure(in));
        } else {
            failures.add(null);
        }
    }
}
Also used : 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