Class Filter<T>

java.lang.Object
org.yamcs.utils.parser.Filter<T>
Direct Known Subclasses:
EventFilter

public abstract class Filter<T> extends Object
  • Constructor Details

    • Filter

      public Filter(String query)
  • Method Details

    • parse

      public void parse() throws ParseException
      Throws:
      ParseException
    • isQueryField

      public boolean isQueryField(String field)
      True if the provided field is part of the parsed query.

      This method should only be used after parse() is called.

    • includesTextSearch

      public boolean includesTextSearch()
      True if the parsed query includes at least one text search.

      This method should only be used after parse() is called.

    • addPrefixField

      protected void addPrefixField(String field, BiFunction<T,String,String> resolver)
    • addStringField

      protected void addStringField(String field, Function<T,String> resolver)
    • addEnumField

      protected <E extends Enum<?>> void addEnumField(String field, Class<E> enumClass, Function<T,E> resolver)
    • addNumberField

      protected void addNumberField(String field, Function<T,Number> resolver)
    • addBooleanField

      protected void addBooleanField(String field, Function<T,Boolean> resolver)
    • addBinaryField

      protected void addBinaryField(String field, Function<T,byte[]> resolver)
    • matches

      public boolean matches(T item)
    • beforeItem

      public void beforeItem(T item)
      Called for each new item, before any comparisons.

      The default implementation does nothing, concrete classes may override to hook any initialization logic.

    • printExpression

      public String printExpression()
    • matchesLiteral

      protected abstract boolean matchesLiteral(T item, String lowercaseLiteral)
      Implementatinos must search the provided item for the given literal in a manner that makes sense to the type of item. Search should be exact and case-insensitive.
      Parameters:
      item - Item to match
      lowercaseLiteral - A search string. Always lowercase.