Class TokenFilter<T extends JobParameters>

java.lang.Object
io.github.douira.glsl_transformer.transform.LifecycleUserImpl<T>
io.github.douira.glsl_transformer.print.filter.TokenFilter<T>
All Implemented Interfaces:
LifecycleUser<T>
Direct Known Subclasses:
ChannelFilter, MultiFilter, NewlineFilter, StringFilter

public abstract class TokenFilter<T extends JobParameters> extends LifecycleUserImpl<T>
A token filter is an object that can check if given tokens should be printed or not.
  • Constructor Details

    • TokenFilter

      public TokenFilter()
  • Method Details

    • isTokenAllowed

      public abstract boolean isTokenAllowed(Token token)
      Checks if the token should be printed.
      Parameters:
      token - The token to check
      Returns:
      true if the given token should be printed
    • resetState

      public void resetState()
      Resets the filter's state. Does nothing by default.
    • join

      public static <R extends JobParameters> TokenFilter<R> join(TokenFilter<R> a, TokenFilter<R> b)
      Joins two arbitrary token filters into a new filter. They may be null, regular filters or multi filters and will be joined accordingly. The returned instance is either a or b or a new multi filter containing a, b, or their contents. If a multi filter is generated, the settings from the first multi filter in the parameters are copied.
      Type Parameters:
      R - The job parameter type
      Parameters:
      a - A token filter. May be null.
      b - A token filter. May be null.
      Returns:
      The joined token filter