|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.binding.util.ArrayMap
public class ArrayMap
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.
Field Summary | |
---|---|
private java.util.ArrayList |
m_array
Array of values. |
private java.util.HashMap |
m_map
Map from values to indices. |
Constructor Summary | |
---|---|
ArrayMap()
Default constructor. |
|
ArrayMap(int size)
Constructor with initial capacity supplied. |
Method Summary | |
---|---|
int |
find(java.lang.Object obj)
Find existing object. |
int |
findOrAdd(java.lang.Object obj)
Add object. |
java.lang.Object |
get(int index)
Get value for index. |
int |
size()
Get count of values present. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList m_array
private java.util.HashMap m_map
Constructor Detail |
---|
public ArrayMap()
public ArrayMap(int size)
size
- initial capacity for array mapMethod Detail |
---|
public java.lang.Object get(int index)
index
- number to be looked up
public int find(java.lang.Object obj)
obj
- value to be found
-1
if not foundpublic int findOrAdd(java.lang.Object obj)
obj
- value to be added
public int size()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |