com.sun.javatest
Class Keywords

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

public abstract class Keywords
extends java.lang.Object

A filter for sets of keywords, as found on test descriptions.

See Also:
TestDescription.getKeywordTable()

Nested Class Summary
static class Keywords.Fault
          An exception used to report errors while using a Keywords object.
 
Field Summary
static java.lang.String ALL_OF
          A constant to indicate that all of a list of keywords should be matched.
static java.lang.String ANY_OF
          A constant to indicate that any of a list of keywords should be matched.
static java.lang.String EXPR
          A constant to indicate that an expression keyword should be matched.
 
Constructor Summary
Keywords()
           
 
Method Summary
abstract  boolean accepts(java.util.Set s)
          Check if this keywords object accepts, or matches, the specified set of words.
static Keywords create(java.lang.String type, java.lang.String text)
          Create a keywords object.
static Keywords create(java.lang.String type, java.lang.String text, java.util.Set validKeywords)
          Create a keywords 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 Detail

ALL_OF

public static final java.lang.String ALL_OF
A constant to indicate that all of a list of keywords should be matched.

See Also:
Constant Field Values

ANY_OF

public static final java.lang.String ANY_OF
A constant to indicate that any of a list of keywords should be matched.

See Also:
Constant Field Values

EXPR

public static final java.lang.String EXPR
A constant to indicate that an expression keyword should be matched.

See Also:
Constant Field Values
Constructor Detail

Keywords

public Keywords()
Method Detail

create

public static Keywords create(java.lang.String type,
                              java.lang.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(java.lang.String type,
                              java.lang.String text,
                              java.util.Set 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.

accepts

public abstract boolean accepts(java.util.Set 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.


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.