Package org.openl.rules.helpers
Class IntRange
- java.lang.Object
-
- org.openl.rules.helpers.IntRange
-
- All Implemented Interfaces:
INumberRange
- Direct Known Subclasses:
CharRange,CtrIntRange
public class IntRange extends Object implements INumberRange
TheIntRangeclass stores range of integers. Examples : "1-3", "2 .. 4", "123 ... 1000" (Important: using of ".." and "..." requires spaces between numbers and separator).
-
-
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)booleancontains(long value)booleancontains(Number n)booleancontains(BigInteger value)booleancontains(IntRange range)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)booleanequals(Object obj)longgetMax()longgetMin()inthashCode()StringtoString()
-
-
-
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)
-
contains
public boolean contains(IntRange range)
-
contains
public boolean contains(long value)
-
getMax
public long getMax()
-
getMin
public long getMin()
-
contains
public boolean contains(Number n)
- Specified by:
containsin interfaceINumberRange
-
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)
-
-