Class IncludeExcludeIntRanges
public class IncludeExcludeIntRanges implements SetComparison,
ProvideSetComparisonInfo
{
// Constructors
public IncludeExcludeIntRanges (IntRanges include,
IntRanges exclude);
public IncludeExcludeIntRanges ( );
// Methods
public Object combineSetRules (Object o1, Object o2);
public int compareSet (Object other);
public int compareSetRules (Object o1, Object o2);
public boolean contains (int n);
public void excludeRange (int s, int e);
public void excludeRanges (IntRanges ranges);
public IntRanges getExcludedRanges ();
public IntRanges getIncludedRanges ();
public Object getSetRule (int rule);
public String getStringForSetRule (Object o);
public void includeRange (int s, int e);
public void includeRanges (IntRanges ranges);
public Object intersectSetRules (Object o1, Object o2);
public void invalidate ();
public boolean isEmptySetRule (Object o);
public String toString ();
public void validate ();
}
This class maintains a set of integers specified by a pair of IntRanges objects. The first IntRanges object specifies a set of integers that are included in the set, and the second specifies integers that are excluded from the set.
public IncludeExcludeIntRanges (IntRanges include, IntRanges exclude);
Constructs a new IncludeExcludeIntRanges object given an IntRanges object matching the included integers and an IntRanges object matching the excluded integers.
Parameter | Description |
include
| The integers that are included in the set.
|
exclude
| The integers that are excluded from the set.
|
public IncludeExcludeIntRanges ( );
Constructs an empty IncludeExcludeIntRanges object.
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 the current IncludeExcludeIntRanges object with another.
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 boolean contains (int n);
Determines if n is a member of the set.
Return Value:
Returns true if n is in the set.
Parameter | Description |
n
| The integer to test for membership.
|
public void excludeRange (int s, int e);
Excludes a range of integers in the set.
Return Value:
No return value.
Parameter | Description |
s
| The lower limit of the range.
|
e
| The upper limit of the range.
|
public void excludeRanges (IntRanges ranges);
Excludes a set of integers in the set.
Return Value:
No return value.
Parameter | Description |
ranges
| An IntRanges object specifying the integers to exclude.
|
public IntRanges getExcludedRanges ();
Retrieves the set of all excluded ranges.
Return Value:
Returns a set of ranges.
public IntRanges getIncludedRanges ();
Retrieves the set of all included ranges.
Return Value:
Returns a set of ranges.
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 void includeRange (int s, int e);
Includes a range of integers in the set.
Return Value:
No return value.
Parameter | Description |
s
| The lower limit of the range.
|
e
| The upper limit of the range.
|
public void includeRanges (IntRanges ranges);
Includes a set of integers in the set.
Return Value:
No return value.
Parameter | Description |
ranges
| An IntRanges object specifying the integers to include.
|
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 void invalidate ();
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.
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 String toString ();
Retrieves a string representation of the object.
Return Value:
Returns a String showing the IntRanges object's included and excluded sets.
public void validate ();
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.