public class NamedFilter extends java.lang.Object implements Filter<NamedFilter,NamedFilterConfig>
Filter that aggregates named filters.
This filter aggregates a list of named sub-filters. Each sub-filter can be
(dis)enabled.| Constructor and Description |
|---|
NamedFilter(java.lang.Iterable<NamedGameObjectMatcher> matchers)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFilter(java.lang.String name,
Filter<?,?> filter)
Adds a sub-
Filter. |
void |
addFilterListener(NamedFilterListener listener)
Adds a
NamedFilterListener to be notified about changes. |
boolean |
canShow(GameObject<?,?,?> gameObject,
NamedFilterConfig filterOutConfig)
Returns whether this filter matches a
GameObject. |
NamedFilterConfig |
createConfig()
Creates a new
FilterConfig instance for this filter. |
boolean |
hasGlobalMatch(NamedFilterConfig config)
Tells if all the game objects on a square are to be analyzed before a
match result.
|
boolean |
match(NamedFilterConfig config,
GameObject<?,?,?> gameObject)
Tells whether we got a match on specific
GameObject. |
void |
removeFilter(java.lang.String name)
Removes a sub-filter.
|
void |
removeFilterListener(NamedFilterListener listener)
Removes a
NamedFilterListener to be notified about changes. |
boolean |
reset(NamedFilterConfig config)
This tells the filter we have finished with current map square and,
perhaps, we are jumping on next one.
|
void |
resetConfig(NamedFilterConfig config)
Disables all sub-filters.
|
public NamedFilter(@NotNull
java.lang.Iterable<NamedGameObjectMatcher> matchers)
matchers - the matchers to create filters frompublic void resetConfig(@NotNull
NamedFilterConfig config)
config - the filter config to resetpublic boolean match(@NotNull
NamedFilterConfig config,
@NotNull
GameObject<?,?,?> gameObject)
GameObject. 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. Unless Filter.hasGlobalMatch(FilterConfig) returns true, when a match occurred, this function is not called with the
remaining game objects on the map square and a reset is issued.match in interface Filter<NamedFilter,NamedFilterConfig>config - the filter configuration to usegameObject - the game object being analyzed on the maphasGlobalMatch() returns truepublic boolean reset(@NotNull
NamedFilterConfig config)
Filter.hasGlobalMatch(FilterConfig)
returns true, the returning value is used to know if we had a
match.reset in interface Filter<NamedFilter,NamedFilterConfig>config - the filter configuration to usepublic boolean hasGlobalMatch(@NotNull
NamedFilterConfig config)
Filter.match(FilterConfig, GameObject)
is ignored and the returning value of Filter.reset(FilterConfig) is
used as replacement. This should mainly used by complex analyze filters.hasGlobalMatch in interface Filter<NamedFilter,NamedFilterConfig>config - the filter configuration to use@NotNull public NamedFilterConfig createConfig()
FilterConfig instance for this filter.createConfig in interface Filter<NamedFilter,NamedFilterConfig>public void addFilter(@NotNull
java.lang.String name,
@NotNull
Filter<?,?> filter)
Filter.name - the name of the sub-filterfilter - the sub-filterpublic void removeFilter(@NotNull
java.lang.String name)
name - the name of the sub-filterpublic void addFilterListener(@NotNull
NamedFilterListener listener)
NamedFilterListener to be notified about changes.listener - the listenerpublic void removeFilterListener(@NotNull
NamedFilterListener listener)
NamedFilterListener to be notified about changes.listener - the listenerpublic boolean canShow(@NotNull
GameObject<?,?,?> gameObject,
@NotNull
NamedFilterConfig filterOutConfig)
GameObject.gameObject - the game objectfilterOutConfig - the filter config to use