Package cdc.enums

Interface Mask<M extends Mask<M,V>,V>

Type Parameters:
M - The mask type.
V - The value type.
All Known Implementing Classes:
AbstractMask, BooleanMask, EnumMask, NullableBooleanMask, NullableEnumMask

public interface Mask<M extends Mask<M,V>,V>
Interface describing a mask based on DagType.
Author:
Damien Carbonne
  • Method Summary

    Modifier and Type
    Method
    Description
    and(M other)
    Returns the intersection of this mask with another one.
    and(V value)
     
    and(V... values)
     
    clear(V value)
    Returns a new mask reduced with a value.
    boolean
    contains(M other)
    Returns true if all values of this mask are contained in another mask.
    boolean
    contains(V... values)
     
     
     
     
     
    boolean
    isClear(V value)
    Returns true if a value is not contained.
    boolean
     
    boolean
     
    boolean
     
    boolean
    isSet(V value)
    Returns true if a value is contained.
    not()
    Returns the complement of this mask (at the time of calling this method).
    or(M other)
    Returns the union of this mask with another one.
    or(V value)
     
    or(V... values)
     
    set(V value)
    Returns a new mask augmented with a value.
    set(V value, boolean enabled)
    Sets or clears a value.
    setAll(boolean enabled)
    Returns an empty or full mask.
    toString(Function<? super V,String> valueToString, String separator)
    Returns a string representation of this mask.
  • Method Details

    • getSupport

      MaskSupport<M,V> getSupport()
      Returns:
      The enum type.
    • isNullable

      boolean isNullable()
      Returns:
      true if this mask is a nullable mask.
    • isEmpty

      boolean isEmpty()
      Returns:
      true if this mask is empty.
    • isFull

      boolean isFull()
      Returns:
      true if this mask is full. The result may change if underlying enum type is dynamic.
    • getValues

      Set<V> getValues()
      Returns:
      The values that are set.
    • isSet

      boolean isSet(V value)
      Returns true if a value is contained.
      Parameters:
      value - The value.
      Returns:
      true if value is contained in this mask.
    • isClear

      boolean isClear(V value)
      Returns true if a value is not contained.
      Parameters:
      value - The value.
      Returns:
      true if value is not contained in this mask.
    • set

      M set(V value, boolean enabled)
      Sets or clears a value.
      Parameters:
      value - The value.
      enabled - If true sets the value, otherwise clears it.
      Returns:
      A new mask with value set or cleared.
    • set

      M set(V value)
      Returns a new mask augmented with a value.

      If value is already set, returns this mask.

      Parameters:
      value - The value.
      Returns:
      A new mask augmented with value.
    • clear

      M clear(V value)
      Returns a new mask reduced with a value.

      If value is already cleared, returns this mask.

      Parameters:
      value - The value.
      Returns:
      A new mask reduced with value.
    • setAll

      M setAll(boolean enabled)
      Returns an empty or full mask.

      The full mask may change if underlying enum type is dynamic.

      Parameters:
      enabled - If true, creates a full mask. An empty mask otherwise.
      Returns:
      An empty or full mask.
    • empty

      M empty()
      Returns:
      An empty mask.
    • full

      M full()
      Returns:
      A full mask at the time of call. Result may change if underlying enum type is dynamic.
    • and

      M and(M other)
      Returns the intersection of this mask with another one.
      Parameters:
      other - The other mask.
      Returns:
      The intersection of this mask with other.
    • and

      M and(V value)
    • and

      M and(V... values)
    • or

      M or(M other)
      Returns the union of this mask with another one.
      Parameters:
      other - The other mask.
      Returns:
      The union of this mask with other.
    • or

      M or(V value)
    • or

      M or(V... values)
    • not

      M not()
      Returns the complement of this mask (at the time of calling this method).
      Returns:
      The complement of this mask (at the time of calling this method).
    • contains

      boolean contains(M other)
      Returns true if all values of this mask are contained in another mask.
      Parameters:
      other - The other mask.
      Returns:
      true if all values of this mask are contained in other.
    • contains

      boolean contains(V... values)
    • toString

      String toString(Function<? super V,String> valueToString, String separator)
      Returns a string representation of this mask.
      Parameters:
      valueToString - The function used to converter values (including null) to string.
      separator - The separator to use between values.
      Returns:
      A string representation of this mask.