| java.lang.Object com.sun.midp.rms.IntToIntMapper
IntToIntMapper | class IntToIntMapper (Code) | | This class implements a mapping int --> int.
(Analogs: vector, hash table, etc.) The implementation uses two arrays:
one for keys and one for values.
The methods are analogous to those of the java.util.Vector class.
|
Field Summary | |
protected int | capacityIncrement The amount by which the capacity is automatically
incremented when its size becomes greater than its capacity. | public int | defaultValue The value returned if no value is associated with the key
searched for. | protected int | elementCount The number of valid components in the mapper. | protected int | elementData The array buffer into which the values to be returned are
stored. | protected int | elementKey The array buffer into which the values used as keys are
stored. |
Constructor Summary | |
public | IntToIntMapper(int initialCapacity, int defaultElement, int capacityIncrement) Constructs an empty mapper with the specified initial capacity and
capacity increment. |
Method Summary | |
public synchronized int | elementAt(int key) Returns the component at the specified key. | public boolean | isEmpty() Tests if this mapper has no components. | public synchronized void | removeElementAt(int key) Deletes the component at the specified key. | public synchronized void | setElementAt(int obj, int key) Sets the component at the specified key of this
mapper to be the specified value. | public int | size() Returns the number of components in this mapper. |
capacityIncrement | protected int capacityIncrement(Code) | | The amount by which the capacity is automatically
incremented when its size becomes greater than its capacity. If
the capacity increment is 0 , the capacity
is doubled each time it needs to grow.
|
defaultValue | public int defaultValue(Code) | | The value returned if no value is associated with the key
searched for.
|
elementCount | protected int elementCount(Code) | | The number of valid components in the mapper.
|
elementData | protected int elementData(Code) | | The array buffer into which the values to be returned are
stored. The capacity of the mapper is the length of this array buffer.
|
elementKey | protected int elementKey(Code) | | The array buffer into which the values used as keys are
stored. The capacity of the mapper is the length of this array buffer.
|
IntToIntMapper | public IntToIntMapper(int initialCapacity, int defaultElement, int capacityIncrement)(Code) | | Constructs an empty mapper with the specified initial capacity and
capacity increment.
Parameters: initialCapacity - the initial capacity of the mapper. Parameters: defaultElement - the value that gets returned forkeys that are not there Parameters: capacityIncrement - the amount by which the capacity isincreased when the mapper overflows.(0 means "to be doubled") exception: IllegalArgumentException - if the specified initial capacityis negative |
elementAt | public synchronized int elementAt(int key)(Code) | | Returns the component at the specified key.
Parameters: key - a key identifying an object in the mapper the component at the specified key, or the default valueif an invalid key was given. |
isEmpty | public boolean isEmpty()(Code) | | Tests if this mapper has no components.
true if this mapper has no components;false otherwise. |
removeElementAt | public synchronized void removeElementAt(int key)(Code) | | Deletes the component at the specified key. Nothing happens if
no component has been associated with the key.
Parameters: key - the key of the object to remove. |
setElementAt | public synchronized void setElementAt(int obj, int key)(Code) | | Sets the component at the specified key of this
mapper to be the specified value. The previous component at that
position is discarded.
Parameters: obj - what the component is to be set to. Parameters: key - the key for that component. |
size | public int size()(Code) | | Returns the number of components in this mapper.
the number of components in this mapper. |
|
|