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