de.eventhorizongilde.ehfs.milestone
Class AbstractFilterMilestone

java.lang.Object
  extended by de.eventhorizongilde.ehfs.milestone.AbstractMilestone
      extended by de.eventhorizongilde.ehfs.milestone.AbstractFilterMilestone
All Implemented Interfaces:
IMilestone
Direct Known Subclasses:
AbstractNpcGroupMemberDeadMilestone, AbstractNpcJoinsMilestone, AbstractUnitAuraMilestone

public abstract class AbstractFilterMilestone
extends AbstractMilestone

Convenience milestone implementation that informs of events that match one or more filters.

To use this class, one or more filters must be added. This should be done during initialization. Filters may be added (and removed, if necessary) through different sets of methods:

The first set of methods requires the implementation of event handlers, while the second set requires overriding of eventHappened(String, CombatEvent) to be informed of events.


Constructor Summary
protected AbstractFilterMilestone()
          Creates a new filter milestone with no filters.
 
Method Summary
protected  void addFilter(IEventFilter filter, IEventHandler handler)
          Adds an event filter associated with an event handler.
protected  void addFilter(String key, IEventFilter filter)
          Adds an event filter.
 void eventHappened(CombatEvent event)
          Informs the milestone that an event happened during the fight. Subclasses should override eventHappened(String, CombatEvent) instead of this method.
protected  void eventHappened(String key, CombatEvent event)
          Informs the milestone that an event happened during the fight.
protected  void removeFilter(IEventFilter filter)
          Removes an event filter and its associated event handler.
protected  void removeFilter(String key)
          Removes the event filter associated with the specified key.
 
Methods inherited from class de.eventhorizongilde.ehfs.milestone.AbstractMilestone
addAnnotation, deactivate, fightEnded, getAnnotationGroup, getParseContext, setColorKeyId, setParseContext, toSeconds, toSeconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFilterMilestone

protected AbstractFilterMilestone()
Creates a new filter milestone with no filters. Subclasses should override to add new filters.

Method Detail

eventHappened

public void eventHappened(CombatEvent event)
Informs the milestone that an event happened during the fight.

Subclasses should override eventHappened(String, CombatEvent) instead of this method.


eventHappened

protected void eventHappened(String key,
                             CombatEvent event)
Informs the milestone that an event happened during the fight. This method is invoked only if there are any event filters associated with keys. This implementation does nothing, subclasses are expected to override.

Parameters:
key - the key that a filter has been associated with
event - the fight event
See Also:
addFilter(String, IEventFilter)

addFilter

protected void addFilter(String key,
                         IEventFilter filter)
Adds an event filter. Whenever an event happens that matches the filter, the method eventHappened(String, CombatEvent) is invoked with the key and the event.

Parameters:
key - the key to associate the filter with
filter - the filter that events must match before informing of them
See Also:
eventHappened(String, CombatEvent), removeFilter(String)

removeFilter

protected void removeFilter(String key)
Removes the event filter associated with the specified key. Does nothing if the key is unknown.

See Also:
addFilter(String, IEventFilter)

addFilter

protected void addFilter(IEventFilter filter,
                         IEventHandler handler)
Adds an event filter associated with an event handler. Whenever an event happens that matches the filter, the handler's eventHappened() method is invoked with the event.

Parameters:
filter - the filter that events must match before the handler is informed of them
handler - the handler that is informed of matching events
See Also:
removeFilter(IEventFilter)

removeFilter

protected void removeFilter(IEventFilter filter)
Removes an event filter and its associated event handler. Does nothing if the event filter is unknown.

See Also:
addFilter(IEventFilter, IEventHandler)


Event Horizon Fight Statistics