Class NamedFilter

    • Constructor Detail

      • NamedFilter

        public NamedFilter​(@NotNull
                           @NotNull java.lang.Iterable<NamedGameObjectMatcher> matchers)
        Creates a new instance.
        Parameters:
        matchers - the matchers to create filters from
    • Method Detail

      • resetConfig

        public void resetConfig​(@NotNull
                                @NotNull NamedFilterConfig config)
        Disables all sub-filters.
        Parameters:
        config - the filter config to reset
      • match

        public boolean match​(@NotNull
                             @NotNull NamedFilterConfig config,
                             @NotNull
                             @NotNull GameObject<?,​?,​?> gameObject)
        Description copied from interface: Filter
        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 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.
        Specified by:
        match in interface Filter<NamedFilter,​NamedFilterConfig>
        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

        public boolean reset​(@NotNull
                             @NotNull NamedFilterConfig config)
        Description copied from interface: Filter
        This tells the filter we have finished with current map square and, perhaps, we are jumping on next one. If Filter.hasGlobalMatch(FilterConfig) returns true, the returning value is used to know if we had a match.
        Specified by:
        reset in interface Filter<NamedFilter,​NamedFilterConfig>
        Parameters:
        config - the filter configuration to use
        Returns:
        whether we had a global match on map square
      • hasGlobalMatch

        public boolean hasGlobalMatch​(@NotNull
                                      @NotNull NamedFilterConfig config)
        Description copied from interface: Filter
        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 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.
        Specified by:
        hasGlobalMatch in interface Filter<NamedFilter,​NamedFilterConfig>
        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
      • addFilter

        public void addFilter​(@NotNull
                              @NotNull java.lang.String name,
                              @NotNull
                              @NotNull Filter<?,​?> filter)
        Adds a sub-Filter.
        Parameters:
        name - the name of the sub-filter
        filter - the sub-filter
      • removeFilter

        public void removeFilter​(@NotNull
                                 @NotNull java.lang.String name)
        Removes a sub-filter.
        Parameters:
        name - the name of the sub-filter
      • addFilterListener

        public void addFilterListener​(@NotNull
                                      @NotNull NamedFilterListener listener)
        Adds a NamedFilterListener to be notified about changes.
        Parameters:
        listener - the listener
      • removeFilterListener

        public void removeFilterListener​(@NotNull
                                         @NotNull NamedFilterListener listener)
        Removes a NamedFilterListener to be notified about changes.
        Parameters:
        listener - the listener
      • canShow

        public boolean canShow​(@NotNull
                               @NotNull GameObject<?,​?,​?> gameObject,
                               @NotNull
                               @NotNull NamedFilterConfig filterOutConfig)
        Returns whether this filter matches a GameObject.
        Parameters:
        gameObject - the game object
        filterOutConfig - the filter config to use
        Returns:
        whether this filter matches the game object