| Modifier and Type | Field and Description |
|---|---|
| private Object | |
| private int | |
| private int | |
| private final HashMap | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | SmallMap(int
the maximum number of entries maxElements)Create a map with the given maximum number of entries. |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public void | |
| public Object | Returns: the object or nullthe id of the object id, boolean only return it if available, otherwise return null ifAvailable)Get an object from the map if it is stored. |
| cache | back to summary |
|---|---|
| private Object cache | |
| cacheId | back to summary |
|---|---|
| private int cacheId | |
| lastId | back to summary |
|---|---|
| private int lastId | |
| map | back to summary |
|---|---|
| private final HashMap<Integer, Object> map | |
| maxElements | back to summary |
|---|---|
| private final int maxElements | |
| SmallMap | back to summary |
|---|---|
| public SmallMap(int maxElements) Create a map with the given maximum number of entries.
| |
| addObject | back to summary |
|---|---|
| public int addObject(int id, Object o) Add an object to the map. If the size of the map is larger than twice the maximum size, objects with a low id are removed.
| |
| freeObject | back to summary |
|---|---|
| public void freeObject(int id) Remove an object from the map.
| |
| getObject | back to summary |
|---|---|
| public Object getObject(int id, boolean ifAvailable) Get an object from the map if it is stored.
| |