Back to project page Jello.
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.
package com.atteo.jello.index; // w w w . j a v a2 s . c o m import java.util.HashMap; import com.atteo.jello.store.PageSizeProvider; import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.assistedinject.FactoryProvider; import com.google.inject.name.Names; public class IndexModule implements Module { // ---- SETTINGS private final short bTreeLeafCapacity; private final short bTreeNodeCapacity; // -------------- private final HashMap<String, String> properties; public IndexModule(final HashMap<String, String> properties) { final int pageSize = new PageSizeProvider().get(); bTreeLeafCapacity = (short) (pageSize - 16); bTreeNodeCapacity = (short) (pageSize - 16); this.properties = getDefaultProperties(); if (properties != null) this.properties.putAll(properties); } public void configure(final Binder binder) { binder.bind(IndexFactory.class).toProvider( FactoryProvider.newFactory(IndexFactory.class, BTree.class)); Names.bindProperties(binder, properties); } private HashMap<String, String> getDefaultProperties() { final HashMap<String, String> p = new HashMap<String, String>(); p.put("bTreeNodeCapacity", String.valueOf(bTreeNodeCapacity)); p.put("bTreeLeafCapacity", String.valueOf(bTreeLeafCapacity)); return p; } }