de.lmu.ifi.dbs.elki.utilities
Class HandlerList<H>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.HandlerList<H>
Type Parameters:
H - Parent class/interface for all handlers

public final class HandlerList<H>
extends Object

Manages a list of handlers for objects. Handlers are appended to a list in sequence, and when querying, the last added handler will be used where the query object can be cast to the handlers restriction class.


Field Summary
private  ArrayList<Pair<Class<?>,H>> handlers
          List with registered Handlers.
 
Constructor Summary
HandlerList()
           
 
Method Summary
 H getHandler(Object o)
          Find a matching handler for the given object
 void insertHandler(Class<?> restrictionClass, H handler)
          Insert a handler to the beginning of the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handlers

private ArrayList<Pair<Class<?>,H>> handlers
List with registered Handlers. The list is kept in backwards order, that is the later entrys take precedence.

Constructor Detail

HandlerList

public HandlerList()
Method Detail

insertHandler

public void insertHandler(Class<?> restrictionClass,
                          H handler)
Insert a handler to the beginning of the stack.

Parameters:
restrictionClass - restriction class
handler - handler

getHandler

public H getHandler(Object o)
Find a matching handler for the given object

Parameters:
o - object to find handler for
Returns:
handler for the object. null if no handler was found.

Release 0.4.0 (2011-09-20_1324)