Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.util   Previous This
Package
Next

 


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

Constructors

UnsignedIntRanges

public UnsignedIntRanges ();

Creates an UnsignedIntRanges object.

UnsignedIntRanges

public UnsignedIntRanges (String str);

Constructs a set of ranges from the given string. This method simply calls the superclass.

ParameterDescription
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.

UnsignedIntRanges

public UnsignedIntRanges (String str, String delims);

Constructs a set of ranges from the given string with specified delimiters. This method simply calls the superclass.

ParameterDescription
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.

Methods

addRange

public synchronized void addRange (int s, int e);

Adds a range of unsigned integers to the UnsignedIntRanges object.

Return Value:

No return value.

ParameterDescription
s The lower limit of the range.
e The upper limit of the range.

Overrides:

addRange(int,int) in IntRanges.

addRanges

public synchronized void addRanges (IntRanges r);

Adds a set of ranges to this set of ranges.

Return Value:

No return value.

ParameterDescription
r An IntRanges object to add to this UnsignedIntRanges object.

Overrides:

addRanges(IntRanges) in IntRanges.

addSingleton

public synchronized void addSingleton (int n);

Adds a range of a single, unsigned integer to the UnsignedIntRanges object.

Return Value:

No return value.

ParameterDescription
n The integer range.

Overrides:

addSingleton(int) in IntRanges.

appendToStringBuffer

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.

ParameterDescription
sb The StringBuffer to append the set of unsigned integer range pairs to.

Overrides:

appendToStringBuffer(StringBuffer) in IntRanges.

contains

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.

ParameterDescription
find The number to search for.

Overrides:

contains(int) in IntRanges.

getRangeEnd

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.

ParameterDescription
idx The index of the range pair.

Overrides:

getRangeEnd(int) in IntRanges.

getRangeStart

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.

ParameterDescription
idx The index of the range pair.

Overrides:

getRangeStart(int) in IntRanges.

indexOf

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.

ParameterDescription
find The number to search for.
fromRange The index of the range pair to start the search from.

Overrides:

indexOf(int,int) in IntRanges.

indexOf

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.

ParameterDescription
find The number to search for.

Overrides:

indexOf(int) in IntRanges.

intersect

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.

ParameterDescription
other The other UnsignedIntRanges object to find an intersection with.
judge The hook interface to notify through IIntRangeComparator.intersectRanges of intersecting ranges that will be added to the new UnsignedIntRanges object.

intersect

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.

ParameterDescription
other The other IntRanges object to find an intersection with.
judge The hook interface to notify through IIntRangeComparator.intersectRanges of intersecting ranges that will be added to the new IntRanges object.

intersect

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.

ParameterDescription
other The set of unsigned integer ranges to compare.

removeRange

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.

ParameterDescription
s The lower limit of the range.
e The upper limit of the range.
hook The interface to notify through IIntRangeComparator.shiftRanges that the ranges were deleted or IIntRangeComparator.splitRange that a range was split.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.