Search in sources :

Example 1 with Entry

use of de.lmu.ifi.dbs.elki.index.tree.Entry in project elki by elki-project.

the class AbstractRStarTreeNode method writeExternal.

/**
 * Calls the super method and writes the id of this node, the numEntries and
 * the entries array to the specified stream.
 */
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    // TODO: do we need to write/read the capacity?
    out.writeInt(entries.length);
    for (Entry entry : entries) {
        if (entry == null) {
            break;
        }
        entry.writeExternal(out);
    }
}
Also used : SpatialPointLeafEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry) Entry(de.lmu.ifi.dbs.elki.index.tree.Entry) SpatialDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry) SpatialEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)

Example 2 with Entry

use of de.lmu.ifi.dbs.elki.index.tree.Entry in project elki by elki-project.

the class AbstractXTreeNode method readExternal.

/**
 * Reads the id of this node, the numEntries and the entries array from the
 * specified stream. If the {@link #supernode} field is set, <code>this</code>
 * cannot be contained in <code>in</code>. Such a node has to be manually
 * filled using {@link #readSuperNode(ObjectInput, AbstractXTree)}.
 *
 * @param in the stream to read data from in order to restore the object
 * @throws java.io.IOException if I/O errors occur
 * @throws ClassNotFoundException If the class for an object being restored
 *         cannot be found.
 */
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    setPageID(in.readInt());
    isLeaf = in.readBoolean();
    supernode = in.readBoolean();
    numEntries = in.readInt();
    final int capacity = in.readInt();
    if (supernode) {
        // this node is a supernode and is yet to be filled
        capacity_to_be_filled = capacity;
        return;
    }
    // entries = (E[]) java.lang.reflect.Array.newInstance(eclass, capacity);
    if (isLeaf()) {
        entries = (Entry[]) new SpatialPointLeafEntry[capacity];
    } else {
        entries = (Entry[]) new XTreeDirectoryEntry[capacity];
    }
    for (int i = 0; i < numEntries; i++) {
        SpatialEntry s = isLeaf() ? new SpatialPointLeafEntry() : new XTreeDirectoryEntry();
        s.readExternal(in);
        entries[i] = s;
    }
}
Also used : SpatialPointLeafEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry) Entry(de.lmu.ifi.dbs.elki.index.tree.Entry) SpatialDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry) SpatialEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry) SpatialPointLeafEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry) SpatialEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)

Example 3 with Entry

use of de.lmu.ifi.dbs.elki.index.tree.Entry in project elki by elki-project.

the class AbstractXTreeNode method writeExternal.

/**
 * Calls the super method and writes the id of this node, the numEntries and
 * the entries array to the specified stream. If this node is a supernode, it
 * cannot fit into <code>out</code> and thus, only the header is written. The
 * remaining space is left empty, since supernodes are to be written to the
 * end of the file via {@link #writeSuperNode(ObjectOutput)}.
 */
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(getPageID());
    out.writeBoolean(isLeaf());
    out.writeBoolean(supernode);
    out.writeInt(numEntries);
    out.writeInt(entries.length);
    if (isSuperNode())
        // cannot fit this into out
        return;
    for (Entry entry : entries) {
        if (entry == null) {
            break;
        }
        entry.writeExternal(out);
    }
}
Also used : SpatialPointLeafEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry) Entry(de.lmu.ifi.dbs.elki.index.tree.Entry) SpatialDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry) SpatialEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)

Aggregations

Entry (de.lmu.ifi.dbs.elki.index.tree.Entry)3 SpatialDirectoryEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialDirectoryEntry)3 SpatialEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)3 SpatialPointLeafEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialPointLeafEntry)3