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 GameObject and 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
      C createConfig()
      Creates a new FilterConfig instance for this filter.
      boolean hasGlobalMatch​(C config)
      Tells if all the game objects on a square are to be analyzed before a match result.
      boolean match​(C config, @NotNull GameObject<?,​?,​?> gameObject)
      Tells whether we got a match on specific GameObject.
      boolean reset​(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 specific 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 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.
        Parameters:
        config - the filter configuration to use
        gameObject - the game object being analyzed on the map
        Returns:
        whether it matches the criteria; this value is ignored if hasGlobalMatch() returns true
      • 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. If hasGlobalMatch(FilterConfig) returns true, 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 of match(FilterConfig, GameObject) is ignored and the returning value of reset(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 new FilterConfig instance for this filter.
        Returns:
        the new filter config instance