private static Set<Feature<?>> computeEntrySetFeatures(Set<Feature<?>> features) { Set<Feature<?>> derivedFeatures = new HashSet<>(); derivedFeatures.addAll(features); derivedFeatures.remove(CollectionFeature.GENERAL_PURPOSE); derivedFeatures.remove(CollectionFeature.SUPPORTS_ADD); derivedFeatures.remove(CollectionFeature.ALLOWS_NULL_VALUES); derivedFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION); if (!derivedFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) { derivedFeatures.remove(CollectionFeature.SERIALIZABLE); } return derivedFeatures; }
private void addOrReplaceExpressionCoercion(Expression expression, Type type, Type superType) { NodeRef<Expression> ref = NodeRef.of(expression); expressionCoercions.put(ref, superType); if (typeManager.isTypeOnlyCoercion(type, superType)) { typeOnlyCoercions.add(ref); } else if (typeOnlyCoercions.contains(ref)) { typeOnlyCoercions.remove(ref); } } }
/** * Remove the given prefix from this context. * @param prefix the prefix to be removed */ public void removeBinding(@Nullable String prefix) { if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) { this.defaultNamespaceUri = ""; } else if (prefix != null) { String namespaceUri = this.prefixToNamespaceUri.remove(prefix); if (namespaceUri != null) { Set<String> prefixes = this.namespaceUriToPrefixes.get(namespaceUri); if (prefixes != null) { prefixes.remove(prefix); if (prefixes.isEmpty()) { this.namespaceUriToPrefixes.remove(namespaceUri); } } } } }
/** * connect adds an edge between a and b. Both nodes have * to be added prior to calling connect. * @param */ public void connect(BaseWork a, BaseWork b, SparkEdgeProperty edgeProp) { workGraph.get(a).add(b); invertedWorkGraph.get(b).add(a); roots.remove(b); leaves.remove(a); ImmutablePair<BaseWork, BaseWork> workPair = new ImmutablePair<BaseWork, BaseWork>(a, b); edgeProperties.put(workPair, edgeProp); }
@SuppressWarnings({"unchecked"}) public List<Modification> getModificationsForPipelineRange(final String pipelineName, final Integer fromCounter, final Integer toCounter) { return (List<Modification>) getHibernateTemplate().execute((HibernateCallback) session -> { final List<Long> fromInclusiveModificationList = fromInclusiveModificationsForPipelineRange(session, pipelineName, fromCounter, toCounter); final Set<Long> fromModifications = new TreeSet<>(fromInclusiveModificationsForPipelineRange(session, pipelineName, fromCounter, fromCounter)); final Set<Long> fromExclusiveModificationList = new HashSet<>(); for (Long modification : fromInclusiveModificationList) { if (fromModifications.contains(modification)) { fromModifications.remove(modification); } else { fromExclusiveModificationList.add(modification); } } SQLQuery query = session.createSQLQuery("SELECT * FROM modifications WHERE id IN (:ids) ORDER BY materialId ASC, id DESC"); query.addEntity(Modification.class); query.setParameterList("ids", fromExclusiveModificationList.isEmpty() ? fromInclusiveModificationList : fromExclusiveModificationList); return query.list(); }); }
private static Set<Feature<?>> computeAsMapFeatures(Set<Feature<?>> multimapFeatures) { Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures); derivedFeatures.remove(MapFeature.GENERAL_PURPOSE); derivedFeatures.remove(MapFeature.SUPPORTS_PUT); derivedFeatures.remove(MapFeature.ALLOWS_NULL_VALUES); derivedFeatures.add(MapFeature.ALLOWS_NULL_VALUE_QUERIES); derivedFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION); if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) { derivedFeatures.remove(CollectionFeature.SERIALIZABLE); } return derivedFeatures; }
private void updateToLoadAndDrop( List<Notice> notices, Map<String, LookupExtractorFactoryContainer> lookupsToLoad, Set<String> lookupsToDrop ) { for (Notice notice : notices) { if (notice instanceof LoadNotice) { LoadNotice loadNotice = (LoadNotice) notice; lookupsToLoad.put(loadNotice.lookupName, loadNotice.lookupExtractorFactoryContainer); lookupsToDrop.remove(loadNotice.lookupName); } else if (notice instanceof DropNotice) { DropNotice dropNotice = (DropNotice) notice; lookupsToDrop.add(dropNotice.lookupName); lookupsToLoad.remove(dropNotice.lookupName); } else { throw new ISE("Unknown Notice type [%s].", notice.getClass().getName()); } } }
private void buildDominatorTree() { VBStyleCollection<Integer, Integer> orderedIDoms = domEngine.getOrderedIDoms(); List<Integer> lstKeys = orderedIDoms.getLstKeys(); for (int index = lstKeys.size() - 1; index >= 0; index--) { Integer key = lstKeys.get(index); Integer idom = orderedIDoms.get(index); mapTreeBranches.computeIfAbsent(idom, k -> new HashSet<>()).add(key); } Integer firstid = statement.getFirst().id; mapTreeBranches.get(firstid).remove(firstid); }
public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); return (Method[]) methods.toArray(new Method[methods.size()]); }
/** * After each partition is parsed, we update the current metric totals with the total bytes * and number of records parsed. After all partitions have reported, we write the metric. */ public void record(TopicPartition partition, int bytes, int records) { this.unrecordedPartitions.remove(partition); this.fetchMetrics.increment(bytes, records); // collect and aggregate per-topic metrics String topic = partition.topic(); FetchMetrics topicFetchMetric = this.topicFetchMetrics.get(topic); if (topicFetchMetric == null) { topicFetchMetric = new FetchMetrics(); this.topicFetchMetrics.put(topic, topicFetchMetric); } topicFetchMetric.increment(bytes, records); if (this.unrecordedPartitions.isEmpty()) { // once all expected partitions from the fetch have reported in, record the metrics this.sensors.bytesFetched.record(this.fetchMetrics.fetchBytes); this.sensors.recordsFetched.record(this.fetchMetrics.fetchRecords); // also record per-topic metrics for (Map.Entry<String, FetchMetrics> entry: this.topicFetchMetrics.entrySet()) { FetchMetrics metric = entry.getValue(); this.sensors.recordTopicFetchMetrics(entry.getKey(), metric.fetchBytes, metric.fetchRecords); } } }
private void replacePhi(List<LabelStmt> phiLabels, Map<Local, Local> toReplace, Set<Value> set) { if (phiLabels != null) { for (LabelStmt labelStmt : phiLabels) { for (AssignStmt phi : labelStmt.phis) { Value[] ops = phi.getOp2().getOps(); for (Value op : ops) { Value n = toReplace.get(op); if (n != null) { set.add(n); } else { set.add(op); } } set.remove(phi.getOp1()); phi.getOp2().setOps(set.toArray(new Value[set.size()])); set.clear(); } } } }
Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) { Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures); for (Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) { if (derivedFeatures.contains(entry.getKey())) { derivedFeatures.add(entry.getValue()); } } if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) { derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE); } if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) { derivedFeatures.remove(CollectionFeature.SERIALIZABLE); } derivedFeatures.removeAll(GET_FEATURE_MAP.keySet()); return derivedFeatures; }
/** * Callback after singleton creation. * <p>The default implementation marks the singleton as not in creation anymore. * @param beanName the name of the singleton that has been created * @see #isSingletonCurrentlyInCreation */ protected void afterSingletonCreation(String beanName) { if (!this.inCreationCheckExclusions.contains(beanName) && !this.singletonsCurrentlyInCreation.remove(beanName)) { throw new IllegalStateException("Singleton '" + beanName + "' isn't currently in creation"); } }