java.util.function.ToLongBiFunction Java Examples
The following examples show how to use
java.util.function.ToLongBiFunction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EngineTestCase.java From crate with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: EngineTestCase.java From crate with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: BiCollectors.java From mug with Apache License 2.0 | 5 votes |
/** * 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))); } }; }
Example #4
Source File: BiCollectors.java From mug with Apache License 2.0 | 5 votes |
/** * 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))); } }; }
Example #5
Source File: BiCollectors.java From mug with Apache License 2.0 | 5 votes |
/** * 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))); } }; }
Example #6
Source File: DefaultCardinalityEstimator.java From rheem with Apache License 2.0 | 5 votes |
public DefaultCardinalityEstimator(double certaintyProb, int numInputs, boolean isAllowMoreInputs, ToLongBiFunction<long[], Configuration> singlePointEstimator) { this.certaintyProb = certaintyProb; this.numInputs = numInputs; this.singlePointEstimator = singlePointEstimator; this.isAllowMoreInputs = isAllowMoreInputs; }
Example #7
Source File: DefaultLoadEstimator.java From rheem with Apache License 2.0 | 5 votes |
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) ); }
Example #8
Source File: IntervalLoadEstimator.java From rheem with Apache License 2.0 | 5 votes |
public IntervalLoadEstimator(int numInputs, int numOutputs, double correctnessProbability, ToLongBiFunction<long[], long[]> lowerBoundEstimator, ToLongBiFunction<long[], long[]> upperBoundEstimator) { this(numInputs, numOutputs, correctnessProbability, null, lowerBoundEstimator, upperBoundEstimator); }
Example #9
Source File: IntervalLoadEstimator.java From rheem with Apache License 2.0 | 5 votes |
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; }
Example #10
Source File: EngineTestCase.java From crate with Apache License 2.0 | 5 votes |
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); }
Example #11
Source File: EngineTestCase.java From crate with Apache License 2.0 | 5 votes |
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); }
Example #12
Source File: DefaultLoadEstimator.java From rheem with Apache License 2.0 | 4 votes |
public DefaultLoadEstimator(int numInputs, int numOutputs, double correctnessProbability, ToLongBiFunction<long[], long[]> singlePointFunction) { this(numInputs, numOutputs, correctnessProbability, null, singlePointFunction); }
Example #13
Source File: DefaultLoadEstimator.java From rheem with Apache License 2.0 | 4 votes |
/** * 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)); }
Example #14
Source File: IntervalLoadEstimator.java From rheem with Apache License 2.0 | 4 votes |
/** * 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)); }