aim4.util
Interface Registry<T>

Type Parameters:
T - the type of object in the registry
All Known Implementing Classes:
ArrayListRegistry, HashMapRegistry, WeakRefRegistry

public interface Registry<T>

A generic 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.
 

Method Detail

register

int register(T obj)
Register an object.

Parameters:
obj - the object
Returns:
the ID of the object

isIdExist

boolean isIdExist(int id)
Whether or not an object is in the registry.

Parameters:
id - the ID of the object
Returns:
Whether or not an object is in the registry

get

T get(int id)
Retrieve an object from the registry.

Parameters:
id - the ID of the object
Returns:
the object

getNewId

int getNewId()
Get a new unused ID.

Returns:
a new unused ID

set

void set(int id,
         T obj)
Associate an object to a given ID.

Parameters:
id - the ID
obj - the object

setNull

void setNull(int id)
Remove the object associated with a given ID from the registry.

Parameters:
id - the ID


Copyright © 2011. All Rights Reserved.