Package org.wildfly.common.format
Class NumericFlags
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.wildfly.common.flags.Flags<E,This>
-
- org.wildfly.common.format.NumericFlags
-
- All Implemented Interfaces:
java.lang.Iterable<NumericFlag>
,java.util.Collection<NumericFlag>
,java.util.Set<NumericFlag>
,java.util.SortedSet<NumericFlag>
public final class NumericFlags extends Flags<E,This>
-
-
Field Summary
Fields Modifier and Type Field Description static NumericFlags
NONE
The empty set of numeric flags.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NumericFlag
castItemOrNull(java.lang.Object obj)
Get the item (cast to the correctenum
type), ornull
if it is not of the correct type.protected NumericFlags
castThis(java.lang.Object obj)
Cast the given object to this class, throwing an exception if the cast fails.void
forbid(E flag)
void
forbidAll()
void
forbidAllBut(E flag)
protected NumericFlag
itemOf(int index)
Get the flag item with the given index.static NumericFlags
of(NumericFlag flag)
static NumericFlags
of(NumericFlag flag1, NumericFlag flag2)
protected NumericFlags
this_()
Returnthis
.protected NumericFlags
value(int bits)
Get the set value of the given bit combination.-
Methods inherited from class org.wildfly.common.flags.Flags
comparator, complement, contains, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, descendingIterator, equals, equals, equals, first, forEach, hashCode, headSet, isEmpty, iterator, last, size, subSet, tailSet, toArray, toArray, toString, with, with, with, with, with, without, without
-
-
-
-
Field Detail
-
NONE
public static final NumericFlags NONE
The empty set of numeric flags.
-
-
Method Detail
-
of
public static NumericFlags of(NumericFlag flag)
-
of
public static NumericFlags of(NumericFlag flag1, NumericFlag flag2)
-
this_
protected NumericFlags this_()
Description copied from class:Flags
Returnthis
.- Specified by:
this_
in classFlags<NumericFlag,NumericFlags>
- Returns:
this
-
value
protected NumericFlags value(int bits)
Description copied from class:Flags
Get the set value of the given bit combination. The bit combination may contain extraneous one-bits so any bits beyond the bit of the last flag should be masked off if an array is used for lookup.- Specified by:
value
in classFlags<NumericFlag,NumericFlags>
- Parameters:
bits
- the bit combination (possibly with extra bits)- Returns:
- the set instance
-
itemOf
protected NumericFlag itemOf(int index)
Description copied from class:Flags
Get the flag item with the given index.- Specified by:
itemOf
in classFlags<NumericFlag,NumericFlags>
- Parameters:
index
- the index- Returns:
- the flag
-
castItemOrNull
protected NumericFlag castItemOrNull(java.lang.Object obj)
Description copied from class:Flags
Get the item (cast to the correctenum
type), ornull
if it is not of the correct type.- Specified by:
castItemOrNull
in classFlags<NumericFlag,NumericFlags>
- Parameters:
obj
- the object to cast- Returns:
- the cast object, or
null
-
castThis
protected NumericFlags castThis(java.lang.Object obj)
Description copied from class:Flags
Cast the given object to this class, throwing an exception if the cast fails.- Specified by:
castThis
in classFlags<NumericFlag,NumericFlags>
- Parameters:
obj
- the object to cast- Returns:
- the cast object
-
forbidAll
public final void forbidAll()
-
forbidAllBut
public final void forbidAllBut(E flag)
-
forbid
public void forbid(E flag)
-
-