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
static class Entities.BinaryEntityMap extends Entities.ArrayEntityMap
-
-
Field Summary
-
Fields inherited from class org.apache.commons.lang.Entities.ArrayEntityMap
growBy, names, size, values
-
-
Constructor Summary
Constructors Constructor Description BinaryEntityMap()
Constructs a new instance ofBinaryEntityMap
.BinaryEntityMap(int growBy)
Constructs a new instance ofArrayEntityMap
specifying the size by which the underlying array should grow.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String name, int value)
Add an entry to this entity map.private int
binarySearch(int key)
Performs a binary search of the entity array for the specified key.java.lang.String
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 Detail
-
BinaryEntityMap
public BinaryEntityMap()
Constructs a new instance ofBinaryEntityMap
.
-
BinaryEntityMap
public BinaryEntityMap(int growBy)
Constructs a new instance ofArrayEntityMap
specifying the size by which the underlying array should grow.- Parameters:
growBy
- array will be initialized to and will grow by this amount
-
-
Method Detail
-
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
public void add(java.lang.String name, int value)
Add an entry to this entity map.
- Specified by:
add
in interfaceEntities.EntityMap
- Overrides:
add
in classEntities.ArrayEntityMap
- Parameters:
name
- the entity namevalue
- the entity value
-
name
public java.lang.String name(int value)
Returns the name of the entity identified by the specified value.
- Specified by:
name
in interfaceEntities.EntityMap
- Overrides:
name
in classEntities.ArrayEntityMap
- Parameters:
value
- the value to locate- Returns:
- entity name associated with the specified value
-
-