Package com.jidesoft.range
Class BigDecimalRange
- java.lang.Object
-
- com.jidesoft.range.AbstractRange<java.math.BigDecimal>
-
- com.jidesoft.range.BigDecimalRange
-
public class BigDecimalRange extends AbstractRange<java.math.BigDecimal>
Specifies upper and lower bounds for a range of values
-
-
Field Summary
Fields Modifier and Type Field Description protected java.math.BigDecimal_maxprotected java.math.BigDecimal_min-
Fields inherited from interface com.jidesoft.range.Range
PROPERTY_MAX, PROPERTY_MIN
-
-
Constructor Summary
Constructors Constructor Description BigDecimalRange()Creates a numeric range with minimum 0.0 and maximum of 1.0BigDecimalRange(BigDecimalRange BigDecimalRange)Creates a copy of the supplied BigDecimalRangeBigDecimalRange(java.math.BigDecimal min, java.math.BigDecimal max)Create a numeric range by supplying minimum and maximum values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjust(java.math.BigDecimal lower, java.math.BigDecimal upper)Adjusts the range.booleancontains(java.math.BigDecimal x)Determines whether the supplied point lies within this range.Range<java.math.BigDecimal>copy()Range<java.math.BigDecimal>createIntermediate(Range<java.math.BigDecimal> target, double position)booleanequals(java.lang.Object other)Test for equality based on the values of min and maxjava.math.BigDecimalgetMax()java.math.BigDecimalgetMin()inthashCode()java.math.BigDecimallower()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(java.math.BigDecimal max)Sets the maximum valuevoidsetMin(java.math.BigDecimal min)Sets the minimum valuedoublesize()Compute the size of the rangeBigDecimalRangestretch(double stretchFactor)Creates a new BigDecimalRange by enlarging this numeric range about its mid-point.BigDecimalRangestretch(double stretchFactorForLower, double stretchFactorForUpper)Creates a new BigDecimalRange by enlarging this numeric range about its mid-point.java.lang.StringtoString()java.math.BigDecimalupper()-
Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, compareTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
BigDecimalRange
public BigDecimalRange()
Creates a numeric range with minimum 0.0 and maximum of 1.0
-
BigDecimalRange
public BigDecimalRange(java.math.BigDecimal min, java.math.BigDecimal max)Create a numeric range by supplying minimum and maximum values- Parameters:
min- the minimummax- the maximum
-
BigDecimalRange
public BigDecimalRange(BigDecimalRange BigDecimalRange)
Creates a copy of the supplied BigDecimalRange- Parameters:
BigDecimalRange- the BigDecimalRange instance to copy
-
-
Method Detail
-
copy
public Range<java.math.BigDecimal> copy()
- Overrides:
copyin classAbstractRange<java.math.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
public java.math.BigDecimal getMin()
- Returns:
- the minimum value
-
setMin
public void setMin(java.math.BigDecimal min)
Sets the minimum value- Parameters:
min- the new minimum value.
-
getMax
public java.math.BigDecimal getMax()
- Returns:
- the maximum value
-
setMax
public void setMax(java.math.BigDecimal max)
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
public java.math.BigDecimal lower()
- Returns:
- the minimum() value for the range
-
adjust
public void adjust(java.math.BigDecimal lower, java.math.BigDecimal upper)Description copied from interface:RangeAdjusts the range.- Parameters:
lower- the new smallest value of the rangeupper- the new largest value of the range
-
upper
public java.math.BigDecimal upper()
- Returns:
- the maximum() value for the range
-
contains
public boolean contains(java.math.BigDecimal x)
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 <= x <= max), but for discrete ranges thecontains()method is more like a set membership test.- Returns:
- a boolean to indicate whether the supplied point lies within the range
-
stretch
public BigDecimalRange stretch(double stretchFactor)
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
public BigDecimalRange stretch(double stretchFactorForLower, double stretchFactorForUpper)
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
public Range<java.math.BigDecimal> createIntermediate(Range<java.math.BigDecimal> target, double position)
- Specified by:
createIntermediatein classAbstractRange<java.math.BigDecimal>
-
equals
public boolean equals(java.lang.Object other)
Test for equality based on the values of min and max- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-