Package com.jidesoft.range
Class BigDecimalRange
- All Implemented Interfaces:
Range<BigDecimal>,Comparable<Range>
Specifies upper and lower bounds for a range of values
-
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.0BigDecimalRange(BigDecimalRange BigDecimalRange) Creates a copy of the supplied BigDecimalRangeBigDecimalRange(BigDecimal min, BigDecimal max) Create a numeric range by supplying minimum and maximum values -
Method Summary
Modifier and TypeMethodDescriptionvoidadjust(BigDecimal lower, BigDecimal upper) Adjusts the range.booleanDetermines whether the supplied point lies within this range.copy()createIntermediate(Range<BigDecimal> target, double position) booleanTest for equality based on the values of min and maxgetMax()getMin()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(BigDecimal max) Sets the maximum valuevoidsetMin(BigDecimal min) Sets the minimum valuedoublesize()Compute the size of the rangestretch(double stretchFactor) Creates a new BigDecimalRange by enlarging this numeric range about its mid-point.stretch(double stretchFactorForLower, double stretchFactorForUpper) Creates a new BigDecimalRange by enlarging this numeric range about its mid-point.toString()upper()Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, compareTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Field Details
-
_min
-
_max
-
-
Constructor Details
-
BigDecimalRange
public BigDecimalRange()Creates a numeric range with minimum 0.0 and maximum of 1.0 -
BigDecimalRange
Create a numeric range by supplying minimum and maximum values- Parameters:
min- the minimummax- the maximum
-
BigDecimalRange
Creates a copy of the supplied BigDecimalRange- Parameters:
BigDecimalRange- the BigDecimalRange instance to copy
-
-
Method Details
-
copy
- Overrides:
copyin classAbstractRange<BigDecimal>
-
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
- Returns:
- the minimum value
-
setMin
Sets the minimum value- Parameters:
min- the new minimum value.
-
getMax
- Returns:
- the maximum value
-
setMax
Sets the maximum value- Parameters:
max- the new maximum value.
-
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
-
adjust
Description copied from interface:RangeAdjusts the range.- Parameters:
lower- the new smallest value of the rangeupper- the new largest value of the range
-
upper
- Returns:
- the maximum() value for the range
-
contains
Description copied from interface:RangeDetermines whether the supplied point lies within this range. For continuous ranges this is interpreted as a pair of inequalities on the supplied value (i.e., min invalid input: '<'= x invalid input: '<'= max), but for discrete ranges thecontains()method is more like a set membership test.- Parameters:
x-- Returns:
- a boolean to indicate whether the supplied point lies within the range
-
stretch
Creates a new BigDecimalRange by enlarging this numeric range about its mid-point. For example to make it 10% bigger, use a stretch factor of 1.1. Note that this method can also be used to shrink a BigDecimalRange.- Parameters:
stretchFactor- the multiplication factor for the enlargement- Returns:
- a new BigDecimalRange
-
stretch
Creates a new BigDecimalRange by enlarging this numeric range about its mid-point. For example to make it 10% bigger, use a stretch factor of 1.1. Note that this method can also be used to shrink a BigDecimalRange.- Parameters:
stretchFactorForLower- the multiplication factor for the enlargement for the lower rangestretchFactorForUpper- the multiplication factor for the enlargement for the upper range- Returns:
- a new BigDecimalRange
-
createIntermediate
- Specified by:
createIntermediatein classAbstractRange<BigDecimal>
-
equals
Test for equality based on the values of min and max -
hashCode
public int hashCode() -
toString
-