类java.util.function.ToLongBiFunction源码实例Demo

下面列出了怎么用java.util.function.ToLongBiFunction的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: crate   文件: EngineTestCase.java
protected InternalEngine createEngine(
    IndexSettings indexSettings,
    Store store,
    Path translogPath,
    MergePolicy mergePolicy,
    @Nullable IndexWriterFactory indexWriterFactory,
    @Nullable BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier,
    @Nullable LongSupplier globalCheckpointSupplier,
    @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) throws IOException {
    return createEngine(
        indexSettings,
        store,
        translogPath,
        mergePolicy,
        indexWriterFactory,
        localCheckpointTrackerSupplier,
        seqNoForOperation,
        globalCheckpointSupplier);
}
 
源代码2 项目: crate   文件: EngineTestCase.java
protected InternalEngine createEngine(@Nullable IndexWriterFactory indexWriterFactory,
                                      @Nullable BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier,
                                      @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation,
                                      EngineConfig config) throws IOException {
    final Store store = config.getStore();
    final Directory directory = store.directory();
    if (Lucene.indexExists(directory) == false) {
        store.createEmpty();
        final String translogUuid = Translog.createEmptyTranslog(config.getTranslogConfig().getTranslogPath(),
            SequenceNumbers.NO_OPS_PERFORMED, shardId, primaryTerm.get());
        store.associateIndexWithNewTranslog(translogUuid);

    }
    InternalEngine internalEngine = createInternalEngine(indexWriterFactory, localCheckpointTrackerSupplier, seqNoForOperation, config);
    internalEngine.recoverFromTranslog(translogHandler, Long.MAX_VALUE);
    return internalEngine;
}
 
源代码3 项目: mug   文件: BiCollectors.java
/**
 * Returns a {@link BiCollector} that produces the sum of a long-valued
 * function applied to the input pair.  If no input entries are present,
 * the result is 0.
 *
 * @since 3.2
 */
public static <K, V> BiCollector<K, V, Long> summingLong(
    ToLongBiFunction<? super K, ? super V> mapper) {
  requireNonNull(mapper);
  return new BiCollector<K, V, Long>() {
    @Override
    public <E> Collector<E, ?, Long> splitting(
        Function<E, K> toKey, Function<E, V> toValue) {
      return Collectors.summingLong(e -> mapper.applyAsLong(toKey.apply(e), toValue.apply(e)));
    }
  };
}
 
源代码4 项目: mug   文件: BiCollectors.java
/**
 * Returns a {@link BiCollector} that produces the arithmetic mean of a long-valued
 * function applied to the input pair.  If no input entries are present,
 * the result is 0.
 *
 * @since 3.2
 */
public static <K, V> BiCollector<K, V, Double> averagingLong(
    ToLongBiFunction<? super K, ? super V> mapper) {
  requireNonNull(mapper);
  return new BiCollector<K, V, Double>() {
    @Override
    public <E> Collector<E, ?, Double> splitting(
        Function<E, K> toKey, Function<E, V> toValue) {
      return Collectors.averagingLong(e -> mapper.applyAsLong(toKey.apply(e), toValue.apply(e)));
    }
  };
}
 
源代码5 项目: mug   文件: BiCollectors.java
/**
 * Returns a {@link BiCollector} which applies an {@code long}-producing
 * mapping function to each input pair, and returns summary statistics
 * for the resulting values.
 *
 *
 * @since 3.2
 */
public static <K, V> BiCollector<K, V, LongSummaryStatistics> summarizingLong(
    ToLongBiFunction<? super K, ? super V> mapper) {
  requireNonNull(mapper);
  return new BiCollector<K, V, LongSummaryStatistics>() {
    @Override
    public <E> Collector<E, ?, LongSummaryStatistics> splitting(
        Function<E, K> toKey, Function<E, V> toValue) {
      return Collectors.summarizingLong(e -> mapper.applyAsLong(toKey.apply(e), toValue.apply(e)));
    }
  };
}
 
源代码6 项目: rheem   文件: DefaultCardinalityEstimator.java
public DefaultCardinalityEstimator(double certaintyProb,
                                   int numInputs,
                                   boolean isAllowMoreInputs,
                                   ToLongBiFunction<long[], Configuration> singlePointEstimator) {
    this.certaintyProb = certaintyProb;
    this.numInputs = numInputs;
    this.singlePointEstimator = singlePointEstimator;
    this.isAllowMoreInputs = isAllowMoreInputs;
}
 
源代码7 项目: rheem   文件: DefaultLoadEstimator.java
public DefaultLoadEstimator(int numInputs,
                            int numOutputs,
                            double correctnessProbability,
                            CardinalityEstimate nullCardinalityReplacement,
                            ToLongBiFunction<long[], long[]> singlePointFunction) {
    this(
            numInputs, numOutputs, correctnessProbability, nullCardinalityReplacement,
            (context, inputEstimates, outputEstimates) -> singlePointFunction.applyAsLong(inputEstimates, outputEstimates)
    );
}
 
源代码8 项目: rheem   文件: IntervalLoadEstimator.java
public IntervalLoadEstimator(int numInputs,
                             int numOutputs,
                             double correctnessProbability,
                             ToLongBiFunction<long[], long[]> lowerBoundEstimator,
                             ToLongBiFunction<long[], long[]> upperBoundEstimator) {
    this(numInputs, numOutputs, correctnessProbability, null, lowerBoundEstimator, upperBoundEstimator);
}
 
源代码9 项目: rheem   文件: IntervalLoadEstimator.java
public IntervalLoadEstimator(int numInputs,
                             int numOutputs,
                             double correctnessProbablity,
                             CardinalityEstimate nullCardinalityReplacement,
                             ToLongBiFunction<long[], long[]> lowerBoundEstimator,
                             ToLongBiFunction<long[], long[]> upperBoundEstimator) {

    super(nullCardinalityReplacement);
    this.numInputs = numInputs;
    this.numOutputs = numOutputs;
    this.correctnessProbablity = correctnessProbablity;
    this.lowerBoundEstimator = lowerBoundEstimator;
    this.upperBoundEstimator = upperBoundEstimator;
}
 
源代码10 项目: crate   文件: EngineTestCase.java
protected InternalEngine createEngine(
    Store store,
    Path translogPath,
    BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier,
    ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) throws IOException {
    return createEngine(
        defaultSettings, store, translogPath, newMergePolicy(), null, localCheckpointTrackerSupplier, null, seqNoForOperation);
}
 
源代码11 项目: crate   文件: EngineTestCase.java
protected InternalEngine createEngine(
    IndexSettings indexSettings,
    Store store,
    Path translogPath,
    MergePolicy mergePolicy,
    @Nullable IndexWriterFactory indexWriterFactory,
    @Nullable BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier,
    @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation,
    @Nullable LongSupplier globalCheckpointSupplier) throws IOException {
    EngineConfig config = config(indexSettings, store, translogPath, mergePolicy, null, globalCheckpointSupplier);
    return createEngine(indexWriterFactory, localCheckpointTrackerSupplier, seqNoForOperation, config);
}
 
源代码12 项目: rheem   文件: DefaultLoadEstimator.java
public DefaultLoadEstimator(int numInputs,
                            int numOutputs,
                            double correctnessProbability,
                            ToLongBiFunction<long[], long[]> singlePointFunction) {
    this(numInputs, numOutputs, correctnessProbability, null, singlePointFunction);
}
 
源代码13 项目: rheem   文件: DefaultLoadEstimator.java
/**
 * Utility to create new instances: Rounds the results of a given estimation function.
 */
@SuppressWarnings("unused")
public static ToLongBiFunction<long[], long[]> rounded(ToDoubleBiFunction<long[], long[]> f) {
    return (inputCards, outputCards) -> Math.round(f.applyAsDouble(inputCards, outputCards));
}
 
源代码14 项目: rheem   文件: IntervalLoadEstimator.java
/**
 * Utility to create new instances: Rounds the results of a given estimation function.
 */
@SuppressWarnings("unused")
public static ToLongBiFunction<long[], long[]> rounded(ToDoubleBiFunction<long[], long[]> f) {
    return (inputCards, outputCards) -> Math.round(f.applyAsDouble(inputCards, outputCards));
}
 
 类所在包
 同包方法