void addType(int variable, int degree, String typeName) { int entry = nodeMapping[packNodeAndDegree(variable, degree)]; if (getNodeTypes(entry).add(getTypeByName(typeName))) { nodeChanged[entry] = true; changed = true; } }
void schedulePropagation(Transition consumer, DependencyType type) { if (!consumer.destination.filter(type)) { return; } if (consumer.pendingTypes == null && propagationDepth < PROPAGATION_STACK_THRESHOLD && consumer.pointsToDomainOrigin() && consumer.destination.propagateCount < 20) { ++propagationDepth; consumer.consume(type); --propagationDepth; } else { if (consumer.pendingTypes == null) { pendingTransitions.add(consumer); consumer.pendingTypes = new IntHashSet(50); } consumer.pendingTypes.add(type.index); } }
void schedulePropagation(Transition consumer, DependencyType[] types) { if (types.length == 0) { return; } if (types.length == 1) { schedulePropagation(consumer, types[0]); return; } if (consumer.pendingTypes == null && propagationDepth < PROPAGATION_STACK_THRESHOLD && consumer.pointsToDomainOrigin() && consumer.destination.propagateCount < 20) { ++propagationDepth; consumer.consume(types); --propagationDepth; } else { if (consumer.pendingTypes == null) { pendingTransitions.add(consumer); consumer.pendingTypes = new IntHashSet(Math.max(50, types.length)); } consumer.pendingTypes.ensureCapacity(types.length + consumer.pendingTypes.size()); for (DependencyType type : types) { consumer.pendingTypes.add(type.index); } } }
private void propagateAlongCasts() { for (ValueCast cast : casts) { int fromNode = nodeMapping[packNodeAndDegree(cast.fromVariable, 0)]; if (!formerNodeChanged[fromNode] && !nodeChanged[fromNode]) { continue; } int toNode = nodeMapping[packNodeAndDegree(cast.toVariable, 0)]; IntHashSet targetTypes = getNodeTypes(toNode); for (IntCursor cursor : types[fromNode]) { if (targetTypes.contains(cursor.value)) { continue; } String className = typeList.get(cursor.value); ValueType type; if (className.startsWith("[")) { type = ValueType.parseIfPossible(className); if (type == null) { type = ValueType.arrayOf(ValueType.object("java.lang.Object")); } } else { type = ValueType.object(className); } if (hierarchy.isSuperType(cast.targetType, type, false)) { changed = true; nodeChanged[toNode] = true; targetTypes.add(cursor.value); } } } }
.mapToInt(GtfsRealtime.TripUpdate.StopTimeUpdate::getStopSequence) .forEach(skippedStopSequenceNumber -> { blockedEdges.add(boardEdges[skippedStopSequenceNumber]); blockedEdges.add(leaveEdges[skippedStopSequenceNumber]); }); GtfsReader.TripWithStopTimes tripWithStopTimes = toTripWithStopTimes(feed, tripUpdate);
@Override public void add(int key) { delegate.add(key); }
@Override public void bulkAdd(int[] keys) { for (int key : keys) { delegate.add(key); } }
/** * Adds all elements from the given iterable to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ public int addAll(Iterable<? extends IntCursor> iterable) { int count = 0; for (IntCursor cursor : iterable) { if (add(cursor.value)) { count++; } } return count; }
private void propagateException(String thrownTypeName, BasicBlock block) { for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) { String expectedType = tryCatch.getExceptionType(); if (expectedType == null || hierarchy.isSuperType(expectedType, thrownTypeName, false)) { if (tryCatch.getHandler().getExceptionVariable() == null) { break; } int exceptionNode = packNodeAndDegree(tryCatch.getHandler().getExceptionVariable().getIndex(), 0); exceptionNode = nodeMapping[exceptionNode]; int thrownType = getTypeByName(thrownTypeName); if (getNodeTypes(exceptionNode).add(thrownType)) { nodeChanged[exceptionNode] = true; changed = true; } break; } } }
/** * This method makes edges crossing the specified border inaccessible to split a bigger area into smaller subnetworks. * This is important for the world wide use case to limit the maximum distance and also to detect unreasonable routes faster. */ protected IntHashSet findBorderEdgeIds(SpatialRuleLookup ruleLookup) { AllEdgesIterator allEdgesIterator = graph.getAllEdges(); NodeAccess nodeAccess = graph.getNodeAccess(); IntHashSet inaccessible = new IntHashSet(); while (allEdgesIterator.next()) { int adjNode = allEdgesIterator.getAdjNode(); SpatialRule ruleAdj = ruleLookup.lookupRule(nodeAccess.getLatitude(adjNode), nodeAccess.getLongitude(adjNode)); int baseNode = allEdgesIterator.getBaseNode(); SpatialRule ruleBase = ruleLookup.lookupRule(nodeAccess.getLatitude(baseNode), nodeAccess.getLongitude(baseNode)); if (ruleAdj != ruleBase) { inaccessible.add(allEdgesIterator.getEdge()); } } return inaccessible; }
/** * Adds all elements from the given list (vararg) to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ /* */ public final int addAll(int... elements) { ensureCapacity(elements.length); int count = 0; for (int e : elements) { if (add(e)) { count++; } } return count; }
public IntSet(NullableTimeMilliHolder[] holders) { for(NullableTimeMilliHolder h : holders) { if(h.isSet == 0) { // one null is never equal to another null. continue; } intSet.add(h.value); } }
public IntSet(NullableIntHolder[] holders) { for(NullableIntHolder h : holders) { if(h.isSet == 0) { // one null is never equal to another null. continue; } intSet.add(h.value); } }
@Override public boolean apply(int key, AStarEntry value) { value.weight = value.weightOfVisitedPath + weightApprox.approximate(value.adjNode, false); ignoreExplorationFrom.add(key); return true; } });
@Override public boolean apply(int key, AStarEntry value) { value.weight = value.weightOfVisitedPath + weightApprox.approximate(value.adjNode, true); ignoreExplorationTo.add(key); return true; } });
@Override public GeolocationContextMapping build() { if(precisions.isEmpty()) { precisions.add(GeoHashUtils.PRECISION); } int[] precisionArray = precisions.toArray(); Arrays.sort(precisionArray); return new GeolocationContextMapping(name, precisionArray, neighbors, defaultLocations, fieldName); }
@Override public GeolocationContextMapping build() { if(precisions.isEmpty()) { precisions.add(GeoHashUtils.PRECISION); } int[] precisionArray = precisions.toArray(); Arrays.sort(precisionArray); return new GeolocationContextMapping(name, precisionArray, neighbors, defaultLocations, fieldName); }
private void relax(int nodeId) { IntHashSet connected = new IntHashSet(); int w; do { w = stack.pop(); onStack.clear(w); connected.add(w); } while (w != nodeId); processSCC(nodeId, connected); }
private void relax(int nodeId) { IntHashSet connected = new IntHashSet(); int w; do { w = stack.pop(); onStack.clear(w); connected.add(w); } while (w != nodeId); processSCC(nodeId, connected); }
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); set = new CircuitBreakerIntHashSet(size); for (long i = 0; i < size; i++) { set.add(in.readVInt()); } }