com.vgrs.xcode.common
Class Range

java.lang.Object
  extended by com.vgrs.xcode.common.Range
All Implemented Interfaces:
java.lang.Comparable<Range>

public class Range
extends java.lang.Object
implements java.lang.Comparable<Range>

This class stores the start and end integer values of a range of integers. It also provides methods to specify if a given integer value falls within the start and end range of integers stored in this class.

Version:
1.0 Jun 17, 2010
Author:
jcolosi

Field Summary
 int first
          The integer value of the start of the range
 boolean isPoint
          Boolean to indicate that start and end are the same value
 int last
          The integer value of the end of the range
 
Constructor Summary
Range(int aFirst)
           
Range(int aFirst, int aLast)
           
 
Method Summary
 int compareTo(Range aOtherRange)
          Comparator to efficiently sort while storing this class in java.util.Collections.
 boolean has(int aPoint)
           
 boolean hasAll(int[] aPoints)
          Specifies if all the code points specified in the input array are present in the range of integers stored in this class.
 boolean hasAny(int[] aPoints)
          Specifies if any of the int values specified in the input array are present in the range of integers stored in this class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public int first
The integer value of the start of the range


last

public int last
The integer value of the end of the range


isPoint

public boolean isPoint
Boolean to indicate that start and end are the same value

Constructor Detail

Range

public Range(int aFirst,
             int aLast)
Parameters:
aFirst - the start of the range of integers
aLast - the end of the range of integers

Range

public Range(int aFirst)
Parameters:
aFirst - Start and end are the same
Method Detail

compareTo

public int compareTo(Range aOtherRange)
Comparator to efficiently sort while storing this class in java.util.Collections.

Specified by:
compareTo in interface java.lang.Comparable<Range>

has

public boolean has(int aPoint)
Parameters:
aPoint - the int value to check if it is within the range of integers held in this class.
Returns:
true if the int value is within the range of integers held in this class.

hasAny

public boolean hasAny(int[] aPoints)
Specifies if any of the int values specified in the input array are present in the range of integers stored in this class.

Parameters:
aPoints - an array containing the int values to be tested
Returns:
true if the any of the int values are within the range of integers held in this class.

hasAll

public boolean hasAll(int[] aPoints)
Specifies if all the code points specified in the input array are present in the range of integers stored in this class.

Parameters:
aPoints - an array containing the int values to be tested
Returns:
true if the all of the int values are within the range of integers held in this class.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2010 VeriSign Inc. All Rights Reserved