Key
- Type
- class IndexMultiTable_Table<Key extends java.lang.Comparable<Key>,Type>
extends java.lang.Object
IndexMultiTable
. This is a package-private class only used in IndexMultiTable
.Modifier and Type | Field and Description |
---|---|
protected Key[] |
aKeys
Array of all keys.
|
protected java.lang.Object[] |
aValues
Array of objects appropriate to the keys.
|
(package private) int |
identParent
A identifier number for debugging.
|
(package private) static int |
identParent_ |
protected boolean |
isHyperBlock
True, than
aValues contains instances of this class too. |
(package private) int |
ixInParent
Index of this table in its parent.
|
protected static int |
maxBlock
The maximal nr of elements in a block, maximal value of sizeBlock.
|
(package private) IndexMultiTable_Table<Key,Type> |
parent
The parent if it is a child table.
|
(package private) IndexMultiTable<Key,Type> |
rootIdxTable
Reference to the root data.
|
(package private) int |
sizeAll
actual number of leaf objects stored in the table tree of this and its children.
|
(package private) int |
sizeBlock
actual number of objects stored in this table.
|
static java.lang.String |
sVersion
Version, history and license.
|
Constructor and Description |
---|
IndexMultiTable_Table(IndexMultiTable.Provide<Key> provider)
constructs an empty root table.
|
IndexMultiTable_Table(IndexMultiTable<Key,Type> root1)
constructs an empty table.
|
Modifier and Type | Method and Description |
---|---|
private void |
addSizeAll(int add)
Change the size in this table and in all parents.
|
private static void |
assert1(boolean cond) |
(package private) int |
binarySearchFirstKey(java.lang.Comparable<Key>[] a,
int fromIndex,
int toIndex,
java.lang.Object key)
Binary search of the element, which is the first with the given key.
|
(package private) int |
check() |
(package private) Key |
checkTable(IndexMultiTable_Table<Key,Type> parentP,
Key keyParentP,
int ixInParentP,
Key keylastP)
Checks the consistency of the table.
|
(package private) void |
clear()
Delete all content.
|
(package private) void |
clearRestArray(IndexMultiTable_Table<Key,Type> dst)
|
protected int |
compare(java.lang.Comparable<Key> val1,
java.lang.Object key)
Assures that if val1 is a String, the key is converted toString() before comparison.
|
private void |
correctKey0InParents()
Correct the key in the parent if the key on aKeys[0] was changed.
|
protected void |
delete(int ix)
Deletes the element on ix in the current table.
|
(package private) int |
movein(IndexMultiTable_Table<Key,Type> src,
IndexMultiTable_Table<Key,Type> dst,
int ixSrc,
int ixDst,
int nrof)
Moves some elements of the src table in the dst table.
|
(package private) Type |
putOrAdd(Key sortKey,
Type value,
Type valueNext,
IndexMultiTable.KindofAdd kind)
Puts or adds an object in the table.
|
(package private) boolean |
searchAndSortin(Key sortkey,
Type value,
int ixstart,
Type valueNext)
Sorts in the given value before the given element with the same key forward.
|
(package private) boolean |
searchbackAndSortin(Key sortkey,
Type value,
int ixstart,
Type valueNext)
Sorts in the given value before the given element with the same key backward.
|
(package private) IndexMultiTable_Table<Key,Type> |
searchInTables(java.lang.Object key1,
boolean exact,
IndexMultiTable.IndexBox ixFound)
Searches the key in the tables.
|
(package private) boolean |
searchLastAndSortin(Key sortkey,
Type value,
int ixstart)
Sorts in the given value after all other values with the same key.
|
private void |
setKeyValue(int ix,
Key key,
java.lang.Object value) |
(package private) void |
sortin(int ix,
Key sortkey,
java.lang.Object value)
inserts the given element into the table at given position.
|
private IndexMultiTable_Table<Key,Type> |
splitIntoSibling(int ix,
Key key1,
java.lang.Object obj1)
Split this table in 2 tables referred from the parent table.
|
private void |
splitTopLevel(int idx,
Key key1,
java.lang.Object obj1)
Splits the top level into 2 child tables and inserts the given element.
|
java.lang.String |
toString() |
private void |
toString(java.lang.StringBuilder u) |
public static final java.lang.String sVersion
IndexMultiTable
.Table without functional changes.
protected static final int maxBlock
static int identParent_
protected final Key extends java.lang.Comparable<Key>[] aKeys
protected final java.lang.Object[] aValues
IndexMultiTable_Table
if this is a hyper-table, or a Type-instanceint sizeBlock
int sizeAll
protected boolean isHyperBlock
aValues
contains instances of this class too.final int identParent
int ixInParent
IndexMultiTable_Table<Key extends java.lang.Comparable<Key>,Type> parent
final IndexMultiTable<Key extends java.lang.Comparable<Key>,Type> rootIdxTable
IndexMultiTable_Table(IndexMultiTable.Provide<Key> provider)
IndexMultiTable_Table(IndexMultiTable<Key,Type> root1)
int binarySearchFirstKey(java.lang.Comparable<Key>[] a, int fromIndex, int toIndex, java.lang.Object key)
a
- The arrayfromIndex
- start index, first positiontoIndex
- end index. exclusive last position in akey
- search keyprotected int compare(java.lang.Comparable<Key> val1, java.lang.Object key)
val1
- key
- Type putOrAdd(Key sortKey, Type value, Type valueNext, IndexMultiTable.KindofAdd kind)
boolean searchLastAndSortin(Key sortkey, Type value, int ixstart)
sortin(int, Comparable, Object)
after the last
found key.
sortkey
- The key for sort values.value
- ixstart
- The start index where a this key is found.boolean searchAndSortin(Key sortkey, Type value, int ixstart, Type valueNext)
sortkey
- The key for sort values.value
- ixstart
- The start index where a this key is found.valueNext
- the requested next value.boolean searchbackAndSortin(Key sortkey, Type value, int ixstart, Type valueNext)
sortkey
- The key for sort values.value
- ixstart
- The start index where a this key is found.valueNext
- the requested next value.void sortin(int ix, Key sortkey, java.lang.Object value)
splitIntoSibling(int, Comparable, Object)
or splitTopLevel(int, Comparable, Object)
.
If the table is split, the value is inserted in the correct table.ix
- The index position for the actual table where the value should be sorted in.sortkey
- sorting string to insert.value
- value to insert.private void splitTopLevel(int idx, Key key1, java.lang.Object obj1)
idx
- key1
- obj1
- private IndexMultiTable_Table<Key,Type> splitIntoSibling(int ix, Key key1, java.lang.Object obj1)
ix
- if <0 then do not sortin a key, obj1key1
- obj1
- int movein(IndexMultiTable_Table<Key,Type> src, IndexMultiTable_Table<Key,Type> dst, int ixSrc, int ixDst, int nrof)
src
- The source tabledst
- The destination tableixSrc
- Position in srcixDst
- Position in dstnrof
- number of elements to move from src to dst.sizeAll
void clearRestArray(IndexMultiTable_Table<Key,Type> dst)
dst
- The table where clean up is done.protected void delete(int ix)
ix
- void clear()
Map.clear()
IndexMultiTable_Table<Key,Type> searchInTables(java.lang.Object key1, boolean exact, IndexMultiTable.IndexBox ixFound)
key1
- The keyexact
- if true then returns null and retFound[0] = false if the key was not found
if false then returns the first value at or after the key, see #search(Comparable)
.ixFound
- should be create newly or initialize.
If the key was found, the found is set to true. If the key is not found, the found is not
touched. It should be false initially. If the key is found and the value for this key is null, found true.
Only with this the #containsKey(Object)
works probably.
ix is set in any case if this method does not return null.private void addSizeAll(int add)
add
- usual +1 or -1 for add and delete.private void correctKey0InParents()
private void setKeyValue(int ix, Key key, java.lang.Object value)
int check()
private static void assert1(boolean cond)
Key checkTable(IndexMultiTable_Table<Key,Type> parentP, Key keyParentP, int ixInParentP, Key keylastP)
parentP
- The parent of this table or null for the top table.keyParentP
- The key of this table in the parents entry. null for top table.ixInParentP
- The position of this table in the parent's table. -1 for top table.keylastP
- The last key from the walking through the last child, minimal key for top table.private void toString(java.lang.StringBuilder u)
public java.lang.String toString()
toString
in class java.lang.Object