Package org.openl.rules.helpers
Class IntRange
- java.lang.Object
-
- org.openl.rules.range.Range<Long>
-
- org.openl.rules.helpers.IntRange
-
- All Implemented Interfaces:
INumberRange
- Direct Known Subclasses:
CtrIntRange
public class IntRange extends Range<Long> implements INumberRange
TheIntRangeclass stores range of integers. Examples : "1-3", "2 .. 4", "123 ... 1000" (Important: using of ".." and "..." requires spaces between numbers and separator).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openl.rules.range.Range
Range.Bound, Range.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected longmaxprotected longminprotected Range.Typetype
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IntRangeautocast(byte x, IntRange y)static IntRangeautocast(int x, IntRange y)static IntRangeautocast(long x, IntRange y)static IntRangeautocast(short x, IntRange y)static IntRangecast(double x, IntRange y)static IntRangecast(float x, IntRange y)static IntRangecast(BigDecimal x, IntRange y)static IntRangecast(BigInteger x, IntRange y)protected intcompare(Long left, Long right)booleancontains(Number n)booleancontains(BigInteger value)static intdistance(byte x, IntRange y)static intdistance(double x, IntRange y)static intdistance(float x, IntRange y)static intdistance(int x, IntRange y)static intdistance(long x, IntRange y)static intdistance(short x, IntRange y)static intdistance(BigDecimal x, IntRange y)static intdistance(BigInteger x, IntRange y)protected LonggetLeft()longgetMax()longgetMin()protected LonggetRight()Range.TypegetType()
-
-
-
Field Detail
-
min
protected long min
-
max
protected long max
-
type
protected final Range.Type type
-
-
Constructor Detail
-
IntRange
public IntRange(long min, long max)Constructor forIntRangewith providedminandmaxvalues.
-
IntRange
public IntRange(long number)
-
IntRange
public IntRange()
-
IntRange
public IntRange(String range)
Constructor forIntRange. Tries to parse range text with variety of formats. Supported range formats: "- " or "[<, <=, >, >=] " or " +" Also numbers can be enhanced with $ sign and K,M,B, e.g. $1K = 1000 Any symbols at the end are allowed to support expressions like ">=2 barrels", "6-8 km^2"
-
-
Method Detail
-
contains
public boolean contains(BigInteger value)
-
getMax
public long getMax()
-
getMin
public long getMin()
-
contains
public boolean contains(Number n)
- Specified by:
containsin interfaceINumberRange
-
getType
public Range.Type getType()
-
distance
public static int distance(byte x, IntRange y)
-
distance
public static int distance(short x, IntRange y)
-
distance
public static int distance(int x, IntRange y)
-
distance
public static int distance(long x, IntRange y)
-
distance
public static int distance(float x, IntRange y)
-
distance
public static int distance(double x, IntRange y)
-
cast
public static IntRange cast(BigInteger x, IntRange y)
-
distance
public static int distance(BigInteger x, IntRange y)
-
cast
public static IntRange cast(BigDecimal x, IntRange y)
-
distance
public static int distance(BigDecimal x, IntRange y)
-
-