E - the type of Entry used in the indexpublic abstract class AbstractNode<E extends Entry> extends AbstractExternalizablePage implements Node<E>
| Modifier and Type | Field and Description |
|---|---|
protected Entry[] |
entries
The entries (children) of this node.
|
protected boolean |
isLeaf
Indicates whether this node is a leaf node.
|
protected int |
numEntries
The number of entries in this node.
|
| Constructor and Description |
|---|
AbstractNode()
Empty constructor for Externalizable interface.
|
AbstractNode(int capacity,
boolean isLeaf)
Creates a new Node with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addDirectoryEntry(E entry)
Adds a new directory entry to this node's children and returns the index of
the entry in this node's children array.
|
private int |
addEntry(E entry)
Adds the specified entry to the entries array and increases the numEntries
counter.
|
int |
addLeafEntry(E entry)
Adds a new leaf entry to this node's children and returns the index of the
entry in this node's children array.
|
java.util.Iterator<IndexTreePath<E>> |
children(IndexTreePath<E> parentPath)
Returns an enumeration of the children paths of this node.
|
void |
deleteAllEntries()
Deletes all entries in this node.
|
boolean |
deleteEntry(int index)
Deletes the entry at the specified index and shifts all entries after the
index to left.
|
int |
getCapacity()
Returns the capacity of this node (i.e. the length of the entries arrays).
|
java.util.List<E> |
getEntries()
Deprecated.
Using this method means an extra copy - usually at the cost of
performance.
|
E |
getEntry(int index)
Returns the entry at the specified index.
|
int |
getNumEntries()
Returns the number of entries of this node.
|
boolean |
isLeaf()
Returns true if this node is a leaf node, false otherwise.
|
void |
readExternal(java.io.ObjectInput in)
Reads the id of this node, the numEntries and the entries array from the
specified stream.
|
void |
removeMask(long[] mask)
Remove entries according to the given mask.
|
void |
splitByMask(AbstractNode<E> newNode,
long[] assignment)
Splits the entries of this node into a new node using the given assignments
|
void |
splitTo(AbstractNode<E> newNode,
java.util.List<E> sorting,
int splitPoint)
Redistribute entries according to the given sorting.
|
void |
splitTo(AbstractNode<E> newNode,
java.util.List<E> assignmentsToFirst,
java.util.List<E> assignmentsToSecond)
Splits the entries of this node into a new node using the given assignments
|
java.lang.String |
toString()
Returns a string representation of this node.
|
void |
writeExternal(java.io.ObjectOutput out)
Calls the super method and writes the id of this node, the numEntries and
the entries array to the specified stream.
|
equals, getPageID, hashCode, isDirty, setDirty, setPageIDprotected int numEntries
protected Entry[] entries
protected boolean isLeaf
public AbstractNode()
public AbstractNode(int capacity,
boolean isLeaf)
capacity - the capacity (maximum number of entries plus 1 for
overflow) of this nodeisLeaf - indicates whether this node is a leaf nodepublic final java.util.Iterator<IndexTreePath<E>> children(IndexTreePath<E> parentPath)
Nodepublic final int getNumEntries()
NodegetNumEntries in interface Node<E extends Entry>public final boolean isLeaf()
Nodepublic final E getEntry(int index)
Nodepublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class AbstractExternalizablePageout - the stream to write the object tojava.io.IOException - Includes any I/O exceptions that may occurpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class AbstractExternalizablePagein - the stream to read data from in order to restore the objectjava.io.IOException - if I/O errors occurjava.lang.ClassNotFoundException - If the class for an object being restored
cannot be found.public java.lang.String toString()
toString in class AbstractExternalizablePagepublic final int addLeafEntry(E entry)
addLeafEntry in interface Node<E extends Entry>entry - the leaf entry to be addedjava.lang.UnsupportedOperationException - if entry is not a leaf entry or this
node is not a leaf nodepublic final int addDirectoryEntry(E entry)
addDirectoryEntry in interface Node<E extends Entry>entry - the directory entry to be addedjava.lang.UnsupportedOperationException - if entry is not a directory entry or
this node is not a directory nodepublic boolean deleteEntry(int index)
index - the index at which the entry is to be deletedpublic final void deleteAllEntries()
public final int getCapacity()
@Deprecated public final java.util.List<E> getEntries()
private int addEntry(E entry)
entry - the entry to be addedpublic void removeMask(long[] mask)
mask - Mask to removepublic final void splitTo(AbstractNode<E> newNode, java.util.List<E> sorting, int splitPoint)
newNode - Node to split tosorting - Sorting to usesplitPoint - Split pointpublic final void splitTo(AbstractNode<E> newNode, java.util.List<E> assignmentsToFirst, java.util.List<E> assignmentsToSecond)
newNode - Node to split toassignmentsToFirst - the assignment to this nodeassignmentsToSecond - the assignment to the new nodepublic final void splitByMask(AbstractNode<E> newNode, long[] assignment)
newNode - Node to split toassignment - Assignment maskCopyright © 2019 ELKI Development Team. License information.