Package com.sun.javatest
Class Keywords
java.lang.Object
com.sun.javatest.Keywords
A filter for sets of keywords, as found on test descriptions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An exception used to report errors while using a Keywords object. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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 -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Check if this keywords object accepts, or matches, the specified set of words.static Keywords
Create a keywords object.static Keywords
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.
-
Field Details
-
ALL_OF
A constant to indicate that all of a list of keywords should be matched.- See Also:
-
ANY_OF
A constant to indicate that any of a list of keywords should be matched.- See Also:
-
EXPR
A constant to indicate that an expression keyword should be matched.- See Also:
-
text
-
-
Constructor Details
-
Keywords
public Keywords()
-
-
Method Details
-
create
Create a keywords object.- Parameters:
type
- one of ALL_OF, ANY_OF, or EXPRtext
- 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 EXPRtext
- 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
Get a human digestible version of the kw represented by this object.- Returns:
- Human readable, fully descriptive rendering of current kw setting
-
accepts
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.
-