public class EnumSet
extends java.lang.Object
static final int
values, including
translating them to and from String
representations. It's
intended for use with relatively small nonnegative int values.Modifier and Type | Class | Description |
---|---|---|
static class |
EnumSet.EnumItem |
Enumeration pair information.
|
Modifier and Type | Field | Description |
---|---|---|
private java.lang.String[] |
m_indexedNames |
Enumeration names in index number order.
|
private EnumSet.EnumItem[] |
m_items |
Actual item definitions (used for extensions).
|
private int[] |
m_orderedIndexes |
Index values corresponding to sorted names.
|
private java.lang.String[] |
m_orderedNames |
Enumeration names in sort order.
|
static int |
VALUE_LIMIT |
Maximum
int value supported for enumerations. |
Constructor | Description |
---|---|
EnumSet(int start,
java.lang.String[] names) |
Constructor from array of names.
|
EnumSet(EnumSet.EnumItem[] items) |
Constructor from array of enumeration items.
|
EnumSet(EnumSet base,
int start,
java.lang.String[] names) |
Constructor from existing enumeration with added names.
|
Modifier and Type | Method | Description |
---|---|---|
private static EnumSet.EnumItem[] |
buildItems(int start,
java.lang.String[] names) |
Generate array of enumeration items from array of names.
|
void |
checkValue(int value) |
Check value with exception.
|
java.lang.String |
getName(int value) |
Get name for value if defined.
|
java.lang.String |
getNameChecked(int value) |
Get name for value.
|
int |
getValue(java.lang.String name) |
Get value for name if defined.
|
int |
getValueChecked(java.lang.String name) |
Get value for name.
|
int |
maxIndex() |
Get maximum index value in enumeration set.
|
private static EnumSet.EnumItem[] |
mergeItems(EnumSet base,
int start,
java.lang.String[] names) |
Generate array of enumeration items from base enumeration and array of
names.
|
public static final int VALUE_LIMIT
int
value supported for enumerations.private final EnumSet.EnumItem[] m_items
private final java.lang.String[] m_indexedNames
private final java.lang.String[] m_orderedNames
private final int[] m_orderedIndexes
public EnumSet(EnumSet.EnumItem[] items)
items
- array of enumeration items (will be reordered)public EnumSet(int start, java.lang.String[] names)
start
- item value for first added namenames
- array of names (no null
entries allowed)public EnumSet(EnumSet base, int start, java.lang.String[] names)
base
- base enumeration to be extendedstart
- item value for first added namenames
- array of names (no null
entries allowed)private static EnumSet.EnumItem[] buildItems(int start, java.lang.String[] names)
start
- item value for first added namenames
- array of names (no null
entries allowed)private static EnumSet.EnumItem[] mergeItems(EnumSet base, int start, java.lang.String[] names)
base
- base enumeration to be extendedstart
- item value for first added namenames
- array of names (no null
entries allowed)public java.lang.String getName(int value)
value
- enumeration valuenull
if not definedpublic java.lang.String getNameChecked(int value)
value
- enumeration valuepublic int getValue(java.lang.String name)
name
- possible enumeration name-1
if not found in enumerationpublic int getValueChecked(java.lang.String name)
name
- enumeration namepublic void checkValue(int value)
value
- public int maxIndex()