public class NodeIndex extends BaseEntity implements Comparable<NodeIndex>
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
characters |
(package private) boolean |
isString
True if the value is an index to a sub string.
|
private Node |
node |
(package private) int |
relatedNodeOffset
The node index for the sequence of characters.
|
private byte[] |
value
The value of the node index.
|
| Constructor and Description |
|---|
NodeIndex(Dataset dataSet,
int index,
boolean isString,
byte[] value,
int relatedNodeOffset)
Constructs a new instance of NodeIndex
|
| Modifier and Type | Method and Description |
|---|---|
(package private) int |
compareTo(byte[] other,
int startIndex)
Compares a byte array of characters at the position provided to the array
of characters for this node.
|
int |
compareTo(NodeIndex other)
Compares this node index to another.
|
(package private) byte[] |
getCharacters()
Returns the characters related to this node index.
|
private static byte[] |
getCharacters(Dataset dataSet,
boolean isString,
byte[] value)
Returns the characters the node index relates to.
|
(package private) Node |
getNode()
The node this index relates to.
|
(package private) void |
init()
Called after the entire data set has been loaded to ensure any further
initialisation steps that require other items in the data set can be
completed.
|
private static byte[] |
nonZeros(byte[] value)
Returns the non zero values in the array.
|
String |
toString()
Converts the node index into a string.
|
binarySearch, getDataSet, getIndex, readIntegerArrayfinal int relatedNodeOffset
final boolean isString
private final byte[] value
private byte[] characters
private Node node
public NodeIndex(Dataset dataSet, int index, boolean isString, byte[] value, int relatedNodeOffset)
dataSet - The data set the node is contained withinindex - The index of this object in the NodeisString - True if the value is an integer offset to a string, or
false if the value is an array of characters to be used by the node.value - Array of bytes representing an integer offset to a string,
or the array of characters to be used by the node.relatedNodeOffset - The offset in the list of nodes to the node the
index relates tobyte[] getCharacters()
throws IOException
IOExceptionNode getNode() throws IOException
IOExceptionvoid init() throws IOException
IOExceptionprivate static byte[] getCharacters(Dataset dataSet, boolean isString, byte[] value) throws IOException
dataSet - isString - value - IOExceptionprivate static byte[] nonZeros(byte[] value)
value - An array of values.int compareTo(byte[] other,
int startIndex)
throws IOException
other - Array of characters to comparestartIndex - The index in the other array to the required charactersIOExceptionpublic int compareTo(NodeIndex other)
compareTo in interface Comparable<NodeIndex>other - The node index to compare