Package org.apache.commons.lang
Class Entities.BinaryEntityMap
java.lang.Object
org.apache.commons.lang.Entities.ArrayEntityMap
org.apache.commons.lang.Entities.BinaryEntityMap
- All Implemented Interfaces:
Entities.EntityMap
- Enclosing class:
- Entities
-
Field Summary
Fields inherited from class org.apache.commons.lang.Entities.ArrayEntityMap
growBy, names, size, values -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance ofBinaryEntityMap.BinaryEntityMap(int growBy) Constructs a new instance ofArrayEntityMapspecifying the size by which the underlying array should grow. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an entry to this entity map.private intbinarySearch(int key) Performs a binary search of the entity array for the specified key.name(int value) Returns the name of the entity identified by the specified value.Methods inherited from class org.apache.commons.lang.Entities.ArrayEntityMap
ensureCapacity, value
-
Constructor Details
-
BinaryEntityMap
public BinaryEntityMap()Constructs a new instance ofBinaryEntityMap. -
BinaryEntityMap
public BinaryEntityMap(int growBy) Constructs a new instance ofArrayEntityMapspecifying the size by which the underlying array should grow.- Parameters:
growBy- array will be initialized to and will grow by this amount
-
-
Method Details
-
binarySearch
private int binarySearch(int key) Performs a binary search of the entity array for the specified key. This method is based on code inArrays.- Parameters:
key- the key to be found- Returns:
- the index of the entity array matching the specified key
-
add
Add an entry to this entity map.
- Specified by:
addin interfaceEntities.EntityMap- Overrides:
addin classEntities.ArrayEntityMap- Parameters:
name- the entity namevalue- the entity value
-
name
Returns the name of the entity identified by the specified value.
- Specified by:
namein interfaceEntities.EntityMap- Overrides:
namein classEntities.ArrayEntityMap- Parameters:
value- the value to locate- Returns:
- entity name associated with the specified value
-