Class Keywords

java.lang.Object
com.sun.javatest.Keywords

public abstract class Keywords extends Object
A filter for sets of keywords, as found on test descriptions.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An exception used to report errors while using a Keywords object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A constant to indicate that all of a list of keywords should be matched.
    static final String
    A constant to indicate that any of a list of keywords should be matched.
    static final String
    A constant to indicate that an expression keyword should be matched.
    protected String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Check if this keywords object accepts, or matches, the specified set of words.
    static Keywords
    create(String type, String text)
    Create a keywords object.
    static Keywords
    create(String type, String text, Set<String> validKeywords)
    Create a keywords object.
    Get a human digestible version of the kw represented by this object.
    static void
    setAllowNumericKeywords(boolean allowNumericKeywords)
    Allow keywords to begin with a numeric or not.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALL_OF

      public static final String ALL_OF
      A constant to indicate that all of a list of keywords should be matched.
      See Also:
    • ANY_OF

      public static final String ANY_OF
      A constant to indicate that any of a list of keywords should be matched.
      See Also:
    • EXPR

      public static final String EXPR
      A constant to indicate that an expression keyword should be matched.
      See Also:
    • text

      protected String text
  • Constructor Details

    • Keywords

      public Keywords()
  • Method Details

    • create

      public static Keywords create(String type, String text) throws Keywords.Fault
      Create a keywords object.
      Parameters:
      type - one of ALL_OF, ANY_OF, or EXPR
      text - if the type is one of "all of" or "any of", text should be a white-space separated list of keywords; if type is "expr", text should be a boolean valued expression formed from keywords, '&' (and), '|' (or), '!' (not) and '(' ')' (parentheses).
      Returns:
      A Keywords object for the specified type and text.
      Throws:
      Keywords.Fault - if there are errors in the arguments.
    • create

      public static Keywords create(String type, String text, Set<String> validKeywords) throws Keywords.Fault
      Create a keywords object.
      Parameters:
      type - one of ALL_OF, ANY_OF, or EXPR
      text - if the type is one of "all of" or "any of", text should be a white-space separated list of keywords; if type is "expr", text should be a boolean valued expression formed from keywords, '&' (and), '|' (or), '!' (not) and '(' ')' (parentheses).
      validKeywords - a set of valid keywords for this test suite, or null. If not null, all the keywords in text must be in this set.
      Returns:
      A Keywords object for the specified type and text.
      Throws:
      Keywords.Fault - if there are errors in the arguments.
    • setAllowNumericKeywords

      public static void setAllowNumericKeywords(boolean allowNumericKeywords)
      Allow keywords to begin with a numeric or not.
      Parameters:
      allowNumericKeywords - Value to be set.
    • getSummary

      public String getSummary()
      Get a human digestible version of the kw represented by this object.
      Returns:
      Human readable, fully descriptive rendering of current kw setting
    • accepts

      public abstract boolean accepts(Set<String> s)
      Check if this keywords object accepts, or matches, the specified set of words. If the keywords type is "any of" or "all of", the set must have any or of all of the words specified in the keywords object; if the keywords type is "expr", the given expression must evaluate to true, when the words in the expression are true if they are present in the given set of words.
      Parameters:
      s - A set of words to compare against the keywords object.
      Returns:
      true if the the specified set of words are compatible with this keywords object.