Package net.sf.gridarta.model.filter
Class AbstractFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>
- java.lang.Object
-
- net.sf.gridarta.model.filter.AbstractFilterConfig<F,C>
-
- All Implemented Interfaces:
FilterConfig<F,C>
- Direct Known Subclasses:
NamedFilterConfig,NamedGameObjectMatcherFilterConfig
public abstract class AbstractFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>> extends java.lang.Object implements FilterConfig<F,C>
Abstract base class for filter configurations.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFilterConfig(F filter)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddConfigChangeListener(@NotNull FilterConfigListener listener)Adds aFilterConfigListenerto be notified about changes.protected voidfireEvent(@NotNull FilterConfigChangeType filterConfigChangeType, @NotNull FilterConfig<?,?> filterConfig)Notify all listeners that aFilterConfighas happened.FgetFilter()Returns theFilterthis filter config belongs to.protected abstract CgetThis()Returns this filter config.booleanisEnabled()Returns whether the filter is enabled.booleanmatch(@NotNull GameObject<?,?,?> gameObject)Tells whether we got a match on specificGameObject.voidremoveConfigChangeListener(@NotNull FilterConfigListener listener)Removes aFilterConfigListenerto be notified about changes.booleanreset()Tells the filter we have finished with current map square and, perhaps, we are jumping on next one.voidsetEnabled(boolean enabled)Enables or disables the filter.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.filter.FilterConfig
accept
-
-
-
-
Constructor Detail
-
AbstractFilterConfig
protected AbstractFilterConfig(@NotNull F filter)Creates a new instance.- Parameters:
filter- the filter this filter config belongs to
-
-
Method Detail
-
getFilter
@NotNull public F getFilter()
Description copied from interface:FilterConfigReturns theFilterthis filter config belongs to.- Specified by:
getFilterin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Returns:
- the filter
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:FilterConfigEnables or disables the filter.- Specified by:
setEnabledin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Parameters:
enabled- whether the filter should be enabled
-
isEnabled
public boolean isEnabled()
Description copied from interface:FilterConfigReturns whether the filter is enabled.- Specified by:
isEnabledin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Returns:
- whether the filter is enabled
-
fireEvent
protected void fireEvent(@NotNull @NotNull FilterConfigChangeType filterConfigChangeType, @NotNull @NotNull FilterConfig<?,?> filterConfig)Notify all listeners that aFilterConfighas happened.- Parameters:
filterConfigChangeType- the config event typefilterConfig- the changed filter config
-
addConfigChangeListener
public void addConfigChangeListener(@NotNull @NotNull FilterConfigListener listener)Description copied from interface:FilterConfigAdds aFilterConfigListenerto be notified about changes.- Specified by:
addConfigChangeListenerin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Parameters:
listener- the listener
-
removeConfigChangeListener
public void removeConfigChangeListener(@NotNull @NotNull FilterConfigListener listener)Description copied from interface:FilterConfigRemoves aFilterConfigListenerto be notified about changes.- Specified by:
removeConfigChangeListenerin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Parameters:
listener- the listener
-
match
public boolean match(@NotNull @NotNull GameObject<?,?,?> gameObject)Description copied from interface:FilterConfigTells whether we got a match on specificGameObject. The analysis tool will call this function with every game object on a given map square. The match function is responsible for analyzing inventories if it needs to.- Specified by:
matchin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Parameters:
gameObject- the game object being analyzed on the map- Returns:
- whether it matches the criteria
-
reset
public boolean reset()
Description copied from interface:FilterConfigTells the filter we have finished with current map square and, perhaps, we are jumping on next one.- Specified by:
resetin interfaceFilterConfig<F extends Filter<F,C>,C extends FilterConfig<F,C>>- Returns:
- whether we had a global match on the map square
-
getThis
@NotNull protected abstract C getThis()
Returns this filter config.- Returns:
- this filter config
-
-