Class UnsignedIntRanges
public class UnsignedIntRanges extends IntRanges
{
// Constructors
public UnsignedIntRanges ();
public UnsignedIntRanges (String str);
public UnsignedIntRanges (String str, String delims);
// Methods
public synchronized void addRange (int s, int e);
public synchronized void addRanges (IntRanges r);
public synchronized void addSingleton (int n);
public StringBuffer appendToStringBuffer (StringBuffer sb);
public boolean contains (int find);
public int getRangeEnd (int idx);
public int getRangeStart (int idx);
public int indexOf (int find, int fromRange);
public int indexOf (int find);
public UnsignedIntRanges intersect (UnsignedIntRanges other,
IIntRangeComparator judge);
public IntRanges intersect (IntRanges other, IIntRangeComparator judge);
public UnsignedIntRanges intersect (UnsignedIntRanges other);
public boolean removeRange (int s, int e,
IIntRangeComparator hook);
}
This class shifts unsigned numbers to the range of signed numbers. Those familiar with the IntRanges class should be aware that IntRanges.getRanges and IntRanges.setRanges are not converted by this derived class.
IntRanges
|
+--UnsignedIntRanges
public UnsignedIntRanges ();
Creates an UnsignedIntRanges object.
public UnsignedIntRanges (String str);
Constructs a set of ranges from the given string. This method simply calls the superclass.
Parameter | Description |
str
| A string containing ranges of unsigned integers (in hexadecimal), where the bounds of each range are separated by a dash (-), and separate ranges are delimited by commas.
A range of a single unsigned integer can be entered by including just the single unsigned integer, separated by delimiters.
|
public UnsignedIntRanges (String str, String delims);
Constructs a set of ranges from the given string with specified delimiters. This method simply calls the superclass.
Parameter | Description |
str
| A string containing ranges of unsigned integers (in hexadecimal), where the bounds of each range are separated by a dash (-).
A range of a single unsigned integer can be entered by including just the single unsigned integer, separated by delimiters.
|
delims
| The character or characters separating ranges.
|
public synchronized void addRange (int s, int e);
Adds a range of unsigned integers to the UnsignedIntRanges object.
Return Value:
No return value.
Parameter | Description |
s
| The lower limit of the range.
|
e
| The upper limit of the range.
|
Overrides:
addRange(int,int) in IntRanges.
public synchronized void addRanges (IntRanges r);
Adds a set of ranges to this set of ranges.
Return Value:
No return value.
Overrides:
addRanges(IntRanges) in IntRanges.
public synchronized void addSingleton (int n);
Adds a range of a single, unsigned integer to the UnsignedIntRanges object.
Return Value:
No return value.
Parameter | Description |
n
| The integer range.
|
Overrides:
addSingleton(int) in IntRanges.
public StringBuffer appendToStringBuffer (StringBuffer sb);
Appends a string representation of the unsigned integer ranges to a given string buffer. The unsigned integers are represented in hexadecimal.
Return Value:
Returns a string buffer containing the concatenated strings.
Parameter | Description |
sb
| The StringBuffer to append the set of unsigned integer range pairs to.
|
Overrides:
appendToStringBuffer(StringBuffer) in IntRanges.
public boolean contains (int find);
Searches from the beginning for a given number.
Return Value:
Returns true if the number was found; otherwise, returns false.
Parameter | Description |
find
| The number to search for.
|
Overrides:
contains(int) in IntRanges.
public int getRangeEnd (int idx);
Retrieves the end of a range at a specified index.
Return Value:
Returns the last integer of the range pair.
Parameter | Description |
idx
| The index of the range pair.
|
Overrides:
getRangeEnd(int) in IntRanges.
public int getRangeStart (int idx);
Retrieves the start of a range at a specified index.
Return Value:
Returns the first integer of the range pair.
Parameter | Description |
idx
| The index of the range pair.
|
Overrides:
getRangeStart(int) in IntRanges.
public int indexOf (int find, int fromRange);
Searches from a starting index for a range pair containing a given a number.
Return Value:
Returns the index of the range pair that includes the number, if found; otherwise, returns -1.
Parameter | Description |
find
| The number to search for.
|
fromRange
| The index of the range pair to start the search from.
|
Overrides:
indexOf(int,int) in IntRanges.
public int indexOf (int find);
Searches from the beginning for a range pair containing a given a number.
Return Value:
Returns the index of the range pair that includes the number, if found; otherwise, returns -1.
Parameter | Description |
find
| The number to search for.
|
Overrides:
indexOf(int) in IntRanges.
public UnsignedIntRanges intersect (UnsignedIntRanges other,
IIntRangeComparator judge);
Constructs a new UnsignedIntRanges object with the set of unsigned integers that are common to both this object and another object.
Return Value:
Returns an UnsignedIntRanges object for the intersection of this object and other.
public IntRanges intersect (IntRanges other, IIntRangeComparator judge);
Constructs a new IntRanges object with the set of integers that are common to both this object and another object.
Return Value:
Returns an IntRanges object for the intersection of this object and the IntRanges object contained in the other parameter.
public UnsignedIntRanges intersect (UnsignedIntRanges other);
Retrieves the intersection of this set of unsigned integer ranges with another.
Return Value:
Returns the intersection as a set of unsigned integer ranges.
Parameter | Description |
other
| The set of unsigned integer ranges to compare.
|
public boolean removeRange (int s, int e, IIntRangeComparator hook);
Removes a range of integers from the UnsignedIntRanges object.
Return Value:
Returns true if any integers in the range were removed; otherwise false if the set contains no integers in the range.