private Graph buildInterferenceGraph(List<Map<Instruction, BitSet>> liveInInformation, Program program) { GraphBuilder builder = new GraphBuilder(program.variableCount()); for (Map<Instruction, BitSet> blockLiveIn : liveInInformation) { for (BitSet liveVarsSet : blockLiveIn.values()) { IntArrayList liveVars = new IntArrayList(); for (int i = liveVarsSet.nextSetBit(0); i >= 0; i = liveVarsSet.nextSetBit(i + 1)) { liveVars.add(i); } int[] liveVarArray = liveVars.toArray(); for (int i = 0; i < liveVarArray.length - 1; ++i) { for (int j = i + 1; j < liveVarArray.length; ++j) { builder.addEdge(liveVarArray[i], liveVarArray[j]); builder.addEdge(liveVarArray[j], liveVarArray[i]); } } } } return builder.build(); }
double tmp = maxDistInMeter / minResolutionInMeter; tmp = tmp * tmp; IntArrayList tmpEntries = new IntArrayList();
public void apply(Program program, MethodReference method) { depthsByBlock = new IntArrayList(program.basicBlockCount()); for (int i = 0; i < program.basicBlockCount(); ++i) { depthsByBlock.add(0); } instructionsToSkip = new HashSet<>(); while (applyOnce(program)) { devirtualize(program, method, dependencyInfo); } depthsByBlock = null; instructionsToSkip = null; new UnreachableBasicBlockEliminator().optimize(program); }
private void initIfNecessary() { if (mappings != null) { return; } mappings = new int[program.basicBlockCount()]; previousPtr = new IntArrayList(program.basicBlockCount() * 2); firstPtr = new IntArrayList(program.basicBlockCount() * 2); isLastInSequence = new ByteArrayList(program.basicBlockCount() * 2); for (int i = 0; i < mappings.length; ++i) { mappings[i] = i; previousPtr.add(i); firstPtr.add(i); isLastInSequence.add((byte) 1); } variableDefinedAt = ProgramUtils.getVariableDefinitionPlaces(program); }
continue; final IntArrayList intList = new IntArrayList(20); list.add(intList); new BreadthFirstSearch() {
IntArrayList component = new IntArrayList(); int node; while ((node = nodeStack.removeLast()) != start) {
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)); } }
/** * @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 index, int prevEdgeId) { nodes.add(eb.getAdjNode()); } @Override public void finish() { } }); return nodes; }
MultiGetShardRequest(MultiGetRequest multiGetRequest, String index, int shardId) { super(index); this.shardId = shardId; locations = new IntArrayList(); items = new ArrayList<>(); preference = multiGetRequest.preference; realtime = multiGetRequest.realtime; refresh = multiGetRequest.refresh; }
MultiTermVectorsShardRequest(String index, int shardId) { super(index); this.shardId = shardId; locations = new IntArrayList(); requests = new ArrayList<>(); }
MultiTermVectorsShardResponse() { locations = new IntArrayList(); responses = new ArrayList<>(); failures = new ArrayList<>(); }
MultiGetShardResponse() { locations = new IntArrayList(); responses = new ArrayList<>(); failures = new ArrayList<>(); }
void addTrip(ZoneId zoneId, int time, List<TripWithStopTimeAndArrivalNode> arrivalNodes, TripWithStopTimes trip, GtfsRealtime.TripDescriptor tripDescriptor, boolean frequencyBased) { IntArrayList boardEdges = new IntArrayList(); IntArrayList alightEdges = new IntArrayList(); StopTime prev = null; int arrivalNode = -1;
/** * Create a list from a variable number of arguments or an array of <code>int</code>. * The elements are copied from the argument to the internal buffer. */ /* */ public static IntArrayList from(int... elements) { final IntArrayList list = new IntArrayList(elements.length); list.add(elements); return list; } }
/** * Builds an array, with potential null elements, with docs to load. */ public IntArrayList[] fillDocIdsToLoad(int numShards, ScoreDoc[] shardDocs) { IntArrayList[] docIdsToLoad = new IntArrayList[numShards]; for (ScoreDoc shardDoc : shardDocs) { IntArrayList shardDocIdsToLoad = docIdsToLoad[shardDoc.shardIndex]; if (shardDocIdsToLoad == null) { shardDocIdsToLoad = docIdsToLoad[shardDoc.shardIndex] = new IntArrayList(); } shardDocIdsToLoad.add(shardDoc.doc); } return docIdsToLoad; }
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(); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); int size = in.readVInt(); locations = new IntArrayList(size); requests = new ArrayList<>(size); for (int i = 0; i < size; i++) { locations.add(in.readVInt()); requests.add(TermVectorsRequest.readTermVectorsRequest(in)); } preference = in.readOptionalString(); }
@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); } } }
@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); } } }
@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(); }