Class IncludeExcludeWildcards
public class IncludeExcludeWildcards implements
ProvideSetComparisonInfo, SetComparison
{
// Constructors
public IncludeExcludeWildcards (WildcardExpression include,
WildcardExpression exclude);
// Methods
public Object combineSetRules (Object o1, Object o2);
public int compareSet (Object other);
public int compareSetRules (Object o1, Object o2);
public synchronized void exclude (WildcardExpression expr);
public WildcardExpression getExcludeExpression ();
public WildcardExpression getIncludeExpression ();
public Object getSetRule (int rule);
public String getStringForSetRule (Object o);
public synchronized void include (WildcardExpression expr);
public Object intersectSetRules (Object o1, Object o2);
public synchronized void invalidate ();
public boolean isEmptySetRule (Object o);
public boolean match (String s);
public String toString ();
public synchronized void validate ();
}
This class maintains a set of strings specified by a pair of WildcardExpression objects. The first expression specifies a set of strings that are included in the set, and the second specifies strings that are excluded from the set. Because WildcardExpressions cannot be subtracted, this class provides a way of emulating subtraction.
public IncludeExcludeWildcards (WildcardExpression include,
WildcardExpression exclude);
Constructs a new IncludeExcludeWildcards object given a WildcardExpression matching the included strings and a WildcardExpression matching the excluded strings.
Parameter | Description |
include
| The expression strings that are included in the set.
|
exclude
| The expression strings that are excluded from the set.
|
public Object combineSetRules (Object o1, Object o2);
Combines two set rule objects
Return Value:
Returns an object containing the combined set rules.
Parameter | Description |
o1
| The object containing the first set rule.
|
o2
| The object containing the second set rule.
|
public int compareSet (Object other);
Compares this IncludeExcludeWildcards object against another IncludeExcludeWildcards object.
Return Value:
Returns a SetComparison.compareSet result code.
Parameter | Description |
other
| The object with which to compare this object.
|
public int compareSetRules (Object o1, Object o2);
Compares two objects retrieved from getRule.
Return Value:
Returns a SetComparison.compareSet result code.
Parameter | Description |
o1
| The object containing the first set rule.
|
o2
| The object containing the second set rule.
|
public synchronized void exclude (WildcardExpression expr);
Adds an expression matching the strings that should be excluded in the set.
Return Value:
No return value.
Parameter | Description |
expr
| A WildcardExpression specifying strings that should be excluded.
|
public WildcardExpression getExcludeExpression ();
Retrieves the WildcardExpression object that specifies the strings that are excluded from the set.
Return Value:
Returns the WildcardExpression object that specifies the strings that are excluded from the set. If the IncludeExcludeWildcards object was created with a null exclude parameter and the exclude method has not been called, the method returns null.
See Also: exclude
public WildcardExpression getIncludeExpression ();
Retrieves the WildcardExpression object that specifies the strings that are included in the set.
Return Value:
Returns the WildcardExpression object that specifies the strings that are included in the set. If the IncludeExcludeWildcards object was created with a null include parameter and the include method has not been called, the method returns null.
See Also: include
public Object getSetRule (int rule);
Obtains an object representing the specified rule that can be used internally by SetComparer.
Return Value:
Returns the set rule object.
Parameter | Description |
rule
| The rule that specifies the object to return.
|
public String getStringForSetRule (Object o);
Retrieves a String representation of a given set rule.
Return Value:
Returns the set rule String.
Parameter | Description |
o
| The object containing the set rule.
|
public synchronized void include (WildcardExpression expr);
Adds an expression matching the strings that should be included in the set.
Return Value:
No return value.
Parameter | Description |
expr
| A WildcardExpression specifying strings that should be included.
|
public Object intersectSetRules (Object o1, Object o2);
Determines the intersection of two set rule objects.
Return Value:
Returns an object containing the intersection of the set rules.
Parameter | Description |
o1
| The object containing the first set rule.
|
o2
| The object containing the second set rule.
|
public synchronized void invalidate ();
Forces the next operation that requires the set to be valid to validate the set. The set can be manually placed in a valid state by invoking validate.
public boolean isEmptySetRule (Object o);
Determines if the set rule is empty or not.
Return Value:
Returns true if the set rule is empty; otherwise, returns false.
Parameter | Description |
o
| The object containing the set rule.
|
public boolean match (String s);
Determines if s is a member of the set.
Return Value:
Returns true if s is in the set.
Parameter | Description |
s
| The String to test for membership.
|
public String toString ();
Retrieves a string representation of the IncludeExcludeWildcards object.
Return Value:
Returns a string containing both the include and exclude WildcardExpression objects.
public synchronized void validate ();
Ensures that the set is in a valid state.
Remarks:
The set is automatically invalidated when additional expressions are included or excluded, and is automatically validated by other operators when necessary. If the set is already known to be in a valid state, this method does nothing. Validation is relatively expensive, so invoking this method in advance may speed up other operations that require validations.