Package net.sf.gridarta.model.filter
Class NamedGameObjectMatcherFilter
- java.lang.Object
-
- net.sf.gridarta.model.filter.NamedGameObjectMatcherFilter
-
- All Implemented Interfaces:
Filter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>
public class NamedGameObjectMatcherFilter extends java.lang.Object implements Filter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>
AFilterwhich filters according to aNamedGameObjectMatcher.
-
-
Constructor Summary
Constructors Constructor Description NamedGameObjectMatcherFilter(@NotNull GameObjectMatcher matcher)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull NamedGameObjectMatcherFilterConfigcreateConfig()Creates a newFilterConfiginstance for this filter.booleanhasGlobalMatch(@NotNull NamedGameObjectMatcherFilterConfig config)Tells if all the game objects on a square are to be analyzed before a match result.booleanmatch(@NotNull NamedGameObjectMatcherFilterConfig config, @NotNull GameObject<?,?,?> gameObject)Tells whether we got a match on specificGameObject.booleanreset(@NotNull NamedGameObjectMatcherFilterConfig config)This tells the filter we have finished with current map square and, perhaps, we are jumping on next one.
-
-
-
Constructor Detail
-
NamedGameObjectMatcherFilter
public NamedGameObjectMatcherFilter(@NotNull @NotNull GameObjectMatcher matcher)Creates a new instance.- Parameters:
matcher- the game object matcher to use
-
-
Method Detail
-
match
public boolean match(@NotNull @NotNull NamedGameObjectMatcherFilterConfig config, @NotNull @NotNull GameObject<?,?,?> gameObject)Description copied from interface:FilterTells 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. UnlessFilter.hasGlobalMatch(FilterConfig)returnstrue, when a match occurred, this function is not called with the remaining game objects on the map square and a reset is issued.- Specified by:
matchin interfaceFilter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>- Parameters:
config- the filter configuration to usegameObject- the game object being analyzed on the map- Returns:
- whether it matches the criteria; this value is ignored if
hasGlobalMatch()returnstrue
-
reset
public boolean reset(@NotNull @NotNull NamedGameObjectMatcherFilterConfig config)Description copied from interface:FilterThis tells the filter we have finished with current map square and, perhaps, we are jumping on next one. IfFilter.hasGlobalMatch(FilterConfig)returnstrue, the returning value is used to know if we had a match.- Specified by:
resetin interfaceFilter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>- Parameters:
config- the filter configuration to use- Returns:
- whether we had a global match on map square
-
hasGlobalMatch
public boolean hasGlobalMatch(@NotNull @NotNull NamedGameObjectMatcherFilterConfig config)Description copied from interface:FilterTells if all the game objects on a square are to be analyzed before a match result. If all game objects must be analyzed to decide the result of a match, the return value ofFilter.match(FilterConfig, GameObject)is ignored and the returning value ofFilter.reset(FilterConfig)is used as replacement. This should mainly used by complex analyze filters.- Specified by:
hasGlobalMatchin interfaceFilter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>- Parameters:
config- the filter configuration to use- Returns:
- whether a match can be decided only when all game objects on a map square are analyzed
-
createConfig
@NotNull public @NotNull NamedGameObjectMatcherFilterConfig createConfig()
Description copied from interface:FilterCreates a newFilterConfiginstance for this filter.- Specified by:
createConfigin interfaceFilter<NamedGameObjectMatcherFilter,NamedGameObjectMatcherFilterConfig>- Returns:
- the new filter config instance
-
-