Package net.sf.gridarta.model.filter
Interface Filter<F extends Filter<F,C>,C extends FilterConfig<F,C>>
-
- All Known Implementing Classes:
NamedFilter,NamedGameObjectMatcherFilter
public interface Filter<F extends Filter<F,C>,C extends FilterConfig<F,C>>Interface for Filters.Interface used to filter and analyze maps. Basically a filter gets an
GameObjectand tells if it got a match. It also gets reset when the map square is changed, So more complex behavior can be achieved.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CcreateConfig()Creates a newFilterConfiginstance for this filter.booleanhasGlobalMatch(C config)Tells if all the game objects on a square are to be analyzed before a match result.booleanmatch(C config, @NotNull GameObject<?,?,?> gameObject)Tells whether we got a match on specificGameObject.booleanreset(C config)This tells the filter we have finished with current map square and, perhaps, we are jumping on next one.
-
-
-
Method Detail
-
match
boolean match(@NotNull C config, @NotNull @NotNull GameObject<?,?,?> gameObject)Tells 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. UnlesshasGlobalMatch(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.- 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
boolean reset(@NotNull C config)This tells the filter we have finished with current map square and, perhaps, we are jumping on next one. IfhasGlobalMatch(FilterConfig)returnstrue, the returning value is used to know if we had a match.- Parameters:
config- the filter configuration to use- Returns:
- whether we had a global match on map square
-
hasGlobalMatch
boolean hasGlobalMatch(@NotNull C config)Tells 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 ofmatch(FilterConfig, GameObject)is ignored and the returning value ofreset(FilterConfig)is used as replacement. This should mainly used by complex analyze filters.- 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 C createConfig()
Creates a newFilterConfiginstance for this filter.- Returns:
- the new filter config instance
-
-