All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sirix.index.IndexBuilder Maven / Gradle / Ivy

Go to download

SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.

There is a newer version: 0.11.0
Show newest version
package org.sirix.index;

import java.util.Set;
import org.sirix.api.json.JsonNodeReadOnlyTrx;
import org.sirix.api.visitor.JsonNodeVisitor;
import org.sirix.api.visitor.XmlNodeVisitor;
import org.sirix.api.xml.XmlNodeReadOnlyTrx;
import org.sirix.axis.DescendantAxis;
import org.sirix.axis.NonStructuralWrapperAxis;

/**
 * Build an index by traversing the current revision.
 *
 * @author Johannes Lichtenberger
 *
 */
public final class IndexBuilder {

  /**
   * Build the index.
   *
   * @param rtx the current {@link XmlNodeReadOnlyTrx}
   * @param builders the index builders
   */
  public static void build(final XmlNodeReadOnlyTrx rtx, final Set builders) {
    final long nodeKey = rtx.getNodeKey();
    rtx.moveToDocumentRoot();

    for (@SuppressWarnings("unused")
    final long key : new NonStructuralWrapperAxis(new DescendantAxis(rtx))) {
      for (final XmlNodeVisitor builder : builders) {
        rtx.acceptVisitor(builder);
      }
    }
    rtx.moveTo(nodeKey);
  }

  /**
   * Build the index.
   *
   * @param rtx the current {@link JsonNodeReadOnlyTrx}
   * @param builders the index builders
   */
  public static void build(final JsonNodeReadOnlyTrx rtx, final Set builders) {
    final long nodeKey = rtx.getNodeKey();
    rtx.moveToDocumentRoot();

    for (@SuppressWarnings("unused")
    final long key : new DescendantAxis(rtx)) {
      for (final JsonNodeVisitor builder : builders) {
        rtx.acceptVisitor(builder);
      }
    }
    rtx.moveTo(nodeKey);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy