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;
}
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));
}
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());
}
}
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();
}
}
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);
}
}
}
Aggregations