|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object aim4.util.WeakRefRegistry<T>
public class WeakRefRegistry<T>
A registry based on weak references.
Constructor Summary | |
---|---|
WeakRefRegistry()
Create a weak reference registry. |
|
WeakRefRegistry(int initId)
Create a weak reference registry. |
Method Summary | |
---|---|
T |
get(int id)
Retrieve an object from the registry. |
int |
getNewId()
Get a new unused ID. |
boolean |
isIdExist(int id)
Whether or not an object is in the registry. |
int |
register(T obj)
Register an object. |
void |
set(int id,
T obj)
Associate an object to a given ID. |
void |
setNull(int id)
Remove the object associated with a given ID from the registry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WeakRefRegistry()
public WeakRefRegistry(int initId)
initId
- the initial IDMethod Detail |
---|
public int register(T obj)
Registry
register
in interface Registry<T>
obj
- the object
public boolean isIdExist(int id)
Registry
isIdExist
in interface Registry<T>
id
- the ID of the object
public T get(int id)
Registry
get
in interface Registry<T>
id
- the ID of the object
public int getNewId()
Registry
getNewId
in interface Registry<T>
public void set(int id, T obj)
Registry
set
in interface Registry<T>
id
- the IDobj
- the objectpublic void setNull(int id)
Registry
setNull
in interface Registry<T>
id
- the ID
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |