Search in sources :

Example 26 with DoubleStream

use of java.util.stream.DoubleStream in project GDSC-SMLM by aherbert.

the class TcPalmAnalysis method plotHistogram.

/**
 * Plot a histogram of the extracted statistic.
 *
 * @param show set to true to show the histogram
 * @param wo the window organiser
 * @param clusters the clusters
 * @param name the name
 * @param function the function to extract the plotted statistic
 * @param predicate the predicate to filter the stream of data
 * @param action the action to use on the histogram plot (to set non-standard options)
 */
private static void plotHistogram(boolean show, WindowOrganiser wo, LocalList<ClusterData> clusters, String name, ToDoubleFunction<ClusterData> function, DoublePredicate predicate, Consumer<HistogramPlotBuilder> action) {
    if (!show) {
        return;
    }
    final StoredData data = new StoredData(clusters.size());
    DoubleStream stream = clusters.stream().mapToDouble(function);
    if (predicate != null) {
        stream = stream.filter(predicate);
    }
    stream.forEach(data::add);
    final HistogramPlotBuilder builder = new HistogramPlotBuilder(TITLE, data, name);
    action.accept(builder);
    builder.show(wo);
}
Also used : StoredData(uk.ac.sussex.gdsc.core.utils.StoredData) HistogramPlotBuilder(uk.ac.sussex.gdsc.core.ij.HistogramPlot.HistogramPlotBuilder) DoubleStream(java.util.stream.DoubleStream)

Example 27 with DoubleStream

use of java.util.stream.DoubleStream in project keycloak by keycloak.

the class ClosingLongStream method asDoubleStream.

@Override
public DoubleStream asDoubleStream() {
    DoubleStream result = delegate.asDoubleStream();
    close();
    return result;
}
Also used : DoubleStream(java.util.stream.DoubleStream)

Example 28 with DoubleStream

use of java.util.stream.DoubleStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_DoubleStream_Test method isEqualTo_should_honor_comparing_the_same_mocked_stream.

@Test
void isEqualTo_should_honor_comparing_the_same_mocked_stream() {
    DoubleStream stream = mock(DoubleStream.class);
    assertThat(stream).isEqualTo(stream);
}
Also used : DoubleStream(java.util.stream.DoubleStream) Test(org.junit.jupiter.api.Test)

Example 29 with DoubleStream

use of java.util.stream.DoubleStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_DoubleStream_Test method isSameAs_should_check_the_original_stream_without_consuming_it.

@Test
void isSameAs_should_check_the_original_stream_without_consuming_it() {
    DoubleStream stream = mock(DoubleStream.class);
    assertThat(stream).isSameAs(stream);
    verifyNoInteractions(stream);
}
Also used : DoubleStream(java.util.stream.DoubleStream) Test(org.junit.jupiter.api.Test)

Example 30 with DoubleStream

use of java.util.stream.DoubleStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_DoubleStream_Test method isInstanceOfAny_should_check_the_original_stream_without_consuming_it.

@Test
void isInstanceOfAny_should_check_the_original_stream_without_consuming_it() {
    DoubleStream stream = mock(DoubleStream.class);
    assertThat(stream).isInstanceOfAny(DoubleStream.class, String.class);
    verifyNoInteractions(stream);
}
Also used : DoubleStream(java.util.stream.DoubleStream) Test(org.junit.jupiter.api.Test)

Aggregations

DoubleStream (java.util.stream.DoubleStream)34 IntStream (java.util.stream.IntStream)11 Test (org.junit.jupiter.api.Test)10 List (java.util.List)9 Arrays (java.util.Arrays)7 Map (java.util.Map)6 Random (java.util.Random)6 Collectors (java.util.stream.Collectors)6 LongStream (java.util.stream.LongStream)6 Stream (java.util.stream.Stream)5 Collections (java.util.Collections)4 HashMap (java.util.HashMap)4 LinkedList (java.util.LinkedList)4 Function (java.util.function.Function)4 IgniteBiTuple (org.apache.ignite.lang.IgniteBiTuple)4 StorageConstants (org.apache.ignite.ml.math.StorageConstants)4 IgniteFunction (org.apache.ignite.ml.math.functions.IgniteFunction)4 SparseDistributedMatrix (org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix)4 DenseLocalOnHeapVector (org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector)4 LabeledVectorDouble (org.apache.ignite.ml.structures.LabeledVectorDouble)4