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

cdc.util.enums.MaskSupport Maven / Gradle / Ivy

package cdc.util.enums;

import java.util.function.Predicate;

/**
 * Interface describing a mask type.
 *
 * @author Damien Carbonne
 *
 * @param  The mask type.
 * @param  The value type.
 */
public interface MaskSupport, V> {
    /**
     * @return The mask class.
     */
    public Class getMaskClass();

    /**
     * @return The associated List type.
     */
    public ListType getType();

    /**
     * @return {@code true} if {@code null} is a valid mask value.
     */
    public boolean isNullable();

    /**
     * @return The empty mask.
     */
    public M empty();

    /**
     * @return The fill mask (at the time of call).
     */
    public M full();

    /**
     * @return The empty mask.
     */
    public M create();

    /**
     * Creates a mask with one value.
     *
     * @param value The value.
     * @return The mask that contains {@code value}.
     */
    public M create(V value);

    /**
     * Creates a mask from an array.
     *
     * @param values The values (possibly including {@code null}).
     * @return The created mask.
     */
    @SuppressWarnings("unchecked")
    public M create(V... values);

    /**
     * Creates a mask from an iterable.
     *
     * @param values The values (possibly including {@code null}).
     * @return The created mask.
     */
    public M create(Iterable values);

    /**
     * Creates a mask from a predicate.
     *
     * @param predicate A predicate of values to include.
     * @return The created mask.
     */
    public M create(Predicate predicate);

    /**
     * Creates a full or empty mask.
     * 

* WARNING: Full is meaningful at the time of calling this constructor. * It may become false if values change after this call. * * @param enabled If {@code true}, creates a full mask. An empty mask otherwise. * @return The created mask. */ public M create(boolean enabled); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy