private class UniqueTracker.UniqueIndex.Key
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int[] |
fieldPos
The fields that the unique index is compounded of.
|
private int |
hash
The pre-computed
hash code |
private boolean |
hasNulls
Flags whether the record has
null values for fields components of this unique
index. |
private java.lang.Object[] |
snapshot
The snapshot of the record at the moment of indexing.
|
| Constructor and Description |
|---|
Key(UniqueTracker.UniqueIndex uniqueIndex,
java.lang.Object[] data)
Creates a new, immutable
Key object. |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addToIndex(java.lang.Long id)
Add this key to its enclosing
UniqueIndex. |
private int |
computeHash()
Computes the hash code for this unique key.
|
boolean |
equals(java.lang.Object o)
Test for equality with a specified object.
|
int |
hashCode()
Obtain the hash code for this unique key.
|
(package private) void |
removeFromIndex()
Remove this key from its enclosing
UniqueIndex. |
java.lang.String |
toString()
Composes and return a short description of this object which includes the values of the indexed
fields.
|
private final java.lang.Object[] snapshot
private final int[] fieldPos
BitSet.private final int hash
hash codeprivate boolean hasNulls
null values for fields components of this unique
index. In this case the record is unique.public Key(UniqueTracker.UniqueIndex uniqueIndex, java.lang.Object[] data)
Key object. For performance reasons, the
hash code will be computed only once and the hasNulls will also be
evaluated.uniqueIndex - The components of the index, by their position in data array.data - The values of the fields in the record (a reference will be saved, not
copied).public boolean equals(java.lang.Object o)
data array is specified in the fieldPos) must be different except when one of them is null, in which case
the records are unique.equals in class java.lang.Objecto - The object to be tested against.true if and only if the two keys are equals from the point of view of
the 4GL uniqueness semantics.public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectvoid addToIndex(java.lang.Long id)
UniqueIndex. The index is locked before the
operation and released after.id - Primary key to associate with this key.void removeFromIndex()
UniqueIndex. The index is locked before
the operation and released after.private int computeHash()