Class NumberRange
java.lang.Object
fc.util.Range
fc.util.NumberRange
A range of integral values.
Note, many methods in this particular class have the same signatures as in the apache commons.lang package but the implementation was strictly clean-room.
Thread Safety: This class is not thread safe in the face of any concurrent modification (via changing the start/end numbers or union/intersection operations).
-
Constructor Summary
ConstructorsConstructorDescriptionNumberRange(long start, long end) Constructs a number range between the specified start and end numbers (both inclusive). -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonggetEnd()Get the end number for this number range.longgetSize()Returns the size of this range which is calculated as the (endnumber - startnumber) + 1 - i.e., the number of slots in this range, start and end inclusive.longgetStart()Get the start number for this number rangeinthashCode()booleaninRange(long c) Is the passed in number inside this rangestatic voidvoidsetEnd(long c) Sets the end number for this number rangevoidsetStart(long c) Set the start number for this number rangetoString()Output a string representation of the number rangeMethods inherited from class Range
isNegated, setNegated
-
Constructor Details
-
NumberRange
Constructs a number range between the specified start and end numbers (both inclusive).- Throws:
IllegalArgumentException- if the end number is lesser (via a < comparison) than the start number (equal to the start number is ok)
-
-
Method Details
-
getStart
Get the start number for this number range -
getEnd
Get the end number for this number range. -
inRange
Is the passed in number inside this range -
setEnd
Sets the end number for this number range- Parameters:
c- the end number- Throws:
IllegalArgumentException- if the end number is lesser (via a < comparison) than the current start number (equal to the start number is ok)
-
setStart
Set the start number for this number range- Throws:
IllegalArgumentException- if the start number is greater (via a > comparison) than the current end number (equal to the end number is ok)
-
getSize
Returns the size of this range which is calculated as the (endnumber - startnumber) + 1 - i.e., the number of slots in this range, start and end inclusive. -
toString
-
equals
-
hashCode
-
main
-