本文整理汇总了Java中org.mapdb.DB.getTreeMap方法的典型用法代码示例。如果您正苦于以下问题:Java DB.getTreeMap方法的具体用法?Java DB.getTreeMap怎么用?Java DB.getTreeMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mapdb.DB
的用法示例。
在下文中一共展示了DB.getTreeMap方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LocalitySensitiveHashing
import org.mapdb.DB; //导入方法依赖的package包/类
public LocalitySensitiveHashing(File file, int numFunctions , int numBands, Map<String,Integer> featureWeights ) {
if ( numFunctions % numBands != 0 ) throw new Error("Number of hash functions is not divisible by the number of bands.");
try {
DB db = DBMaker.newFileDB(file).closeOnJvmShutdown().make();
this.featureWeights = featureWeights;
this.function = MinHash.createHashFunctions(MinHash.HashType.POLYNOMIAL,numFunctions);
this.representation = db.getTreeMap("representation");
this.value = db.getTreeMap("value");
this.validity = db.getTreeMap("kvalue");
this.index = (Map[]) Array.newInstance(db.getTreeMap("index").getClass(),numBands);
this.indexTemp = (Map[]) Array.newInstance(new HashMap<Integer,Set<Integer>>().getClass(),numBands);
for ( int i = 0 ; i < numBands ; i++ ) {
this.indexTemp[i] = new HashMap<Integer,Set<Integer>>();
this.index[i] = db.getTreeMap("index-"+i);
}
} catch ( Exception ex ) { ex.printStackTrace(); throw new Error(ex); }
}
示例2: test
import org.mapdb.DB; //导入方法依赖的package包/类
/**
* 测试provider注册
*/
public void test(DB db) {
//create new collection (or open existing)
ConcurrentNavigableMap map = db.getTreeMap("collectionName");
map.put(1,"one");
map.put(new Random().nextInt(25500),"bnt_test" + new Random().nextInt(25005));
//persist changes into disk, there is also rollback() method
db.commit();
// db.close();
cnt.incrementAndGet();
}
示例3: GTFSFeed
import org.mapdb.DB; //导入方法依赖的package包/类
private GTFSFeed (DB db) {
this.db = db;
agency = db.getTreeMap("agency");
feedInfo = db.getTreeMap("feed_info");
routes = db.getTreeMap("routes");
trips = db.getTreeMap("trips");
stop_times = db.getTreeMap("stop_times");
frequencies = db.getTreeSet("frequencies");
transfers = db.getTreeMap("transfers");
stops = db.getTreeMap("stops");
fares = db.getTreeMap("fares");
services = db.getTreeMap("services");
shape_points = db.getTreeMap("shape_points");
feedId = db.getAtomicString("feed_id").get();
checksum = db.getAtomicLong("checksum").get();
// use Java serialization because MapDB serialization is very slow with JTS as they have a lot of references.
// nothing else contains JTS objects
patterns = db.createTreeMap("patterns")
.valueSerializer(Serializer.JAVA)
.makeOrGet();
tripPatternMap = db.getTreeMap("patternForTrip");
stopCountByStopTime = db.getTreeMap("stopCountByStopTime");
stopStopTimeSet = db.getTreeSet("stopStopTimeSet");
tripsPerService = db.getTreeSet("tripsPerService");
servicesPerDate = db.getTreeSet("servicesPerDate");
errors = db.getTreeSet("errors");
}
示例4: Core
import org.mapdb.DB; //导入方法依赖的package包/类
public Core(DB db) {
this.db = db;
// open existing an collection (or create new)
data = db.getTreeMap("objects");
session = db.getTreeMap("session");
if (session.get(Session_MYSELF)==null) {
//first time user
become(newUser("Anonymous " + NObject.UUID().substring(0,4)));
}
// map.put(1, "one");
// map.put(2, "two");
// // map.keySet() is now [1,2]
//
// db.commit(); //persist changes into disk
//
// map.put(3, "three");
// // map.keySet() is now [1,2,3]
// db.rollback(); //revert recent changes
// // map.keySet() is now [1,2]
//
// db.close();
}
示例5: SubscriptionImpl
import org.mapdb.DB; //导入方法依赖的package包/类
@Inject
public SubscriptionImpl(DB db)
{
projectSubscriptionMap = db.<String, List<String>> getTreeMap("ProjectSubscription");
userSubscriptionMap = db.<String, List<String>> getTreeMap("UserSubscription");
}
示例6: ReviewRequestServiceImpl
import org.mapdb.DB; //导入方法依赖的package包/类
@Inject
public ReviewRequestServiceImpl(DB db)
{
reviewRequestMap = db.<String, List<ReviewRequest>> getTreeMap("ReviewRequests");
}
示例7: getMap
import org.mapdb.DB; //导入方法依赖的package包/类
@Override
protected Map<String, byte[]> getMap(DB database)
{
//OPEN MAP
return database.getTreeMap("references");
}
示例8: AccountMap
import org.mapdb.DB; //导入方法依赖的package包/类
public AccountMap(WalletDatabase walletDatabase, DB database)
{
//OPEN MAP
this.addressMap = database.getTreeMap(ADDRESSES);
}