|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrlgamekit.objects.Registry<E>
public class Registry<E>
Since the LayeredMap class can only store integers, but most games need some kind of objects to keep track of item data, this class was introduced to create the association from integers (map data) to some sort of game-defined item data. It can be used more generic, too, for any sort of integer based object lookup. This class uses a Cardinal object internally to keep object allocation for map lookup low.
Cardinal,
LayeredMap| Constructor Summary | |
|---|---|
Registry()
Create a new object registry for type E |
|
| Method Summary | |
|---|---|
void |
clear()
Clear the registry from all registered items. |
int |
findKey(E item)
Find the key for the item in the registry. |
E |
get(int keyValue)
Look up the object bound to keyValue. |
int |
nextFreeKey()
Find the next free key in the registry. |
void |
put(int key,
E item)
Put a new object into the registry |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Registry()
| Method Detail |
|---|
public void put(int key,
E item)
key - The objects keyitem - The objectpublic int findKey(E item)
item - The item to search.
public int nextFreeKey()
public E get(int keyValue)
keyValue - The key value
public void clear()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||