public class FlagSet<E extends Enum<E>> extends Object implements ValuedEnum<E>
ValuedEnum
) as combinable C
flags (see fromValues(E...)
).Modifier and Type | Class and Description |
---|---|
static class |
FlagSet.IntFlagSet<E extends Enum<E>> |
Modifier and Type | Method and Description |
---|---|
FlagSet<E> |
and(E... valuesToBeCombinedWithOR) |
static <EE extends Enum<EE>> |
createFlagSet(int value,
Class<EE> enumClass) |
static <EE extends Enum<EE>> |
createFlagSet(long value,
Class<EE> enumClass) |
static <EE extends Enum<EE>> |
createFlagSet(long value,
EE... enumValue) |
boolean |
equals(Object o) |
static <EE extends Enum<EE>> |
fromValue(int value,
Class<EE> enumClass) |
static <EE extends Enum<EE>> |
fromValue(int value,
EE... enumValues) |
static <EE extends Enum<EE>> |
fromValue(long value,
EE... enumValues) |
static <EE extends Enum<EE>> |
fromValue(ValuedEnum<EE> value) |
static <E extends Enum<E>> |
fromValues(E... enumValues) |
static List<Long> |
getBits(long value)
Isolate bits that are set in the value.
|
Class<E> |
getEnumClass() |
boolean |
has(E... valuesToBeCombinedWithOR)
Tests if the flagset value is contains the OR combination of all the
given values combined with bitwise OR operations.
|
int |
hashCode() |
boolean |
is(E... valuesToBeCombinedWithOR)
Tests if the flagset value is equal to the OR combination of all the
given values combined with bitwise OR operations.
|
Iterator<E> |
iterator() |
FlagSet<E> |
or(E... valuesToBeCombinedWithOR) |
E |
toEnum() |
String |
toString() |
long |
value()
Get the integral value of this FlagSet.
|
FlagSet<E> |
without(E... valuesToBeCombinedWithOR) |
forEach, spliterator
public static <EE extends Enum<EE>> FlagSet<EE> createFlagSet(long value, Class<EE> enumClass)
public static <EE extends Enum<EE>> FlagSet.IntFlagSet<EE> createFlagSet(int value, Class<EE> enumClass)
public static <EE extends Enum<EE>> FlagSet<EE> fromValue(ValuedEnum<EE> value)
public static <EE extends Enum<EE>> FlagSet<EE> createFlagSet(long value, EE... enumValue)
public static <EE extends Enum<EE>> IntValuedEnum<EE> fromValue(int value, Class<EE> enumClass)
public static <EE extends Enum<EE>> IntValuedEnum<EE> fromValue(int value, EE... enumValues)
public static <EE extends Enum<EE>> ValuedEnum<EE> fromValue(long value, EE... enumValues)
public static List<Long> getBits(long value)
getBits(0xf)
yields 0x1, 0x2, 0x4, 0x8value
- public long value()
value
in interface ValuedEnum<E extends Enum<E>>
public Class<E> getEnumClass()
public boolean is(E... valuesToBeCombinedWithOR)
E v = ...; // E is an enum type
if (v == (E_V1 | E_V2)) { ... }
Can be translated to the following Java + BridJ code :
FlagSet<E> v = ...;
if (v.is(E_V1, E_V2)) { ... }
public boolean has(E... valuesToBeCombinedWithOR)
E v = ...; // E is an enum type
if (v & (E_V1 | E_V2)) { ... }
Can be translated to the following Java + BridJ code :
FlagSet<E> v = ...;
if (v.has(E_V1, E_V2)) { ... }
public static <E extends Enum<E>> FlagSet<E> fromValues(E... enumValues)
Copyright © 2009-2020. All Rights Reserved.