Package com.jidesoft.range
Class IntegerRange
- All Implemented Interfaces:
Range<Integer>,Comparable<Range>
Specifies upper and lower bounds for a range of values
- Author:
- Simon
-
Field Summary
FieldsFields inherited from interface com.jidesoft.range.Range
PROPERTY_MAX, PROPERTY_MIN -
Constructor Summary
ConstructorsConstructorDescriptionCreates a numeric range with minimum 0.0 and maximum of 1.0IntegerRange(int min, int max) Create a numeric range by supplying minimum and maximum valuesIntegerRange(IntegerRange integerRange) Constructs a copy of the supplied IntegerRange object -
Method Summary
Modifier and TypeMethodDescriptionvoidAdjusts the range.booleanDetermines whether the range contains the supplied valuecopy()createIntermediate(Range<Integer> targetRange, double position) booleanTest for equality based on the values of min and maxintgetMax()intgetMin()inthashCode()lower()doublemaximum()This may be the numeric representation of upper() or it may be rounded up.doubleminimum()This may be the numeric representation of lower() or it may be rounded down.voidsetMax(int max) Sets the maximum valuevoidsetMin(int min) Sets the minimum valuedoublesize()Compute the size of the rangetoString()upper()Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, compareTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Field Details
-
_min
protected int _min -
_max
protected int _max
-
-
Constructor Details
-
IntegerRange
public IntegerRange()Creates a numeric range with minimum 0.0 and maximum of 1.0 -
IntegerRange
public IntegerRange(int min, int max) Create a numeric range by supplying minimum and maximum values- Parameters:
min- the minimummax- the maximum
-
IntegerRange
Constructs a copy of the supplied IntegerRange object- Parameters:
integerRange- the integer range object to copy
-
-
Method Details
-
copy
- Overrides:
copyin classAbstractRange<Integer>
-
minimum
public double minimum()Description copied from interface:RangeThis may be the numeric representation of lower() or it may be rounded down.- Returns:
- the minimum value
-
maximum
public double maximum()Description copied from interface:RangeThis may be the numeric representation of upper() or it may be rounded up.- Returns:
- the maximum value
-
getMin
public int getMin()- Returns:
- the minimum value
-
setMin
public void setMin(int min) Sets the minimum value- Parameters:
min- the new minimum value.
-
getMax
public int getMax()- Returns:
- the maximum value
-
setMax
public void setMax(int max) Sets the maximum value- Parameters:
max- the new maximum value.
-
adjust
Description copied from interface:RangeAdjusts the range.- Parameters:
lower- the new smallest value of the rangeupper- the new largest value of the range
-
size
public double size()Description copied from interface:RangeCompute the size of the range- Returns:
- the size of the range
-
lower
- Returns:
- the minimum() value for the range
-
upper
- Returns:
- the maximum() value for the range
-
contains
Determines whether the range contains the supplied value- Parameters:
x-- Returns:
- a boolean to indicate whether the supplied point lies within the range
-
createIntermediate
- Specified by:
createIntermediatein classAbstractRange<Integer>
-
equals
Test for equality based on the values of min and max -
hashCode
public int hashCode() -
toString
-