Class Range
java.lang.Object
org.openstreetmap.josm.gui.mappaint.Range
A scale interval of the form "lower < x <= upper" where 0 <= lower < upper.
(upper can be Double.POSITIVE_INFINITY)
immutable class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleprivate final doublestatic final RangeThe full scale range from zero to infinity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x) Check if a number is contained in this rangestatic Rangeprovides the intersection of 2 overlapping rangesbooleandoublegetLower()Gets the lower bounddoublegetUpper()Gets the upper boundinthashCode()reduceAround(double x, Range other) under the premise, that x is within this range, and not within the other range, it shrinks this range in a way to exclude the other range, but still contain x.toString()
-
Field Details
-
lower
-
upper
-
ZERO_TO_INFINITY
The full scale range from zero to infinity
-
-
Constructor Details
-
Range
Constructs a newRange.- Parameters:
lower- Lower bound. Must be positive or zeroupper- Upper bound- Throws:
IllegalArgumentException- if the range is invalid (lower < 0 || lower >= upper)
-
-
Method Details
-
contains
Check if a number is contained in this range- Parameters:
x- The number to test- Returns:
trueif it is in this range
-
cut
provides the intersection of 2 overlapping ranges- Parameters:
a- first rangeb- second range- Returns:
- intersection of
aandb
-
reduceAround
under the premise, that x is within this range, and not within the other range, it shrinks this range in a way to exclude the other range, but still contain x. x | this (------------------------------] other (-------] or (-----------------] result (----------------]- Parameters:
x- valueother- other range- Returns:
- reduced range
-
getLower
Gets the lower bound- Returns:
- The lower, exclusive, bound
-
getUpper
Gets the upper bound- Returns:
- The upper, inclusive, bound
-
toString
-
equals
-
hashCode
-