public abstract class LongRangeSet
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
abstract LongRangeSet |
abs(boolean isLong)
Returns a range which represents all the possible values after applying
Math.abs(int) or Math.abs(long)
to the values from this set |
static LongRangeSet |
all() |
LongRangeSet |
binOpFromToken(IElementType token,
LongRangeSet right,
boolean isLong)
Performs a supported binary operation from token (defined in
JavaTokenType ). |
LongRangeSet |
bitwiseAnd(LongRangeSet other)
Returns a range which represents all the possible values after applying
x & y operation for
all x from this set and for all y from the other set. |
LongRangeSet |
bitwiseOr(LongRangeSet other,
boolean isLong)
Returns a range which represents all the possible values after applying
x | y operation for
all x from this set and for all y from the other set. |
LongRangeSet |
bitwiseXor(LongRangeSet other,
boolean isLong)
Returns a range which represents all the possible values after applying
x ^ y operation for
all x from this set and for all y from the other set. |
abstract LongRangeSet |
castTo(PsiPrimitiveType type) |
abstract boolean |
contains(long value)
Checks whether current set contains given value
|
abstract boolean |
contains(LongRangeSet other)
Checks whether current set contains all the values from other set
|
LongRangeSet |
div(LongRangeSet divisor,
boolean isLong)
Returns a range which represents all the possible values after applying
x / y operation for
all x from this set and for all y from the divisor set. |
static LongRangeSet |
empty() |
static LongRangeSet |
fromConstant(java.lang.Object val)
Creates a set containing single value which is equivalent to supplied boxed constant (if its type is supported)
|
static LongRangeSet |
fromPsiElement(PsiModifierListOwner owner) |
LongRangeSet |
fromRelation(RelationType relation)
Creates a new set which contains all possible values satisfying given predicate regarding the current set.
|
static LongRangeSet |
fromRemainder(long mod,
LongRangeSet remainders)
Creates a LongRangeSet of values
x for which remainders.contains(x % mod) . |
static LongRangeSet |
fromType(PsiType type)
Creates a range for given type (for primitives and boxed: values range)
|
java.lang.Long |
getConstantValue() |
abstract java.lang.String |
getPresentationText(PsiType type) |
static LongRangeSet |
indexRange() |
abstract LongRangeSet |
intersect(LongRangeSet other)
Intersects current set with other
|
abstract boolean |
intersects(LongRangeSet other)
Checks if current set and other set have at least one common element
|
abstract boolean |
isCardinalityBigger(long cutoff) |
boolean |
isEmpty() |
abstract long |
max() |
abstract long |
min() |
LongRangeSet |
minus(LongRangeSet other,
boolean isLong)
Returns a range which represents all the possible values after performing an addition between any value from this range
and any value from other range.
|
abstract LongRangeSet |
mod(LongRangeSet divisor)
Returns a range which represents all the possible values after applying
x % y operation for
all x from this set and for all y from the divisor set. |
static LongRangeSet |
modRange(long from,
long to,
long mod,
long bits)
Creates a new set which contains all the numbers between from (inclusive) and to (inclusive)
which are equal to any of the set bits in supplied bit-mask modulo supplied mod
|
abstract LongRangeSet |
mul(LongRangeSet multiplier,
boolean isLong) |
abstract LongRangeSet |
negate(boolean isLong)
Returns a range which represents all the possible values after applying unary minus
to the values from this set
|
abstract LongRangeSet |
plus(LongRangeSet other,
boolean isLong)
Returns a range which represents all the possible values after performing an addition between any value from this range
and any value from other range.
|
static LongRangeSet |
point(long value)
Creates a set containing single given value
|
static LongRangeSet |
range(long from,
long to)
Creates a new set which contains all the numbers between from (inclusive) and to (inclusive)
|
LongRangeSet |
shiftLeft(LongRangeSet shiftSize,
boolean isLong)
Returns a range which represents all the possible values after applying
x << y operation for
all x from this set and for all y from the shiftSize set. |
LongRangeSet |
shiftRight(LongRangeSet shiftSize,
boolean isLong)
Returns a range which represents all the possible values after applying
x >> y operation for
all x from this set and for all y from the shiftSize set. |
abstract java.util.stream.LongStream |
stream()
Returns a stream of all values from this range.
|
abstract LongRangeSet |
subtract(LongRangeSet other)
Subtracts given set from the current
|
boolean |
subtractionMayOverflow(LongRangeSet other,
boolean isLong)
Checks whether subtraction of this and other range may overflow
|
abstract LongRangeSet |
unite(LongRangeSet other)
Merge current set with other
|
LongRangeSet |
unsignedShiftRight(LongRangeSet shiftSize,
boolean isLong)
Returns a range which represents all the possible values after applying
x >>> y operation for
all x from this set and for all y from the shiftSize set. |
LongRangeSet |
wideBinOpFromToken(IElementType token,
LongRangeSet other,
boolean isLong) |
LongRangeSet |
without(long value) |
public abstract LongRangeSet subtract(LongRangeSet other)
other
- set to subtractpublic LongRangeSet without(long value)
public boolean isEmpty()
public abstract LongRangeSet intersect(LongRangeSet other)
other
- other set to intersect withpublic abstract LongRangeSet unite(LongRangeSet other)
other
- other set to merge withpublic abstract long min()
java.util.NoSuchElementException
- if set is emptypublic abstract long max()
java.util.NoSuchElementException
- if set is emptypublic java.lang.Long getConstantValue()
public abstract boolean intersects(LongRangeSet other)
other
- other set to check whether intersection existspublic abstract boolean contains(long value)
value
- value to findpublic abstract boolean contains(LongRangeSet other)
other
- a sub-set candidatepublic LongRangeSet fromRelation(RelationType relation)
E.g. if current set is {0..10} and relation is "GT", then result will be {1..Long.MAX_VALUE} (values which can be greater than some value from the current set)
relation
- relation to be applied to current set (JavaTokenType.EQEQ/NE/GT/GE/LT/LE)public abstract java.lang.String getPresentationText(PsiType type)
public final LongRangeSet binOpFromToken(IElementType token, LongRangeSet right, boolean isLong)
JavaTokenType
).token
- a token which corresponds to the operationright
- a right-hand operandisLong
- true if operation should be performed on long types (otherwise int is assumed)public LongRangeSet wideBinOpFromToken(IElementType token, LongRangeSet other, boolean isLong)
public abstract boolean isCardinalityBigger(long cutoff)
public abstract LongRangeSet castTo(PsiPrimitiveType type)
public abstract LongRangeSet abs(boolean isLong)
Math.abs(int)
or Math.abs(long)
to the values from this setisLong
- whether Math.abs(long)
is appliedpublic abstract LongRangeSet negate(boolean isLong)
isLong
- whether result should be truncated to int
public abstract LongRangeSet plus(LongRangeSet other, boolean isLong)
isLong
- whether result should be truncated to int
public LongRangeSet minus(LongRangeSet other, boolean isLong)
isLong
- whether result should be truncated to int
public LongRangeSet bitwiseOr(LongRangeSet other, boolean isLong)
x | y
operation for
all x
from this set and for all y
from the other set. The resulting set may contain
some more values.other
- other set to perform bitwise-or withpublic LongRangeSet bitwiseXor(LongRangeSet other, boolean isLong)
x ^ y
operation for
all x
from this set and for all y
from the other set. The resulting set may contain
some more values.other
- other set to perform bitwise-xor withpublic LongRangeSet bitwiseAnd(LongRangeSet other)
x & y
operation for
all x
from this set and for all y
from the other set. The resulting set may contain
some more values.other
- other set to perform bitwise-and withpublic abstract LongRangeSet mul(LongRangeSet multiplier, boolean isLong)
public LongRangeSet div(LongRangeSet divisor, boolean isLong)
x / y
operation for
all x
from this set and for all y
from the divisor set. The resulting set may contain
some more values. Division by zero yields an empty set of possible results.divisor
- divisor set to divide byisLong
- whether the operation is performed on long type (if false, the int type is assumed). This only changes the special
treatment of MIN_VALUE/-1
division; other division results do not depend on the resulting type.public boolean subtractionMayOverflow(LongRangeSet other, boolean isLong)
other
- range to subtract from this rangeisLong
- whether subtraction should be performed on long values (otherwise int is assumed)public LongRangeSet shiftLeft(LongRangeSet shiftSize, boolean isLong)
x << y
operation for
all x
from this set and for all y
from the shiftSize set. The resulting set may contain
some more values.shiftSize
- set of possible shift sizes (number of bits to shift to the left)isLong
- whether the operation is performed on long type (if false, the int type is assumed).public LongRangeSet shiftRight(LongRangeSet shiftSize, boolean isLong)
x >> y
operation for
all x
from this set and for all y
from the shiftSize set. The resulting set may contain
some more values.shiftSize
- set of possible shift sizes (number of bits to shift to the right)isLong
- whether the operation is performed on long type (if false, the int type is assumed).public LongRangeSet unsignedShiftRight(LongRangeSet shiftSize, boolean isLong)
x >>> y
operation for
all x
from this set and for all y
from the shiftSize set. The resulting set may contain
some more values.shiftSize
- set of possible shift sizes (number of bits to shift to the right)isLong
- whether the operation is performed on long type (if false, the int type is assumed).public abstract LongRangeSet mod(LongRangeSet divisor)
x % y
operation for
all x
from this set and for all y
from the divisor set. The resulting set may contain
some more values. Division by zero yields an empty set of possible results.divisor
- divisor set to divide bypublic abstract java.util.stream.LongStream stream()
public static LongRangeSet empty()
public static LongRangeSet all()
public static LongRangeSet point(long value)
value
- a value to be included into the setpublic static LongRangeSet fromConstant(java.lang.Object val)
val
- constant to create a set frompublic static LongRangeSet range(long from, long to)
from
- lower boundto
- upper bound (must be greater or equal to from
)public static LongRangeSet modRange(long from, long to, long mod, long bits)
from
- lower boundto
- upper bound (must be greater or equal to from
)mod
- modulus; only modulus up to 64 is supported; bigger modulus is not tracked (instead full range will be returned)bits
- a bit-mask which represents allowed remainders: 0b1 represents that only (x % mod == 0) numbers are included;
0b10 represents that only (x % mod == 1) numbers are included and so on.public static LongRangeSet indexRange()
public static LongRangeSet fromType(PsiType type)
type
- type to create a range forpublic static LongRangeSet fromPsiElement(PsiModifierListOwner owner)
public static LongRangeSet fromRemainder(long mod, LongRangeSet remainders)
x
for which remainders.contains(x % mod)
.
May include more values as well.mod
- a divisorremainders
- set of allowed remainders