private static TmfEventTypeManager fEventTypeManager = null;
// The available types, per context
- private HashMap<String, HashMap<String, ITmfEventType>> fEventTypes;
+ private final HashMap<String, HashMap<String, ITmfEventType>> fEventTypes;
// ------------------------------------------------------------------------
// Constructors
* @return the TmfEventTypeManager singleton
*/
public static synchronized TmfEventTypeManager getInstance() {
- if (fEventTypeManager == null) {
+ if (fEventTypeManager == null)
fEventTypeManager = new TmfEventTypeManager();
- }
return fEventTypeManager;
}
* @param context the target context
* @param type the type to add
*/
- public synchronized void add(String context, ITmfEventType type) {
+ public synchronized void add(final String context, final ITmfEventType type) {
HashMap<String, ITmfEventType> types = fEventTypes.get(context);
- if (types == null) {
+ if (types == null)
types = new HashMap<String, ITmfEventType>();
- }
types.put(type.getName(), type);
fEventTypes.put(context, types);
}
* @param context the context to look into
* @return the list of types defined for that context
*/
- public synchronized ITmfEventType[] getTypes(String context) {
- HashMap<String, ITmfEventType> types = fEventTypes.get(context);
- if (types != null) {
+ public synchronized ITmfEventType[] getTypes(final String context) {
+ final HashMap<String, ITmfEventType> types = fEventTypes.get(context);
+ if (types != null)
return types.values().toArray(new ITmfEventType[types.size()]);
- }
return null;
}
* @param typeId the type ID
* @return the corresponding type
*/
- public synchronized ITmfEventType getType(String context, String typeId) {
- HashMap<String, ITmfEventType> types = fEventTypes.get(context);
- if (types != null) {
+ public synchronized ITmfEventType getType(final String context, final String typeId) {
+ final HashMap<String, ITmfEventType> types = fEventTypes.get(context);
+ if (types != null)
return types.get(typeId);
- }
return null;
}
*
* @param context the context to remove
*/
- public synchronized void clear(String context) {
+ public synchronized void clear(final String context) {
fEventTypes.remove(context);
}