當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteArrayConverter類代碼示例

本文整理匯總了Java中org.hypergraphdb.storage.ByteArrayConverter的典型用法代碼示例。如果您正苦於以下問題:Java ByteArrayConverter類的具體用法?Java ByteArrayConverter怎麽用?Java ByteArrayConverter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ByteArrayConverter類屬於org.hypergraphdb.storage包,在下文中一共展示了ByteArrayConverter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: singleValueUUID

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public void singleValueUUID(int count)
{
	HGStore store = graph.getStore();
	ByteArrayConverter<HGPersistentHandle> conv = BAtoHandle.getInstance(graph.getHandleFactory());
	if (store.getIndex("benchUUIDs", conv, conv, null, null, false) != null)
			store.removeIndex("benchUUIDs");
	HGIndex<HGPersistentHandle, HGPersistentHandle> idx = store.getIndex("benchUUIDs", 
				   BAtoHandle.getInstance(graph.getHandleFactory()), 
				   BAtoHandle.getInstance(graph.getHandleFactory()), 
				   null,
				   null,
				   true);
	HGHandleFactory hFactory = graph.getHandleFactory();
	long start = System.currentTimeMillis();
	for (int i = 0; i < count; i++)
	{
		idx.addEntry(hFactory.makeHandle(), hFactory.makeHandle());
	}
	System.out.println("" + count + "," + (System.currentTimeMillis() - start)/1000.0);
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:21,代碼來源:StorageBench.java

示例2: IndexResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
/**
 * <p>Construct a result set matching a specific key.</p>
 * 
 * @param cursor
 * @param key
 */
public IndexResultSet(LmdbTxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter)
{
	checkArgNotNull(cursor, "cursor");
	
  this.converter = converter;
  this.cursor = cursor;
  this.key = new DatabaseEntry();
  this.data = new DatabaseEntry();
  if (keyIn != null)
  	assignData(this.key, keyIn.getData());

  try
 {
     cursor.cursor().get(CursorOp.GET_CURRENT, key, data);
     next = converter.fromByteArray(data.getData(), 0, data.getData().length);
     lookahead = 1;
 }
 catch (Throwable t)
 {
     throw new HGException(t);
 }
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:29,代碼來源:IndexResultSet.java

示例3: SingleValueResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public SingleValueResultSet(LmdbTxCursor cursor, DatabaseEntry keyIn,
		ByteArrayConverter<T> converter)
{
	this.converter = converter;
	this.cursor = cursor;
	this.key = new DatabaseEntry();
	this.data = new DatabaseEntry();
	if (keyIn != null)
		assignData(key, keyIn.getData());
	try
	{
		((SecondaryCursor) cursor.cursor()).get(CursorOp.GET_CURRENT, key,
				pkey, data);
		next = converter.fromByteArray(pkey.getData(), 0, pkey.getData().length);
		lookahead = 1;
	}
	catch (Throwable t)
	{
		throw new HGException(t);
	}

}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:23,代碼來源:SingleValueResultSet.java

示例4: KeyScanResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public KeyScanResultSet(LmdbTxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter)
{
    this.converter = converter;
    this.cursor = cursor;
    this.key = new DatabaseEntry();
    this.data = new DatabaseEntry();

    if (keyIn != null)
    	assignData(key, keyIn.getData());
  try
  {
      cursor.cursor().get(CursorOp.GET_CURRENT, key, data);
      next = converter.fromByteArray(key.getData(), 0, key.getData().length);
      lookahead = 1;
  }
  catch (Throwable t)
  {
      throw new HGException(t);
  }         
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:21,代碼來源:KeyScanResultSet.java

示例5: DefaultIndexImpl

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public DefaultIndexImpl(String indexName, 
		BJEStorageImplementation storage, 
		HGTransactionManager transactionManager,
		ByteArrayConverter<KeyType> keyConverter, 
		ByteArrayConverter<ValueType> valueConverter, 
		Comparator<byte[]> keyComparator,
		Comparator<byte[]> valueComparator)
{
	this.name = indexName;
	this.storage = storage;
	this.transactionManager = transactionManager;
	this.keyConverter = keyConverter;
	this.valueConverter = valueConverter;
	this.keyComparator = keyComparator;
	this.valueComparator = valueComparator;
	owndb = true;
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:18,代碼來源:DefaultIndexImpl.java

示例6: IndexResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
/**
 * <p>
 * Construct a result set matching a specific key.
 * </p>
 * 
 * @param cursor
 * @param key
 */
public IndexResultSet(BJETxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter) {
	/*
	 * id = idcounter++; System.out.println("Constructing index set with id " + id); StackTraceElement
	 * e[]=Thread.currentThread().getStackTrace(); for (int i=0; i <e.length; i++) { System.out.println(e[i]);
	 * }
	 */
	this.converter = converter;
	this.cursor = cursor;
	this.key = new DatabaseEntry();
	
	if (keyIn != null) {
		assignData(this.key, keyIn.getData());
	}
	
	try {
		cursor.cursor().getCurrent(key, data, LockMode.DEFAULT);
		next = converter.fromByteArray(data.getData(), data.getOffset(), data.getSize());
		lookahead = 1;
	}
	catch (Throwable t) {
		throw new HGException(t);
	}
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:32,代碼來源:IndexResultSet.java

示例7: SingleValueResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public SingleValueResultSet(BJETxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter) {
	//
	// The following is bit hacky because we want to avoid some of the default behavior
	// of the super constructor, which is incorrect when the "values" we are interested in 
	// are the DB's primary keys. So we duplicate its bebavior and override instantiation
	// of the current value.
	this.converter = converter;
	this.cursor = cursor;
	this.key = new DatabaseEntry();
	if (keyIn != null) {
		assignData(key, keyIn.getData());
	}
	
	try {
		((SecondaryCursor)cursor.cursor()).getCurrent(key, pkey, data, LockMode.DEFAULT);
		next = converter.fromByteArray(pkey.getData(), pkey.getOffset(), pkey.getSize());
		lookahead = 1;
	}
	catch (Throwable t) {
		throw new HGException(t);
	}

}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:24,代碼來源:SingleValueResultSet.java

示例8: KeyScanResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public KeyScanResultSet(BJETxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter) {
	this.converter = converter;
	this.cursor = cursor;
	this.key = new DatabaseEntry();
	
	if (keyIn != null) {
		assignData(key, keyIn.getData());
	}
	
	try {
		cursor.cursor().getCurrent(key, data, LockMode.DEFAULT);
		next = converter.fromByteArray(key.getData(), key.getOffset(), key.getSize());
		lookahead = 1;
	}
	catch (Throwable t) {
		throw new HGException(t);
	}
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:19,代碼來源:KeyScanResultSet.java

示例9: KeyScanResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public KeyScanResultSet(BDBTxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter)
{
    this.converter = converter;
    this.cursor = cursor;
    this.key = new DatabaseEntry();
    this.data = new DatabaseEntry();
    // TODO: for fixed size key and data,we should actually reuse the buffers, but
    // this has to be passed somehow as a configuration parameter to the HGIndex
    // implementation and down to result sets. It's a worthwhile optimization.
    this.key.setReuseBuffer(false);
    this.data.setReuseBuffer(false);

    if (keyIn != null)
    	assignData(key, keyIn.getData());
 try
 {
     cursor.cursor().getCurrent(key, data, LockMode.DEFAULT);
     next = converter.fromByteArray(key.getData(), key.getOffset(), key.getSize());
     lookahead = 1;
 }
 catch (Throwable t)
 {
     throw new HGException(t);
 }         
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:26,代碼來源:KeyScanResultSet.java

示例10: getOrCreateIndex

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
private <KeyType extends Object, ValueType extends Object> 
		HGIndex<KeyType, ValueType> getOrCreateIndex(HGIndexer indexer)
	{
		HGIndex<KeyType, ValueType> result = (HGIndex<KeyType, ValueType>)indices.get(indexer);
		if (result == null)			
		{
			String name = getIndexName(indexer);
			ByteArrayConverter<ValueType> converter = null;
			if (indexer instanceof HGValueIndexer)
				converter = (ByteArrayConverter<ValueType>)((HGValueIndexer)indexer).getValueConverter(graph);
			else
				converter = (ByteArrayConverter<ValueType>)BAtoHandle.getInstance(graph.getHandleFactory());
			result = graph.getStore().getIndex(name, 
											   (ByteArrayConverter<KeyType>)indexer.getConverter(graph), 
											   converter, 
											   indexer.getComparator(graph),
											   true);
//			if (result == null)
//				result = graph.getStore().createIndex(name, 
//													  (ByteArrayConverter<KeyType>)indexer.getConverter(graph), 
//													  converter, 
//													  indexer.getComparator(graph));
			indices.put(indexer, result);
		}
		return result;
	}
 
開發者ID:armatys,項目名稱:hypergraphdb-android,代碼行數:27,代碼來源:HGIndexManager.java

示例11: getIndex

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public <KeyType, ValueType> HGIndex<KeyType, ValueType> getIndex(
		String name, ByteArrayConverter<KeyType> keyConverter,
		ByteArrayConverter<ValueType> valueConverter,
		Comparator<?> comparator, boolean isBidirectional,
		boolean createIfNecessary)
{
	// TODO Auto-generated method stub
	return null;
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:10,代碼來源:PithosStore.java

示例12: DefaultIndexImpl

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public DefaultIndexImpl(String indexName, LmdbStorageImplementation storage,
		HGTransactionManager transactionManager,
		ByteArrayConverter<KeyType> keyConverter,
		ByteArrayConverter<ValueType> valueConverter,
		Comparator<byte[]> comparator)
{
	this.name = indexName;
	this.storage = storage;
	this.transactionManager = transactionManager;
	this.keyConverter = keyConverter;
	this.valueConverter = valueConverter;
	this.comparator = comparator;
	owndb = true;
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:15,代碼來源:DefaultIndexImpl.java

示例13: DefaultBiIndexImpl

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public DefaultBiIndexImpl(String indexName,
		LmdbStorageImplementation storage,
		HGTransactionManager transactionManager,
		ByteArrayConverter<KeyType> keyConverter,
		ByteArrayConverter<ValueType> valueConverter,
		Comparator<byte[]> comparator)
{
	super(indexName, storage, transactionManager, keyConverter,
			valueConverter, comparator);
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:11,代碼來源:DefaultBiIndexImpl.java

示例14: SingleKeyResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public SingleKeyResultSet(LmdbTxCursor cursor, DatabaseEntry key,
		ByteArrayConverter<T> converter)
{
	super(cursor, key, converter);
	try
	{
		ordered = cursor.cursor().getDatabase()
				.getConfig(cursor.txn().getDbTransaction()).isDupSort();
	}
	catch (Throwable t)
	{
		throw new HGException(t);
	}
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:15,代碼來源:SingleKeyResultSet.java

示例15: SingleKeyResultSet

import org.hypergraphdb.storage.ByteArrayConverter; //導入依賴的package包/類
public SingleKeyResultSet(BJETxCursor cursor, DatabaseEntry key, ByteArrayConverter<T> converter) {
	super(cursor, key, converter);
	try {
		ordered = cursor.cursor().getDatabase().getConfig().getSortedDuplicates();
	}
	catch (Throwable t) {
		throw new HGException(t);
	}
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:10,代碼來源:SingleKeyResultSet.java


注:本文中的org.hypergraphdb.storage.ByteArrayConverter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。