|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bridj.FlagSet<E>
public class FlagSet<E extends Enum<E>>
Set of int-valued enum values that is itself int-valued (bitwise OR of all the values).
This helps use Java enums (that implement ValuedEnum) as combinable C flags (see fromValues(E...) ).
| Nested Class Summary | |
|---|---|
static class |
FlagSet.IntFlagSet<E extends Enum<E>>
|
| Method Summary | ||
|---|---|---|
FlagSet<E> |
and(E... valuesToBeCombinedWithOR)
|
|
boolean |
equals(Object o)
|
|
static
|
fromValue(int value,
Class<EE> enumClass)
|
|
static
|
fromValue(int value,
EE... enumValue)
|
|
static
|
fromValue(long value,
Class<EE> enumClass)
|
|
static
|
fromValue(long value,
EE... enumValue)
|
|
static
|
fromValue(ValuedEnum<EE> value)
|
|
static
|
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)
|
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic Iterator<E> iterator()
iterator in interface Iterable<E extends Enum<E>>public E toEnum()
public String toString()
toString in class Object
public static <EE extends Enum<EE>> FlagSet<EE> fromValue(long value,
Class<EE> enumClass)
public static <EE extends Enum<EE>> FlagSet.IntFlagSet<EE> fromValue(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> fromValue(long value,
EE... enumValue)
public static <EE extends Enum<EE>> FlagSet.IntFlagSet<EE> fromValue(int value,
EE... enumValue)
public static List<Long> getBits(long value)
getBits(0xf) yields 0x1, 0x2, 0x4, 0x8
value -
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 FlagSet<E> or(E... valuesToBeCombinedWithOR)
public FlagSet<E> without(E... valuesToBeCombinedWithOR)
public FlagSet<E> and(E... valuesToBeCombinedWithOR)
public static <E extends Enum<E>> FlagSet<E> fromValues(E... enumValues)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||