com.alexkasko.unsafe.offheapstruct
public static class OffHeapStructBinarySearch.IndexRange extends Object implements Serializable
OffHeapStructCollection
index range representation.
Was made mutable to prevent new object instantiation for each search.
isEmpty()
method should be checked before accessing indices.
Empty range will contain negative equal indices which values are
-index - 1
where the element would be inserted.
Range with size 1
will contain equal indices.Modifier and Type | Field and Description |
---|---|
private boolean |
empty |
private long |
fromIndex |
private static long |
serialVersionUID |
private long |
toIndex |
Constructor and Description |
---|
OffHeapStructBinarySearch.IndexRange() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
long |
getFromIndex()
Start index or
-index - 1
where the element would be inserted for empty range |
long |
getToIndex()
End index or
-index - 1
where the element would be inserted for empty range |
int |
hashCode() |
boolean |
isEmpty()
Whether this range is empty
|
boolean |
isNotEmpty()
Whether this range is not empty
|
(package private) void |
set(long from,
long to)
Sets boundaries for non-empty range
|
(package private) void |
setEmpty(long value)
Sets value for empty range
|
String |
toString() |
private static final long serialVersionUID
private boolean empty
private long fromIndex
private long toIndex
public OffHeapStructBinarySearch.IndexRange()
void setEmpty(long value)
value
- negative value for empty range returned by searchvoid set(long from, long to)
from
- start indexto
- end indexpublic boolean isEmpty()
public boolean isNotEmpty()
public long getFromIndex()
-index - 1
where the element would be inserted for empty range-index - 1
where the element would be inserted for empty rangepublic long getToIndex()
-index - 1
where the element would be inserted for empty range-index - 1
where the element would be inserted for empty rangeCopyright © 2014. All Rights Reserved.