public final class IndexState
extends java.lang.Object
implements java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
private java.util.BitSet |
nonunique
Map of non-unique indices which need to be updated
|
private int |
primaryUid
UID of primary index, if any (0 if none)
|
private java.util.BitSet |
unique
Map of unique indices which need to be updated
|
Constructor and Description |
---|
IndexState()
Default constructor
|
IndexState(int ulen,
int nlen,
int primaryUid)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private java.util.BitSet |
bitSetFromUid(int idxUid)
Get the bit set upon which to operate, based on the value of the given index UID.
|
(package private) void |
clear(int idxUid)
Mark an index as having been updated by clearing its corresponding bit in the appropriate bit set.
|
(package private) void |
clearAll()
Clear all bits in both the unique and non-unique index bit sets.
|
boolean |
get(int idxUid)
Get the state of the index with the given index UID.
|
(package private) java.util.BitSet |
getBitSet(boolean isUnique)
Get the bit set associated with either the unique or non-unique indices.
|
boolean |
getPrimary()
Get the index identifier of the primary index, if any.
|
boolean |
isEmpty()
Indicate whether there are no indices remaining to be updated.
|
private int |
offsetFromUid(int idxUid)
Get the bit offset on which to operate, based on the value of the given index UID.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
void |
set(int idxUid,
boolean value)
Mark an index as needing to be updated.
|
(package private) void |
setAll(int ulen,
int nlen)
Set all bits in both the unique and non-unique index bit sets.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
private java.util.BitSet unique
private java.util.BitSet nonunique
private int primaryUid
public IndexState()
public IndexState(int ulen, int nlen, int primaryUid)
ulen
- Number of unique indices. May be 0, but not negative.nlen
- Number of non-unique indices. May be 0, but not negative.primaryUid
- Optional UID of the primary index, if any. Must be set to 0 if there is no primary index.public boolean get(int idxUid)
idxUid
- UID of the desired index.true
if the index has not yet been updated; false
if it has been updated.public void set(int idxUid, boolean value)
idxUid
- Identifier of a unique (positive value) or non-unique (negative value) index.value
- new valuevoid clear(int idxUid)
idxUid
- Identifier of a unique (positive value) or non-unique (negative value) index.public boolean isEmpty()
true
if there are no indices left to be updated, else false
. true
will naturally be reported for a table with no indices.public boolean getPrimary()
void setAll(int ulen, int nlen)
ulen
- Number of unique indices. May be 0, but not negative.nlen
- Number of non-unique indices. May be 0, but not negative.void clearAll()
java.util.BitSet getBitSet(boolean isUnique)
isUnique
- true
to get the unique index bit set; false
to get the non-unique index bit
set.private java.util.BitSet bitSetFromUid(int idxUid)
idxUid
- A positive or negative index UID. A value of 0 is considered invalid.private int offsetFromUid(int idxUid)
idxUid
- A positive or negative index UID. A value of 0 is considered invalid.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- Input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.