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 ofArrayEntityMapspecifying the size by which the underlying array should grow.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String name, int value)Add an entry to this entity map.private intbinarySearch(int key)Performs a binary search of the entity array for the specified key.java.lang.Stringname(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 ofArrayEntityMapspecifying 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:
addin interfaceEntities.EntityMap- Overrides:
addin 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:
namein interfaceEntities.EntityMap- Overrides:
namein classEntities.ArrayEntityMap- Parameters:
value- the value to locate- Returns:
- entity name associated with the specified value
-
-