W
Wojtek
If I have a mask set:
public static final long MASK_NONE = 0x000;
public static final long MASK_ONE = 0x001;
public static final long MASK_TWO = 0x002;
public static final long MASK_THREE = 0x004;
public static final long MASK_FOUR = 0x008;
public static final long MASK_FIVE = 0x010;
I can quite easily use them together:
MASK_ONE | MASK_FOUR
However as a constructor/method parameter I am passing in a long. I
would like to use an enum:
public enum Mask
{
NONE, ONE, TWO, THREE, FOUR, FIVE;
}
However the spec does not allow concatination of enums. To get around
this I can:
1. use a variable number of parameters
2. use an array of enums
3. use an object which contains a list (map) of the enums. However this
is as bad as having a complete set of isMaskX/setMaskX for each mask
type in some object.
4. list every possible combination of enums as their own enum. However
this expands really quickly and adding a new enum would be a royal
pain.
5. throw up my hands in disgust and keep using the longs
6. some other elegant solution?
public static final long MASK_NONE = 0x000;
public static final long MASK_ONE = 0x001;
public static final long MASK_TWO = 0x002;
public static final long MASK_THREE = 0x004;
public static final long MASK_FOUR = 0x008;
public static final long MASK_FIVE = 0x010;
I can quite easily use them together:
MASK_ONE | MASK_FOUR
However as a constructor/method parameter I am passing in a long. I
would like to use an enum:
public enum Mask
{
NONE, ONE, TWO, THREE, FOUR, FIVE;
}
However the spec does not allow concatination of enums. To get around
this I can:
1. use a variable number of parameters
2. use an array of enums
3. use an object which contains a list (map) of the enums. However this
is as bad as having a complete set of isMaskX/setMaskX for each mask
type in some object.
4. list every possible combination of enums as their own enum. However
this expands really quickly and adding a new enum would be a royal
pain.
5. throw up my hands in disgust and keep using the longs
6. some other elegant solution?