All Downloads are FREE. Search and download functionalities are using the official Maven repository.

griffon.javafx.collections.ObservableStream Maven / Gradle / Ivy

/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2008-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package griffon.javafx.collections;

import javafx.beans.binding.BooleanBinding;
import javafx.beans.binding.ObjectBinding;
import javafx.beans.value.ObservableLongValue;
import javafx.beans.value.ObservableValue;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Comparator;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author Andres Almiray
 * @since 2.13.0
 */
public interface ObservableStream {
    @Nonnull
    ObservableStream limit(long maxSize);

    @Nonnull
    ObservableStream limit(@Nonnull ObservableLongValue maxSize);

    @Nonnull
    ObservableStream skip(long n);

    @Nonnull
    ObservableStream skip(@Nonnull ObservableLongValue n);

    @Nonnull
    ObservableStream distinct();

    @Nonnull
    ObservableStream sorted();

    @Nonnull
    ObservableStream sorted(@Nonnull Comparator comparator);

    @Nonnull
    ObservableStream sorted(@Nonnull ObservableValue> comparator);

    @Nonnull
    ObservableStream filter(@Nonnull Predicate predicate);

    @Nonnull
     ObservableStream map(@Nonnull Function mapper);

    @Nonnull
     ObservableStream flatMap(@Nonnull Function> mapper);

    @Nonnull
    ObservableStream filter(@Nonnull ObservableValue> predicate);

    @Nonnull
     ObservableStream map(@Nonnull ObservableValue> mapper);

    @Nonnull
     ObservableStream flatMap(@Nonnull ObservableValue>> mapper);

    @Nonnull
    ObjectBinding reduce(@Nonnull BinaryOperator accumulator);

    @Nonnull
    ObjectBinding reduce(@Nullable T defaultValue, @Nonnull BinaryOperator accumulator);

    @Nonnull
    ObjectBinding reduce(@Nonnull Supplier supplier, @Nonnull BinaryOperator accumulator);

    @Nonnull
     ObjectBinding reduce(@Nullable U identity, @Nonnull BiFunction accumulator, @Nonnull BinaryOperator combiner);

    @Nonnull
    ObjectBinding reduce(@Nonnull ObservableValue> accumulator);

    @Nonnull
    ObjectBinding reduce(@Nullable T defaultValue, @Nonnull ObservableValue> accumulator);

    @Nonnull
    ObjectBinding reduce(@Nonnull Supplier supplier, @Nonnull ObservableValue> accumulator);

    @Nonnull
     ObjectBinding reduce(@Nonnull ObservableValue identity, @Nonnull ObservableValue> accumulator, @Nonnull ObservableValue> combiner);

    @Nonnull
    ObjectBinding min(@Nonnull Comparator comparator);

    @Nonnull
    ObjectBinding max(@Nonnull Comparator comparator);

    @Nonnull
    ObjectBinding min(@Nullable T defaultValue, @Nonnull Comparator comparator);

    @Nonnull
    ObjectBinding max(@Nullable T defaultValue, @Nonnull Comparator comparator);

    @Nonnull
    ObjectBinding min(@Nonnull Supplier supplier, @Nonnull Comparator comparator);

    @Nonnull
    ObjectBinding max(@Nonnull Supplier supplier, @Nonnull Comparator comparator);

    @Nonnull
    BooleanBinding anyMatch(@Nonnull Predicate predicate);

    @Nonnull
    BooleanBinding allMatch(@Nonnull Predicate predicate);

    @Nonnull
    BooleanBinding noneMatch(@Nonnull Predicate predicate);

    @Nonnull
    ObjectBinding min(@Nonnull ObservableValue> comparator);

    @Nonnull
    ObjectBinding max(@Nonnull ObservableValue> comparator);

    @Nonnull
    ObjectBinding min(@Nullable T defaultValue, @Nonnull ObservableValue> comparator);

    @Nonnull
    ObjectBinding max(@Nullable T defaultValue, @Nonnull ObservableValue> comparator);

    @Nonnull
    ObjectBinding min(@Nonnull Supplier supplier, @Nonnull ObservableValue> comparator);

    @Nonnull
    ObjectBinding max(@Nonnull Supplier supplier, @Nonnull ObservableValue> comparator);

    @Nonnull
    BooleanBinding anyMatch(@Nonnull ObservableValue> predicate);

    @Nonnull
    BooleanBinding allMatch(@Nonnull ObservableValue> predicate);

    @Nonnull
    BooleanBinding noneMatch(@Nonnull ObservableValue> predicate);

    @Nonnull
    ObjectBinding findFirst();

    @Nonnull
    ObjectBinding findFirst(@Nullable T defaultValue);

    @Nonnull
    ObjectBinding findFirst(@Nonnull Supplier supplier);

    @Nonnull
    ObjectBinding findAny();

    @Nonnull
    ObjectBinding findAny(@Nullable T defaultValue);

    @Nonnull
    ObjectBinding findAny(@Nonnull Supplier supplier);
}