Android Open Source - Jello B Tree






From Project

Back to project page Jello.

License

The source code is released under:

Apache License

If you think the Android project Jello listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.atteo.jello.index;
/*  ww w  .  ja  v  a  2 s  . c  om*/
import com.atteo.jello.Record;
import com.atteo.jello.space.SpaceManagerPolicy;
import com.atteo.jello.store.Page;
import com.atteo.jello.store.PagedFile;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.name.Named;

public class BTree implements Index {
  static {
    System.loadLibrary("BTree");
  }
  private final int klassIndexPageId;
  private final PagedFile pagedFile;
  private final PagePoolProxy proxy;

  private int btree;
  
  @Inject
  public BTree(final PagedFile pagedFile, final PagePoolProxy proxy,
      final SpaceManagerPolicy spaceManagerPolicy,
      @Named("freeSpaceInfoSize") final int freeSpaceInfoSize,
      @Named("bTreeLeafCapacity") final short bTreeLeafCapacity,
      @Named("bTreeNodeCapacity") final short bTreeNodeCapacity,
      @Assisted final int klassIndexPageId) {
    this.pagedFile = pagedFile;
    this.klassIndexPageId = klassIndexPageId;
    this.proxy = proxy;

    btree = init(pagedFile, proxy, spaceManagerPolicy, freeSpaceInfoSize,
        bTreeLeafCapacity, bTreeNodeCapacity, klassIndexPageId);
  }

  public void create() {
    final Page bTreePage = proxy.acquire();
    bTreePage.setId(klassIndexPageId);
    bTreePage.reset();
    bTreePage.putInt(-1);
    pagedFile.writePage(bTreePage);
  }

  public native void commitNative(int btree);
  
  public native void debugNative(int btree);

  public native boolean findNative(int btree, Record record);

  public native void insertNative(int btree, Record record);

  public native boolean loadNative(int btree);

  public native void removeNative(int btree, int id);

  public native void updateNative(int btree, Record record);

  public native void iterateNative(int btree);
  
  public native int nextIdNative(int btree);
  
  
  public void commit() {
    commitNative(btree);
  }
  
  public void debug() {
    debugNative(btree);
  }

  public boolean find(Record record) {
    return findNative(btree, record);
  }

  public void insert(Record record) {
    insertNative(btree, record);
  }

  public boolean load() {
    return loadNative(btree);
  }

  public void remove(int id) {
    removeNative(btree, id);
  }

  public void update(Record record) {
    updateNative(btree, record);
  }

  public void iterate() {
    iterateNative(btree);
  }
  
  public int nextId() {
    return nextIdNative(btree);
  }
  
  private native int init(PagedFile pagedFile, PagePoolProxy proxy,
      SpaceManagerPolicy spaceManagerPolicy, int freeSpaceInfoSize,
      int bTreeLeafCapacity, int bTreeNodeCapacity, int klassIndexPageId);
}




Java Source Code List

android.util.FinitePool.java
android.util.Pool.java
android.util.PoolableManager.java
android.util.Poolable.java
android.util.Pools.java
android.util.SynchronizedPool.java
com.atteo.jello.DatabaseFile.java
com.atteo.jello.Expression.java
com.atteo.jello.JelloModule.java
com.atteo.jello.Jello.java
com.atteo.jello.PageUsage.java
com.atteo.jello.RecordPoolableManager.java
com.atteo.jello.Record.java
com.atteo.jello.StorableCollection.java
com.atteo.jello.StorableFactory.java
com.atteo.jello.StorableInfo.java
com.atteo.jello.Storable.java
com.atteo.jello.associations.BelongsTo.java
com.atteo.jello.associations.DatabaseField.java
com.atteo.jello.associations.HasMany.java
com.atteo.jello.index.BTree.java
com.atteo.jello.index.IndexFactory.java
com.atteo.jello.index.IndexModule.java
com.atteo.jello.index.Index.java
com.atteo.jello.index.PagePoolProxy.java
com.atteo.jello.klass.KlassManager.java
com.atteo.jello.klass.SimpleKlassManager.java
com.atteo.jello.schema.SchemaManagerFactory.java
com.atteo.jello.schema.SchemaManager.java
com.atteo.jello.schema.SchemaModule.java
com.atteo.jello.schema.Schema.java
com.atteo.jello.schema.SimpleSchemaManager.java
com.atteo.jello.schema.StorableWriter.java
com.atteo.jello.schema.VanillaStorableWriter.java
com.atteo.jello.space.AppendOnlyCacheNative.java
com.atteo.jello.space.AppendOnlyCache.java
com.atteo.jello.space.AppendOnly.java
com.atteo.jello.space.Hybrid.java
com.atteo.jello.space.NextFitHistogramNative.java
com.atteo.jello.space.NextFitHistogram.java
com.atteo.jello.space.NextFit.java
com.atteo.jello.space.SpaceManagerNative.java
com.atteo.jello.space.SpaceManagerPolicy.java
com.atteo.jello.space.SpaceManager.java
com.atteo.jello.space.SpaceModule.java
com.atteo.jello.space.VanillaHistogram.java
com.atteo.jello.store.HeaderPage.java
com.atteo.jello.store.ListPage.java
com.atteo.jello.store.PagePoolableManager.java
com.atteo.jello.store.PageSizeProvider.java
com.atteo.jello.store.Page.java
com.atteo.jello.store.PagedFileNative.java
com.atteo.jello.store.PagedFileRAF.java
com.atteo.jello.store.PagedFile.java
com.atteo.jello.store.StoreModule.java
com.atteo.jello.transaction.LockManager.java
com.atteo.jello.transaction.SimpleLockManager.java
com.atteo.jello.transaction.SimpleTransactionManager.java
com.atteo.jello.transaction.TransactionManager.java
com.atteo.jello.transaction.TransactionModule.java