public class IntegerBlockArray
extends java.lang.Object
get(int)
and set(int, int)
.
The array is divide in many parts, whereby one part can be stored in one block of a block-heap,
see AllocInBlock
. Usual one part can store about 100 values.
With a 2-level tree structure 10000 values can be stored, with 3 level 1 million etc.
The size of the array is general unlimited, only the memory space on execution machine is limited.
Increasing the size does not re-allocate and does not move large data, only allocate new memory blocks.Modifier and Type | Field and Description |
---|---|
(package private) int[] |
array |
(package private) int |
bit1 |
(package private) int |
bit2 |
(package private) IntegerBlockArray[] |
blocks |
(package private) int |
size
Size of this array inclusively maybe sub blocks.
|
static int |
version
Version, history and license.
|
Constructor and Description |
---|
IntegerBlockArray(int newSize) |
Modifier and Type | Method and Description |
---|---|
int |
binarySearch(int val,
int max)
Searches the value in the arrays and returns the index of that value, which is equal
or near lesser than the requested one.
|
int |
binarySearchFirstKey(int val,
int max)
Searches the value in the arrays and returns the index of the first occurence of that value, which is equal
or near lesser than the requested one.
|
(package private) int |
get(int ix) |
static void |
main(java.lang.String[] args) |
(package private) void |
set(int ix,
int val) |
(package private) void |
setSize(int newSize) |
public static final int version
binarySearch(int, int)
, new binarySearchFirstKey(int, int)
.
It was a mix before with a faulty algorithm.
int[] array
int bit1
int bit2
int size
IntegerBlockArray[] blocks
int get(int ix)
void set(int ix, int val)
void setSize(int newSize)
public int binarySearch(int val, int max)
val
- max
- public int binarySearchFirstKey(int val, int max)
val
- max
- public static void main(java.lang.String[] args)