| |
|
| java.lang.Object org.jibx.binding.util.ArrayMap
ArrayMap | public class ArrayMap (Code) | | Array with reverse mapping from values to indices. This operates as the
combination of an array with ordinary int indices and a hashmap from values
back to the corresponding index position. Values are assured to be unique.
author: Dennis M. Sosnoski |
Constructor Summary | |
public | ArrayMap() Default constructor. | public | ArrayMap(int size) Constructor with initial capacity supplied. |
Method Summary | |
public int | find(Object obj) Find existing object. | public int | findOrAdd(Object obj) Add object. | public Object | get(int index) Get value for index. | public int | size() Get count of values present. |
ArrayMap | public ArrayMap()(Code) | | Default constructor.
|
ArrayMap | public ArrayMap(int size)(Code) | | Constructor with initial capacity supplied.
Parameters: size - initial capacity for array map |
find | public int find(Object obj)(Code) | | Find existing object. If the supplied value object is present in the
array map its index position is returned.
Parameters: obj - value to be found index number assigned to value, or -1 if not found |
findOrAdd | public int findOrAdd(Object obj)(Code) | | Add object. If the supplied value object is already present in the array
map the existing index position is returned.
Parameters: obj - value to be added index number assigned to value |
get | public Object get(int index)(Code) | | Get value for index. The index must be within the valid range (from 0 to
one less than the number of values present).
Parameters: index - number to be looked up value at that index position |
size | public int size()(Code) | | Get count of values present.
number of values in array map |
|
|
|