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 TypeMethodDescriptionReturns the intersection of this mask with another one.Returns a new mask reduced with a value.booleanReturnstrueif all values of this mask are contained in another mask.booleanempty()full()booleanReturnstrueif a value is not contained.booleanisEmpty()booleanisFull()booleanbooleanReturnstrueif a value is contained.not()Returns the complement of this mask (at the time of calling this method).Returns the union of this mask with another one.Returns a new mask augmented with a value.Sets or clears a value.setAll(boolean enabled) Returns an empty or full mask.Returns a string representation of this mask.
-
Method Details
-
getSupport
MaskSupport<M,V> getSupport()- Returns:
- The enum type.
-
isNullable
boolean isNullable()- Returns:
trueif this mask is a nullable mask.
-
isEmpty
boolean isEmpty()- Returns:
trueif this mask is empty.
-
isFull
boolean isFull()- Returns:
trueif this mask is full. The result may change if underlying enum type is dynamic.
-
getValues
- Returns:
- The values that are set.
-
isSet
Returnstrueif a value is contained.- Parameters:
value- The value.- Returns:
trueifvalueis contained in this mask.
-
isClear
Returnstrueif a value is not contained.- Parameters:
value- The value.- Returns:
trueifvalueis not contained in this mask.
-
set
Sets or clears a value.- Parameters:
value- The value.enabled- Iftruesets the value, otherwise clears it.- Returns:
- A new mask with
valueset or cleared.
-
set
Returns a new mask augmented with a value.If
valueis already set, returns this mask.- Parameters:
value- The value.- Returns:
- A new mask augmented with
value.
-
clear
Returns a new mask reduced with a value.If
valueis already cleared, returns this mask.- Parameters:
value- The value.- Returns:
- A new mask reduced with
value.
-
setAll
Returns an empty or full mask.The full mask may change if underlying enum type is dynamic.
- Parameters:
enabled- Iftrue, 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
Returns the intersection of this mask with another one.- Parameters:
other- The other mask.- Returns:
- The intersection of this mask with
other.
-
and
-
and
-
or
Returns the union of this mask with another one.- Parameters:
other- The other mask.- Returns:
- The union of this mask with
other.
-
or
-
or
-
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
Returnstrueif all values of this mask are contained in another mask.- Parameters:
other- The other mask.- Returns:
trueif all values of this mask are contained inother.
-
contains
-
toString
Returns a string representation of this mask.- Parameters:
valueToString- The function used to converter values (includingnull) to string.separator- The separator to use between values.- Returns:
- A string representation of this mask.
-